lib/rrimm/config.rb in rrimm-0.3.0 vs lib/rrimm/config.rb in rrimm-0.4.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'colorize'
+
module RRImm
class Config
attr :feeds, :cache
attr :default_formatter, :pipe
@@ -34,9 +36,24 @@
end
feeds.each do |feed|
fqdn = [feed.name]
fqdn << feed.uri unless feed.name.eql? feed.uri
puts "- #{fqdn.join ': '}"
+ end
+ end
+ end
+
+ def status(old_timestamp, very_old_timestamp, display_old_only)
+ ordered_feeds = @feeds.values.map { |f| [get_cache.read(f), f] }.sort_by { |el| el.first }
+ ordered_feeds.each do |el|
+ f = el[1]
+ case el.first
+ when 0..very_old_timestamp
+ puts "#{Time.at(el.first)} #{f.name}".colorize(:red)
+ when very_old_timestamp..old_timestamp
+ puts "#{Time.at(el.first)} #{f.name}".colorize(:yellow)
+ else
+ puts "#{Time.at(el.first)} #{f.name}".colorize(:green) unless display_old_only
end
end
end
def evaluate_feed_definition(feed_name, &block)