Skip to content

Instantly share code, notes, and snippets.

@rjgroller
Last active August 29, 2015 14:05
Show Gist options
  • Save rjgroller/ce196f7c8227f1d9d0b7 to your computer and use it in GitHub Desktop.
Save rjgroller/ce196f7c8227f1d9d0b7 to your computer and use it in GitHub Desktop.
# Rails Startup Template
# note - requires gem thor
# Call with rails new <app_name> -m <template_PATH>
# Always use development gems
gem_group :development do
gem "pry-rails"
gem 'pry-byebug'
gem "quiet_assets"
gem "annotate"
end
gem_group :test, :development do
gem "factory_girl_rails"
gem "rspec-rails"
gem "capybara"
end
# Remove Turbolinks
say 'Silly turbolinks. Delete...'
gsub_file "Gemfile", /^gem\s+["']turbolinks["'].*$/,''
case ask("Choose Template Engine:(erb, haml, slim)", :limited_to => %w[erb haml slim])
when "haml"
# HAML templating language (http://haml.info)
gem "haml-rails"
gem 'erb2haml' #rake haml:replace_erbs
when "slim"
# A lightweight templating engine (http://slim-lang.com)
gem "slim-rails"
when "erb"
end
# User authentication with devise
devise = yes? 'Use devise?'
gem "devise" if devise
# Optional template framework and tools
bootstrap = yes? 'Use twitter bootstrap?'
gem "twitter-bootstrap-rails" if bootstrap
gem "bootstrap_form" if bootstrap
foundation = yes? 'Use foundation instead?'
gem "foundation-rails" if foundation
# Optional development gems
bettererrors = yes? 'Use better errors?'
gem "better_errors", group: :development if bettererrors
bindingofcaller = yes? 'Use binding of caller?'
gem "binding_of_caller", group: :development if bindingofcaller
# Change out database
#pg = yes? 'Use postgresql instead of sqlite3?'
#gsub_file "Gemfile", /^gem\s+["']sqlite3["'].*$/,'' if pg
#gem "pg" if pg
#heroku = yes? 'Is this going on heroku?'
#gem 'rails_12factor', group: :production if heroku
# Run bundle install
say "Running bundle install"
run "bundle install"
# Replace erb...with haml
rake "haml:replace_erbs"
# Remove Turbolink Remnants
gsub_file('app/views/layouts/application.html.haml', /\, \'data-turbolinks-track\' => true/, '')
gsub_file('app/assets/javascripts/application.js', /\= require turbolinks/, '')
# Run Template Framework
run("rails g bootstrap:install static") if bootstrap
run("rails g foundation:install") if foundation
# Generate default layout page
run("rails g bootstrap:layout application fluid -f") if bootstrap
# First Git commit
git :init
git add: "."
git commit: %Q{ -m 'Initial commit' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment