Rails Templates: My Template

I just read the article by Pratik Naik from the Rails Core Team regarding Rails Templates.

Have you ever wished you could start out your Rails application with all of your gems installed and all of your standard setup items completed? Well, wait no longer. You can now do it with Rails Templates. Pratik covered it pretty well, so I’m not going to repeat what he’s done. Rather, I’m going to share a template of my own and explain why I included what I did.

I’ve saved the template in a gist on github:

gem "cucumber"
gem "webrat", :version => '>= 0.4.4'
gem "rspec"
gem "rspec-rails"
gem "daemons"
gem "nifty-generators"

plugin(:annotate_models, :svn => "http://repo.pragprog.com/svn/Public/plugins/annotate_models")
plugin(:daemon_generator, :git => "git://github.com/dougal/daemon_generator.git")

rake "gems:install"


rake "db:migrate"
rake "annotate_models"

generate(:controller, "site", "index")
route "map.root :controller => :site"

git :init
git :add => "."
git :commit => "-a -m 'Initial commit'"

First off, I’ve included the cucumber, webrat, rspec, and rspec-rails gems. This is so I can write tests for my application.

The daemons gem and daemons generator plugin are for creating daemons that perform recurring tasks.

Nifty generators allows us to add authentication to our project and set up a basic layout.

The annotate_models plugin creates a rake task that when run puts a series of comments at the beginning of each model that shows the schema for the table the model is based on. The comments also translate quite nicely to HTML by Rdoc.

Finally, a controller is created to contain the index page of the new application and a route is set up to direct the index of the site to the new controller and action. It is then initialized into a git repository.

Please add your own links to templates in the comments. If there’s something you think should be added to a standard template, please leave that in a comment as well.

Leave a Comment

{ 1 trackback }