class TorrentRSS::CLI
Public Instance Methods
fetch()
click to toggle source
# File lib/torrent_rss/cli.rb, line 12 def fetch Config.config_file = options[:config] feed_urls = options[:feeds] || Config.feeds || [] directory = options[:directory] || Config.directory || '.' feed_urls.each do |url| feed = Feed.new url verbose "Fetching for url #{url}" feed.fetch! directory: directory, verbose: options[:verbose] end end
monitor()
click to toggle source
# File lib/torrent_rss/cli.rb, line 26 def monitor Signal.trap('INT') { puts 'shutting down' ; exit } if options[:daemonize] pid = fork do looped_fetch end Process.detach pid else looped_fetch end end
Private Instance Methods
looped_fetch()
click to toggle source
# File lib/torrent_rss/cli.rb, line 41 def looped_fetch loop do invoke :fetch verbose "sleeping 60s until next fetch..." sleep 60 end end
verbose(message)
click to toggle source
# File lib/torrent_rss/cli.rb, line 49 def verbose message puts message if options[:verbose] end