Skip to content

Instantly share code, notes, and snippets.

@lorennorman
Created April 7, 2009 19:02
Show Gist options
  • Save lorennorman/91403 to your computer and use it in GitHub Desktop.
Save lorennorman/91403 to your computer and use it in GitHub Desktop.
My favorite Rails setup.
# My Rails 2.3 Template
# You can use it like this:
# rails your_app_name -m http://gist.github.com/91403.txt
# Plugins
plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git'
plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git'
plugin 'role_requirement', :git => 'git://github.com/lorennorman/role_requirement.git'
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
plugin 'aasm', :git => 'git://github.com/rubyist/aasm.git'
plugin 'make_resourceful', :git => "git://github.com/hcatlin/make_resourceful.git"
plugin 'haml', :git => "git://github.com/nex3/haml.git"
# Specify Gems
gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => 'http://gems.github.com'
gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'
# Install Gems
rake('gems:install', :sudo => true)
# Freeze Gems
rake('gems:unpack:dependencies')
# Run rspec generator
generate("rspec")
# Generate restful-authentication user and session
generate("authenticated", "user session --aasm")
# Generate roles for User
generate("roles", "Role User")
# Freeze Rails into vendor/rails
freeze!
# Add Capistrano
capify!
# jquery and jquery-form
run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js > public/javascripts/jquery.js"
run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
# Remove unnecessary Rails files
run 'rm README'
run 'rm public/index.html'
run 'rm public/favicon.ico'
run 'rm public/images/rails.png'
# Remove temp dirs
["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
run("rmdir ./#{f}")
end
# Hold empty dirs
run("find . \\( -type d -empty \\) -and \\( -not -regex ./\\.git.* \\) -exec touch {}/.gitignore \\;")
# Initialize Git
git :init
# Create our .gitignore file
file '.gitignore', <<-CODE
log/\\*.log
log/\\*.pid
db/\\*.db
db/\\*.sqlite3
db/schema.rb
tmp/\\*\\*/\\*
.DS_Store
doc/api
doc/app
config/database.yml
CODE
# Make a database.yml sample
run "cp config/database.yml config/database.yml.sample"
# Commit and get started!
git :add => "."
git :commit => "-m 'Initial commit chock full of plugins, gems, initialization scripts and .gitignores.'"
# Ready to "rake db:migrate" to install the users and roles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment