Sha256: ad1265b99efe8c3096f917caa0d73e668f961b7f562a12392f867e4bcf5e1057
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
%w{ tinyatom murlsh }.each { |m| require m } module Murlsh # regenerate atom feed after a new url has been added class AddPost50UpdateFeed < Plugin @hook = 'add_post' def self.run(config) feed = TinyAtom::Feed.new(config['root_url'], config.fetch('page_title'), URI.join(config['root_url'], config['feed_file']), :hubs => config.fetch('pubsubhubbub_hubs', []). map { |x| x['subscribe_url'] } ) latest = Murlsh::Url.all(:order => 'id DESC', :limit => config.fetch('num_posts_feed', 25)) latest.each do |mu| options = { :author_name => mu.name, :summary => mu.title_stripped } if mu.is_image? options.merge!( :enclosure_type => mu.content_type, :enclosure_href => mu.url, :enclosure_title => 'Full-size' ) end Murlsh::failproof do if mu.via options.merge!( :via_type => 'text/html', :via_href => mu.via, :via_title => URI(mu.via).domain ) end end feed.add_entry(mu.id, mu.title_stripped, mu.time, mu.url, options) end Murlsh::openlock(config.fetch('feed_file'), 'w') do |f| feed.make(:target => f) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
murlsh-0.11.0 | plugins/add_post_50_update_feed.rb |
murlsh-0.10.0 | plugins/add_post_50_update_feed.rb |
murlsh-0.9.0 | plugins/add_post_50_update_feed.rb |