Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres

Here's my super fun and easy rails setup

Usage "rails new my_cool_app -m path/to/template.rb *My template.rb file for taking care of some of the boring basic configuration of a new rails app, create the repo and push it to Github. *Using mini-test / capybara / guard / spring /
#add guard-minitest and spring to dev
gem_group :development do
gem 'guard-minitest'
gem 'spring'
gem_group :test do
gem 'minitest-rails-capybara'
run "bundle install"
#install minitest test_helper
#config minitest Spec DSL and Fixtures defaults
environment "config.generators do |g|\n g.test_framework :mini_test, spec: true, fixture: true\n end"
#uncomment minitest-rails-capybara and pride in test_helper
# sed -i in osx needs to have a file explicitly named as backup
# hence the blank ''
run "sed -i '' '8 s/^ *# //' test/test_helper.rb"
run "sed -i '' '11 s/^ *# //' test/test_helper.rb"
#create postgres DB for / Adds default user to username for
#development and test
run "psql -c 'CREATE DATABASE #{app_path}_development;'"
run "psql -c 'CREATE DATABASE #{app_path}_test;'"
run "sed -i '' '1,54 s/username: #{app_path}/username: #{ENV['USER']}/' config/database.yml"
#Add minitest features to Rake task
run %q^echo 'MiniTest::Rails::Testing.default_tasks << "features"' >> Rakefile^
#install guard-minitest
run "bundel exec guard init minitest"
#uncomment and comment Guardfile / Add spring: 'rake test' to file
run "sed -i '' '6,8 s/^/#/' Guardfile"
run "sed -i '' '14,20 s/^ *#//' Guardfile"
run "sed -i '' '11,13 s/^ *#//' Guardfile"
run %Q{sed -i '' "s/^guard :minitest do/guard :minitest, spring: 'rake test' do/" Guardfile}
#Add spring to bins and start spring
run 'spring binstub --all'
run "rm README.rdoc"
run "touch"
#Initialize local Git repository and Initial Commit
git :init
git add: "."
git commit: "-a -m 'Initial commit'"
#Create remote repo on Github and push
run "curl -u '#{ENV['USER']}' -d '{\"name\":\"#{app_path}\"}'"
git remote: "add origin{ENV['USER']}/#{app_path}.git"
git push: "origin master"
#add custom error pages
#continue to add gems and config the

rhc commented May 22, 2014

Hi Ivanoats,
Thanks for sharing this gist.
I just want to point the little typo on line 36. bundel instead of bundle.

avatsaev commented May 4, 2016

there is no such thing as bundel

sally commented Oct 28, 2016


Downvoting because this was merely "fun" and not "super fun".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment