Skip to content

Instantly share code, notes, and snippets.

@carlows
Last active February 17, 2016 16:47
Show Gist options
  • Save carlows/eeba4ef3a6eaf5dae22b to your computer and use it in GitHub Desktop.
Save carlows/eeba4ef3a6eaf5dae22b to your computer and use it in GitHub Desktop.
Rails Templates
default: &default
adapter: postgresql
port: 5432
pool: 5
timeout: 5000
development:
<<: *default
database: <%= app_name %>_development
test:
<<: *default
database: <%= app_name %>_test
production:
<<: *default
database: <%= app_name %>_production
source 'https://rubygems.org'
gem 'rails', '<%= RAILS_VERSION %>'
gem 'autoprefixer-rails'
gem 'newrelic_rpm'
gem 'pg'
gem 'rack-canonical-host'
gem 'rack-timeout'
gem 'simple_form'
gem 'puma'
gem 'uglifier'
gem 'jquery-rails'
gem 'jbuilder'
gem 'react-rails'
gem 'bootstrap-sass'
gem 'sassc-rails'
group :development do
gem 'dotenv-rails'
gem 'pry-rails'
gem 'byebug'
gem 'bullet'
gem 'bundler-audit'
gem 'spring'
gem 'web-console'
gem 'quiet_assets'
end
group :test do
gem 'capybara'
gem 'poltergeist'
gem 'factory_girl'
gem 'formulaic'
gem 'rspec-rails'
gem 'rspec-mocks'
gem 'shoulda-matchers'
gem 'timecop-console', require: 'timecop_console'
gem 'database_cleaner'
end
group :production, :staging do
gem 'rails_12factor'
gem 'rails_stdout_logging'
gem 'rails_serve_static_assets'
end
def source_paths
Array(super) +
[File.expand_path(File.dirname(__FILE__))]
end
RAILS_VERSION = '4.2.5.1'
remove_file "Gemfile"
template "Gemfile.erb", "Gemfile"
# config the app to use postgres
remove_file 'config/database.yml'
template 'database.erb', 'config/database.yml', app_name
copy_file 'puma.rb', 'config/puma.rb'
if yes?("Would you like to install Devise? Y/N")
gem "devise"
install_devise = true
end
after_bundle do
remove_dir "test"
generate "rspec:install"
generate "simple_form:install"
if install_devise
generate "devise:install"
end
end
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
@carlows
Copy link
Author

carlows commented Feb 17, 2016

Things to do:

  • Make the config/application.rb use rspec
  • Configure bootstrap
  • Change the application.css extension to application.scss
  • Make the models use uuids as ids by default

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