From 4dea5f74319a743a88f77f4efe0226054a955a25 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 14 May 2015 20:46:15 +0200 Subject: Separate lib and executable. Add a separate executable, and move the rendering of the feeds into the feed class. --- lib/rss2html.rb | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) (limited to 'lib/rss2html.rb') diff --git a/lib/rss2html.rb b/lib/rss2html.rb index 4890fd4..6d95382 100644 --- a/lib/rss2html.rb +++ b/lib/rss2html.rb @@ -14,32 +14,5 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -require_relative 'lib/feed_item' -require_relative 'lib/feed' - -require 'yaml' -require 'erb' - -config_file = File.expand_path('~/.config/feeds.yml') - -unless File.exists?(config_file) - puts "Config file #{config_file} not found. Please create it!" - exit -end - -feeds = YAML.load(IO.read(config_file)) -items = [] - -feed_header = ERB.new(IO.read('lib/views/feed_header.html.erb')) -feed_footer = ERB.new(IO.read('lib/views/feed_footer.html.erb')) -item_template = ERB.new(IO.read('lib/views/item.html.erb')) - -feeds.each do |t, f| - feed = Feed.new(t, f) - puts feed_header.result(binding) - - feed.fetch do |entry| - item = FeedItem.new(entry) - puts item_template.result(binding) - end -end +require 'rss2html/feed' +require 'rss2html/feed_item' -- cgit v1.2.3