lib/feed2gram.rb in feed2gram-1.0.0 vs lib/feed2gram.rb in feed2gram-1.1.0

- old
+ new

@@ -24,14 +24,18 @@ cache = LoadsCache.new.load(options) puts "Loading entries from feed: #{config.feed_url}" if options.verbose entries = ParsesEntries.new.parse(config.feed_url) puts "Found #{entries.size} entries in feed" if options.verbose posts = FiltersPosts.new.filter(entries, cache) - results = if options.populate_cache - puts "Populating cache, marking #{posts.size} posts as skipped" if options.verbose - posts.map { |post| Result.new(post: post, status: :skipped) } + if posts.empty? + puts "No new posts to publish after filtering already-processed posts in #{options.cache_path}" if options.verbose else - PublishesPosts.new.publish(posts, config, options) + results = if options.populate_cache + puts "Populating cache, marking #{posts.size} posts as skipped" if options.verbose + posts.map { |post| Result.new(post: post, status: :skipped) } + else + PublishesPosts.new.publish(posts, config, options) + end + UpdatesCache.new.update!(cache, results, options) end - UpdatesCache.new.update!(cache, results, options) end end