Skip to content

Instantly share code, notes, and snippets.

@jm
Created December 2, 2008 16:05
Show Gist options
  • Save jm/31152 to your computer and use it in GitHub Desktop.
Save jm/31152 to your computer and use it in GitHub Desktop.
Add "-m/--template" option to Rails generator to apply template to generated application. For example:
# Install plugins from git or svn
plugin "will-paginate", :git => "git://github.com/mislav/will_paginate.git"
plugin "old-restful-auth", :svn => "http://svn.techno-weenie.net/projects/plugins/restful_authentication/"
# Install gems
gem "jeremymcanally-context"
gem "bluecloth"
# Vendor file. Data in a string or...
vendor("borrowed.rb", <<CODE
def helpful_method
do_something_helpful_here
end
CODE
# ...file data from block return value.
# #initializer creates a new initializer file
initializer("crypto.rb") do
salt = "--#{Time.now}--#{rand}--#{srand(Time.now.to_i)}"
"SPECIAL_SALT = '#{salt}'"
end
To use a template, provide a file path or URL:
rails -m /path/to/my/rails_app.template
rails --template=http://www.mycompany.com/templates/companywide.template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment