Skip to content

Instantly share code, notes, and snippets.

@acidlabs-snippets
Created January 13, 2013 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save acidlabs-snippets/4522387 to your computer and use it in GitHub Desktop.
Save acidlabs-snippets/4522387 to your computer and use it in GitHub Desktop.
Rails application template
# acid-template.rb
git :init
gitignore = run("curl https://gist.github.com/raw/3875160/5d2745ee9bcae0bb4addf4bc701d3fa9a48ce187/.gitignore")
file ".gitignore", gitignore
if yes?("Do you use RVM? (yes|no")
if yes?("Do you want to create a .rvmrc file for the project? (yes|no)")
# RVM
current_ruby = %x{rvm list}.match(/^=>\s+(.*)\s\[/)[1].strip
desired_ruby = ask("Which RVM Ruby would you like to use? [#{current_ruby}]")
desired_ruby = current_ruby if desired_ruby.blank?
gemset_name = ask("What name should the custom gemset have? [#{app_name}]")
gemset_name = app_name if gemset_name.blank?
# Create the gemset
run "rvm #{desired_ruby} gemset create #{gemset_name}"
# Let us run shell commands inside our new gemset. Use this in other template partials.
@rvm = "rvm use #{desired_ruby}@#{gemset_name}"
# Create .rvmrc
file '.rvmrc', @rvm
puts " #{@rvm}"
# Make the .rvmrc trusted
run "rvm rvmrc trust #{app_path}"
end
end
gem "pg"
gem "less-rails"
gem "twitter-bootstrap-rails"
gem "simple_form"
gem "select2-rails"
gem_group :development do
gem "better_errors"
gem "binding_of_caller"
gem "letter_opener"
gem "route66"
gem "rack-mini-profiler"
end
gem_group :test do
gem "factory_girl_rails"
gem "capybara"
gem "guard-rspec"
end
gem_group :development, :test do
gem "rspec-rails"
end
gem_group :assets do
gem 'therubyracer', :platforms => :ruby
end
run "bundle install"
generate("bootstrap:install")
layout_type = ask("Choose between fixed and fluid bootstrap layout (fixed|fluid)")
generate("bootstrap:layout", "application", "#{layout_type}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment