Skip to content

Instantly share code, notes, and snippets.

@Lytol
Created December 31, 2014 23:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lytol/195ae89a771c8515cd4d to your computer and use it in GitHub Desktop.
Save Lytol/195ae89a771c8515cd4d to your computer and use it in GitHub Desktop.
# Replace the Gemfile wholesale, it's just easier
#
remove_file "Gemfile"
create_file "Gemfile", <<-EOF
source 'https://rubygems.org'
ruby '2.1.5'
gem 'rails', '4.2.0'
gem 'pg'
gem 'sass-rails'
gem 'slim-rails'
gem 'jquery-rails'
gem 'unicorn'
group :development, :test do
gem 'spring'
gem 'foreman'
gem 'minitest-spec-rails'
gem 'factory_girl'
gem 'rr'
gem 'byebug'
end
EOF
# Use binstubs for gems
#
after_bundle do
run "bundle binstubs unicorn"
end
# Database.yml for Postgres, test and development only
#
remove_file "config/database.yml"
create_file "config/database.yml", <<-EOF
development:
adapter: postgresql
encoding: unicode
database: #{@app_name.underscore}_development
test:
adapter: postgresql
encoding: unicode
database: #{@app_name.underscore}_test
EOF
create_file "Procfile", <<-EOF
unicorn: ./bin/unicorn -p $PORT
postgres: postgres -D /usr/local/var/postgres
EOF
# Better gitignore
#
append_to_file ".gitignore", <<-EOF
# Ignore .ruby-version, should be specified in Gemfile
/.ruby-version
# Foreman should be developer-specific
/Procfile
EOF
# Markdown README, of course!
#
remove_file "README.rdoc"
create_file "README.md", <<-EOF
#{@app_name}
#{'=' * @app_name.length}
This is the README for #{@app_name}. You probably want to edit this!
EOF
# Replace ERB application layout with slim template
#
remove_file "app/views/layouts/application.html.erb"
create_file "app/views/layouts/application.html.slim", <<-EOF
doctype html
html
head
title #{@app_name}
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
= csrf_meta_tags
body
== yield
EOF
# Replace application.css with SCSS template
#
remove_file "app/assets/stylesheets/application.css"
create_file "app/assets/stylesheets/application.scss", <<-EOF
/* Do not use require, require_tree, or require_self; use Sass @import */
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment