Scenario

You preffer to use HAML instead of ERB, so everytime you start a new rails project you have to add the gem and run some commands to set it up.
You also want to adjust some settings to turn off the stylesheets and javascripts generators and sometimes you want to add Devise & Bootstrap.

Instead of doing all these steps each time you start a new rails project, you can setup an application template like this:

application 'config.generators.stylesheets = false'
application 'config.generators.javascripts = false'
if yes?("Use HAML instead of ERB? (y/n)")
  gem 'haml-rails', '~> 1.0'
  bundle install
  rails_command haml:erb2haml
end
if yes?("Add devise? (y/n)")
  gem 'devise'
  bundle install
  generate devise:install
  model_name = ask("How do you want the devise model to be called? [user]")
    model_name = "user" if model_name.blank?
    generate "devise" model_name
    end
end

To use this template for a new project, you simple run:

hackman@dev:~$ rails new -m ~/path/to/my-template.rb

To add this template to an existing project, you simple run:

hackman@dev:~$ rails app:template LOCATION=~/path/to/my-template.rb

To set this template as default for all new projects you just need to add the following line to your .railsrc file:

--template=~/path/to/my_template.rb

Check out the Rails docs for more info about application templates.