Skip to content

Instantly share code, notes, and snippets.

@manishval
Last active December 11, 2015 23:49
Show Gist options
  • Save manishval/4679493 to your computer and use it in GitHub Desktop.
Save manishval/4679493 to your computer and use it in GitHub Desktop.
Basic Rails application template
if yes?('Would you like to install country select')
gem('country_select')
end
gem 'bootstrap-will_paginate'
gem 'stamp'
gem 'gom_theme', path: '../gom_theme'
gem 'validates_timeliness'
gem_group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'brakeman'
gem 'bullet'
gem 'letter_opener'
gem 'quiet_assets'
gem 'rack-mini-profiler'
gem 'thin'
end
gem_group :development, :test do
gem 'factory_girl_rails'
gem 'faker'
gem 'guard'
gem 'guard-rspec'
gem 'rspec-rails'
end
gem_group :test do
gem 'capybara'
gem 'shoulda-matchers'
end
run 'bundle install'
generate('gom_theme:install')
generate('gom_theme:layout')
# Run gem initializers
generate('validates_timeliness:install')
file 'config/initializers/bullet.rb', <<-BODY
# if defined? Bullet
# Bullet.enable = true
# Bullet.alert = true
# # Bullet.bullet_logger = true
# end
BODY
application(nil, env: "development") do
"# Preview email in the browser instead of sending it
config.action_mailer.delivery_method = :letter_opener\n
# Turn off assets pipeline log
# config.quiet_assets = false\n"
end
application <<-BODY
# Override rails default generators
config.generators do |g|
g.fixture_replacement :factory_girl
end
BODY
run 'guard init rspec'
# run 'bundle exec guard init rspec'
generate('rspec:install')
inject_into_file 'spec/spec_helper.rb', after: "require 'rspec/autorun'" do <<-BODY
require 'capybara/rspec'
BODY
end
# Impove RSpec test outputs
append_file '.rspec' do
'--format documentation'
end
# Generate dashboard
if yes?('Would you like to generate a dashboard')
generate(:controller, 'Dashboard index')
route("root to: 'dashboard#index'")
end
# Clean up rails defaults
remove_file 'public/index.html'
remove_file 'app/assets/images/rails.png'
remove_file 'README.rdoc'
run "rm -rf test"
create_file 'README.md' do
"# #{app_name.titleize}"
end
append_file ".gitignore", "config/database.yml"
run "cp config/database.yml config/example_database.yml"
git :init
git add: '.'
git commit: "-m 'Initial commit'"
say <<-EOS
============================================================================
Your new Rails application is ready to go.
Don't forget to scroll up for important messages from installed generators.
EOS
# [TODO]
# -RVM
# -config.action_mailer.raise_delivery_errors = true
# readme("README")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment