Skip to content

Instantly share code, notes, and snippets.

@Psli
Created March 2, 2011 09:20
Show Gist options
  • Save Psli/850681 to your computer and use it in GitHub Desktop.
Save Psli/850681 to your computer and use it in GitHub Desktop.
rails3 app template
# remove files
run "rm README"
run "rm public/index.html"
run "rm public/images/rails.png"
run "cp config/database.yml config/database.yml.example"
# install gems
run "rm Gemfile"
run "curl -L https://github.com/Psli/rails3-app-template/raw/master/Gemfile > Gemfile"
# bundle install
run "bundle install"
# generate rspec
generate "rspec:install"
# copy files
run "curl -L https://github.com/Psli/rails3-app-template/raw/master/watchr.rb > script/watchr.rb"
run "curl -L https://github.com/Psli/rails3-app-template/raw/master/dev.rake > lib/tasks/dev.rake"
# remove active_resource and test_unit
gsub_file 'config/application.rb', /require 'rails\/all'/, <<-CODE
require 'rails'
require 'active_record/railtie'
require 'action_controller/railtie'
require 'action_mailer/railtie'
CODE
# install jquery
run "curl -L http://code.jquery.com/jquery.min.js > public/javascripts/jquery.js"
run "curl -L http://github.com/rails/jquery-ujs/raw/master/src/rails.js > public/javascripts/rails.js"
gsub_file 'config/application.rb', /(config.action_view.javascript_expansions.*)/,
"config.action_view.javascript_expansions[:defaults] = %w(jquery rails)"
# add time format
# environment 'Time::DATE_FORMATS.merge!(:default => "%Y-%m-%d %I:%M %p", :ymd => "%Y-%m-%d")'
# .gitignore
append_file '.gitignore', <<-CODE
config/database.yml
*.tmproj
cmd.txt
Thumbs.db
.DS_Store
tmp/*
coverage/*
CODE
# keep tmp and log
run "touch tmp/.gitkeep"
run "touch log/.gitkeep"
# git commit
git :init
git :add => '.'
git :add => 'tmp/.gitkeep -f'
git :add => 'log/.gitkeep -f'
git :commit => "-a -m 'init'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment