Easily generate a Rails 3 application with RSpec, Factory Girl, Haml, and jQuery in one line:

% rails new my_app -J -T -m \
    http://github.com/leshill/rails3-app/raw/master/app.rb

rvm

We love rvm, so the application has an .rvmrc generated to specify a gemset.

Generators

This also gives you the Factory Girl and Haml Rails 3 generators — the generators for RSpec are in the RSpec gem — so that your factories and views are generated using Factory Girl and Haml, and that all your generated tests are specs. These generators are from the rails3_generators gem, we pulled them out to avoid all the other dependencies included in that gem.

JavaScript Includes

Since the Rails helper javascript_include_tag :defaults is looking for Prototype, we used this to add a new JavaScript expansion to pull in the jQuery libraries. Use it like so:

1= javascript_include_tag :jquery

git

We love git, so the application has a git repo initialized with all the initial changes staged.

Wrap Up

After the application has been generated, there are a few clean up commands to run:

  % cd my_app
  % gem install bundler
  % bundle install
  % bundle lock
  % script/rails generate rspec:install
blog comments powered by Disqus