Module: Postwave::RssHelper
Constant Summary
Constants included from BlogUtilities
BlogUtilities::CONFIG_FILE_NAME, BlogUtilities::INDEX_FILE_NAME, BlogUtilities::META_DIR, BlogUtilities::POSTS_DIR, BlogUtilities::RSS_FILE_NAME, BlogUtilities::SUMMARY_FILE_NAME, BlogUtilities::TAGS_DIR
Instance Method Summary collapse
Methods included from BlogUtilities
#config_values, #directory_paths, #file_paths, #find_missing_paths, #is_set_up?
Instance Method Details
#build_rss(posts) ⇒ Object
8 9 10 11 12 |
# File 'lib/postwave/rss_helper.rb', line 8 def build_rss(posts) File.open(File.join(Dir.pwd, POSTS_DIR, META_DIR, RSS_FILE_NAME), "w") do |rss| rss << rss_content(posts) end end |
#rss_content(posts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/postwave/rss_helper.rb', line 14 def rss_content(posts) RSS::Maker.make("2.0") do |maker| maker.channel.title = config_values[:name] maker.channel.description = config_values[:description] maker.channel.link = config_values[:url] maker.channel.generator = "Postwave" maker.channel.updated = Time.now.to_s posts.each do |post| link = "#{config_values[:url]}/#{config_values[:posts_path]}/#{post.slug}" maker.items.new_item do |item| item.title = post.title item.link = link item.description = post.body item.pubDate = post.date end end end end |