Created
June 4, 2013 17:11
-
-
Save chussenot/5707729 to your computer and use it in GitHub Desktop.
A rails 4 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
# encoding: utf-8 | |
# see http://edgeguides.rubyonrails.org/rails_application_templates.html | |
# USAGE | |
# rake rails:template LOCATION=/path/to/template.rb | |
# rails new testing_template -m template.rb | |
# Git | |
git :init | |
git add: "." | |
git commit: "-m 'Initial Commit'" | |
$gems = [] | |
def add_gem? libs | |
libs.each do | lib | | |
if yes?("Do you want #{lib} ?") | |
gem lib | |
$gems << lib | |
end | |
end | |
end | |
# add Basic gem for Startup | |
if yes?("Do you want to add gems ?") | |
add_gem? %w{virtus attrio gaston guard guard-rspec} | |
gem_group :development, :test do | |
add_gem? %w{rspec-rails capistrano capistrano-af83 pry-rails} | |
end | |
if yes?("Do you want to add rbenv gemset ?") | |
end | |
p 'Install all of the required gems from your Gemfilet add bin # Add bin/ to source control' | |
run 'bundle install' | |
run 'bundle config --delete bin' # if exist ... | |
run 'bin/rake rails:update:bin' | |
git add: 'bin' # Add bin/ to source control | |
git commit: "-m 'Add bin/ to source control'" | |
git add: 'Gemfile*' | |
git commit: "-m 'Update Gemfile'" | |
end | |
# Add some gems configuration | |
run 'capify .' if $gems.include? 'capistrano' | |
if $gems.include? 'rspec' | |
run 'bin/rails g rspec:install' | |
run 'rm -Rf test' | |
end | |
run 'bin/guard init' if $gems.include? 'guard' | |
if $gems.include? 'gaston' | |
run 'mkdir config/gaston' | |
run 'bin/rails g gaston:config' | |
git add: 'config/gaston/ config/initializers/_gaston.rb' | |
git commit: "-m 'Add gaston folder and initializer'" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment