Blogify
A Rails engine for embedding Posterous blog extracts
Installation
Configure gems inside your app:
config.gem 'siyelo-blogify', :lib => "blogify"
Then
$ rake gems:install
Or manually;
$ sudo gem install siyelo-blogify
Generator
To set up your Rails project, run this generator:
ruby script/generate blogify_install
This will install an initializer which describes ALL Blogify’s configuration options, so be sure to take a look at it.
Basic Usage
As part of the generator, you get an initializer that kicks off a Rufus task every N hours (see config/initializiers/blogify.rb).
Once the rufus scheduler task is running, it will go off and cache your last N (BlogPost.post_limit) blog posts locally.
To display your posts, all you need to do is read the cached posts in your controller action.
@blog_posts = BlogPost.find(:all, :limit => BLOG_POST_LIMIT)
And render them in your view as you wish. For convenience, some view partials are included as examples;
= render :partial => '/blog_posts/list', :locals => { :blog_posts => @news_posts }
Advanced Usage
Blogify can also work with multiple Posterous blogs. The BlogPost model is compatible with STI, so all you need to do is subclass it. E.g. in app/models/news_post.rb
def NewsPost < BlogPost
...
end
You’ll need to set up your rufus cron task to cache the relevant blog posts
scheduler.every '1h' do
...
NewsPost.cache_posts( 'some_other_posterous_user', 5)
end
And the controller/views work pretty much the same
@news_posts = NewsPost.find(:all, :limit => BLOG_POST_LIMIT)
TODO
Please refer to TODO file.
Maintainers
-
Glenn Roberts
Contributors
Check them in the CHANGELOG or do ‘git shortlog -s -n` in the cloned repository.
Bugs and Feedback
If you discover any bugs or want to drop a line, feel free to create an issue on GitHub.
github.com/siyelo/blogify/issues
MIT License. Copyright 2010. Siyelo Software CC. www.siyelo.com