-
-
Save Epictetus/1186684 to your computer and use it in GitHub Desktop.
rails template for 3.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Usage | |
# | |
# rails new yourapp -m https://raw.github.com/gist/1178242/3c77cfffeb99f32d19333de986ff41283aa9eb26/rails_template_for_3.1.rb -T --skip-bundle | |
# | |
git :init | |
append_file '.gitignore', <<-END | |
.rvmrc | |
vendor/bundle | |
END | |
file '.rvmrc', 'rvm 1.9.2' | |
gem 'annotate', :git => 'https://github.com/ctran/annotate_models', :group => :development | |
gem 'i18n_generators', :group => :development | |
gem 'active_reload', :group => :development | |
haml = yes?('do you want to use haml?') | |
autotest = yes?('do you want auto-test environment?') | |
main_controller = yes?('do you want to use main controller?') | |
if haml | |
gem 'haml-rails' | |
end | |
if autotest | |
gem 'rspec-rails', :group => [:development, :test] | |
gem 'fabrication', :group => :test | |
gem 'capybara', :group => :test | |
gem 'database_cleaner', :group => :test | |
gem 'launchy', :group => :test | |
gem 'guard-rspec' ,:group => :test | |
gem 'guard-bundler', :group => :test | |
gem 'rb-fsevent', :require => false, :group => :test | |
gem 'spork', :group => [:development, :test] | |
gem 'growl', :group => :test | |
end | |
run 'bundle install --path vendor/bundle --without production' | |
if autotest | |
run 'script/rails generate rspec:install' | |
run 'bundle exec spork rspec -b' | |
# TODO: modify spec_helper.rb | |
file 'Guardfile', <<-'END' | |
guard 'rspec', :version => 2 do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { "spec" } | |
# Rails example | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } | |
watch(%r{^spec/support/(.+)\.rb$}) { "spec" } | |
watch('spec/spec_helper.rb') { "spec" } | |
watch('config/routes.rb') { "spec/routing" } | |
watch('app/controllers/application_controller.rb') { "spec/controllers" } | |
# Capybara request specs | |
watch(%r{^app/views/(.+)/.*\.(erb|haml|coffee)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } | |
end | |
guard 'bundler' do | |
watch('Gemfile') | |
# Uncomment next line if Gemfile contain `gemspec' command | |
# watch(/^.+\.gemspec/) | |
end | |
END | |
end | |
git :add => '.', :commit => '-m "initial commit"' | |
if main_controller | |
generate 'controller', 'main index' | |
route 'root :to => "main#index"' | |
git :rm => 'public/index.html' | |
git :add => '.', :commit => "-m 'added main controller'" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment