Created
December 7, 2012 09:29
-
-
Save gumayunov/4232098 to your computer and use it in GitHub Desktop.
Rails 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
gem 'pg' | |
gem 'jquery-rails' | |
gem "haml-rails" | |
gem 'simple_form' | |
gem "rabl", git: "git://github.com/nesquena/rabl.git" | |
gem "unicorn" | |
gem 'state_machine' | |
gem 'haml-rails' | |
gem_group :development do | |
# deployment | |
gem "capistrano" | |
gem "rvm-capistrano" | |
gem "capistrano-ext" | |
gem 'capistrano_colors' | |
# guard | |
gem "spork" | |
gem "guard" | |
gem "guard-bundler" | |
gem "guard-spork" | |
gem "guard-rspec" | |
gem "guard-cucumber" | |
gem "guard-migrate" | |
gem 'guard-yard' | |
# irb replacement | |
gem "rb-inotify", '~> 0.8.8' | |
gem "pry" | |
gem "pry-rails" | |
# documentation | |
gem "yard" | |
gem 'redcarpet' | |
gem 'github-markup' | |
gem 'annotate', '~> 2.5.0' | |
end | |
gem_group :test do | |
gem 'rspec-rails' | |
gem 'factory_girl_rails', require: false | |
gem 'database_cleaner' | |
gem 'simplecov', :require => false | |
# gem 'ci_reporter' | |
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git' | |
gem 'cucumber-rails', require: false | |
gem 'timecop' | |
end | |
uncomment_lines 'Gemfile', /gem 'therubyracer'/ | |
inject_into_file 'Gemfile', after: "group :assets do\n" do <<-RUBY | |
gem "twitter-bootstrap-rails" | |
RUBY | |
end | |
uncomment_lines 'Gemfile', /gem 'debugger'/ | |
inject_into_file 'Gemfile', after: "gem 'debugger'" do <<-RUBY | |
, group: [:development, :test] | |
RUBY | |
end | |
run 'bundle install' | |
say "Gems were installed" | |
generate 'bootstrap:install' | |
generate 'bootstrap:layout', 'application', 'fixed' | |
generate 'simple_form:install', '--bootstrap --template-engine haml' | |
inside 'config/initializers' do | |
uncomment_lines 'simple_form.rb', /config.form_class/ | |
gsub_file 'simple_form.rb', /config\.form_class .*$/, "config.form_class = 'form-horizontal'" | |
end | |
# clean up rails defaults | |
remove_file 'public/index.html' | |
remove_file 'app/assets/images/rails.png' | |
remove_file 'app/views/layouts/application.html.erb' | |
run 'cp config/database.yml config/database.example' | |
generate 'cucumber:install --spork' | |
inject_into_file 'features/support/env.rb', after: "Spork.each_run do\n" do <<-RUBY | |
require 'factory_girl' | |
FactoryGirl.reload | |
I18n.backend.reload! | |
RUBY | |
end | |
generate 'rspec:install --spork' | |
run 'bundle exec guard init' | |
application do | |
<<-eos | |
# Customize generators | |
config.generators do |g| | |
g.template_engine :haml | |
g.test_framework :rspec, fixture: true | |
g.fixture_replacement :factory_girl, dir: 'spec/factories' | |
g.stylesheets false | |
g.javascripts false | |
end | |
eos | |
end | |
inside 'spec' do | |
comment_lines 'spec_helper.rb', 'use_transactional_fixtures' | |
comment_lines 'spec_helper.rb', 'fixture_path' | |
inject_into_file 'spec_helper.rb', after: "RSpec.configure do |config|\n" do <<-RUBY | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :transaction | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner.start | |
end | |
config.after(:each) do | |
DatabaseCleaner.clean | |
end | |
RUBY | |
end | |
inject_into_file 'spec_helper.rb', after: "Spork.each_run do\n" do <<-RUBY | |
require 'factory_girl' | |
FactoryGirl.reload | |
I18n.backend.reload! | |
RUBY | |
end | |
append_file 'spec_helper.rb' do <<-RUBY | |
# http://stackoverflow.com/questions/5918606/disable-a-group-of-tests-in-rspec | |
module RSpec | |
module Core | |
module DSL | |
def xdescribe(*args, &blk) | |
describe *args do | |
pending "group of examples" | |
end | |
end | |
alias xcontext xdescribe | |
end | |
end | |
end | |
RUBY | |
end | |
end | |
run 'spork --bootstrap' | |
remove_dir 'test' | |
remove_dir 'vendor' | |
remove_file 'README.rdoc' | |
empty_directory 'spec/factories' | |
create_file 'spec/factories/.gitkeep' | |
append_file '.gitignore' do <<-'FILE' | |
.sass-cache | |
*.swp | |
*.swo | |
*.swn | |
*.tmproj | |
.DS_Store | |
.rvmrc | |
.ruby-version | |
.rspec | |
config/database.yml | |
.bundle/* | |
public/stylesheets/* | |
public/javascripts/coffeescripts/** | |
.yardoc | |
coverage | |
project_files | |
# sublime-text-2 | |
*.sublime-project | |
*.sublime-workspace | |
# ctags | |
.tags | |
.tags_sorted_by_file | |
FILE | |
end | |
git :init | |
say "Completed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment