Hobo Template - Creating a blog under a minute

Blog ยป Hobo Template - Creating a blog under a minute

Posted on 20 Aug 2012 15:23

You can use this template to create a blog with hobo in a few seconds:

say ("Installing gems so that we can scaffold...")
run 'bundle install'
generate 'hobo:setup_wizard' if yes? "Wanna run hobo:setup_wizard?"
 
generate 'hobo:resource', 'Post title:string text:text'
 
inject_into_class 'app/models/post.rb', 'Post' do
  <<-EOS
  attr_accessible :title, :text
  default_scope :order => 'created_at DESC'
  validates :title, :presence => true,
  :length => { :minimum => 5 }
  EOS
end
 
route "root :to => 'posts#index'"

Clean and DRY… Hobo is very productive…

Hobo do not use templates while creating a project so use it after creating a project

hobo new demo_blog --skip-setup
cd demo_blog
rake rails:template LOCATION=../template_demo_blog_hobo.rb

This adventure require at least Hobo 1.4 . It is not released yet at the time of writing. You might need to install it directly from GitHub

If you like this page, please spread the word: diggdel.icio.usFacebook

You can contact me if you have questions or corrections.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License