Created
November 14, 2012 09:02
-
-
Save yasuoza/4071096 to your computer and use it in GitHub Desktop.
Rails3 Application template
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
# -*- coding: utf-8 -*- | |
# | |
# Usage | |
# | |
# rails new yourapp -m https://raw.github.com/gist/4071096/4541b3f89f63d906156b429c7d5779231a1d23bb/rails3_application_template.rb -T --skip-bundle | |
# | |
use_rspec = yes?('Do you want to use rspec?') | |
use_slim = yes?('Do you want to use slim?') | |
unless use_slim | |
use_haml = yes?('Do you want to use haml?') | |
end | |
run 'rm .gitignore' | |
get 'https://raw.github.com/github/gitignore/master/Rails.gitignore', '.gitignore' | |
insert_into_file '.gitignore', "/public/assets/*\n", after: "/public/system/*\n" | |
if use_slim | |
gem 'slim-rails' | |
end | |
if use_haml | |
gem 'haml-rails' | |
end | |
if use_rspec | |
gem_group :development, :test do | |
gem 'rspec-rails' | |
gem 'capybara' | |
gem 'database_cleaner' | |
gem 'factory_girl_rails' | |
gem 'spork', '~> 1.0rc' | |
gem 'simplecov', :require => false | |
gem 'simplecov-rcov' | |
end | |
end | |
gem_group :development do | |
gem 'pry' | |
gem 'pry-doc' | |
gem 'pry-rails' | |
end | |
run 'bundle install --path vendor/bundle --binstubs' | |
if use_rspec | |
run 'script/rails generate rspec:install' | |
run 'bundle exec spork rspec -b' | |
spec_helper_file = "spec/spec_helper.rb" | |
contents = File.read(spec_helper_file) | |
File.open(spec_helper_file, "wb") do |f| | |
f.puts <<-'RUBY' | |
require 'simplecov' | |
require 'simplecov-rcov' | |
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter | |
SimpleCov.start 'rails' | |
RUBY | |
f.puts contents | |
end | |
insert_into_file '.rspec', "--drb", after: "--color\n" | |
end | |
git :init | |
git :add => '.', :commit => '-m "Initial commit"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support Rails4.0