This is a template which allows creating new Ruby on Rails 3 applications quickly using some opinionated defaults. It is inspired by ffmike's BigOldRailsTemplate Rails 2 template project. To use templater with your Rails apps, use the -m switch when creating your application:
After cloning the rails-templater to your hard drive, you can generate a new app like so:
If you want to use Active Record with MySql: rails new application_name -JT -d mysql -m /path/to/rails-templater/templater.rb
If you want to use Mongo DB with Mongoid: rails new application_name -JOT -m /path/to/rails-templater/templater.rb
To have a hermetic gem environment, it is advisable to create a gemset just for your new rails app. To create a new rails app with its own gemset:
-
Clone rails-templater to your hard drive
-
Run the bootstrap.rb file with the RVM installed rubie and the name of your app as arguments
ruby /path/to/rails-templater/bootstrap.rb [rvm-rubie] [name of new app]
This will:
- create a new gemset in the RVM rubie you specified and give it the name you chose for your app
- change into the new gemset (start using it)
- install the bundler and rails gem into your new gemset
- run the command to generate a new rails app with the name you picked
Note that the line to generate the new rails app assumes that you want Active Record/MySql. If you intend to use Mongo, then just change the last line in bootstrap.rb from
system("rails new #{app_name} -JT -d mysql -m #{template_file}")
to:
system("rails new #{app_name} -JOT -m #{template_file}")
Rails Templater will generate the following:
- Uses Haml as the template engine
- Uses Sass for generating CSS
- jQuery for JavaScript over Prototype
- Optionally uses Compass for design with the blueprint/semantic framework
- Uses Active Record as the default ORM
- Optionally uses Mongoid as the Object Document Model
- RSpec for testing
- factory_girl for fixture replacement
- remarkable for ActiveModel RSpec matchers
- Optionally uses Cucumber for integration tests
- Fork the project.
- Make your feature addition or bug fix.
- Send me a pull request. Bonus points for topic branches.