Skip to content

Instantly share code, notes, and snippets.

@tiste
Last active June 6, 2016 08:47
Show Gist options
  • Save tiste/9132484 to your computer and use it in GitHub Desktop.
Save tiste/9132484 to your computer and use it in GitHub Desktop.
Bootstrap a Rails app

Bootstrap Rails app

Generate app

rails new appname -d mysql
cd appname
git init
touch .ruby-gemset && touch .ruby-version
echo 'appname' >> .ruby-gemset
echo '2.2' >> .ruby-version

Gemfile and database

Add differents gems then bundle and rake db:create

Move config/database.yml to config/database.yml.sample Move config/secrets.yml to config/secrets.yml.sample

README.md

Rename README.rdoc to README.md then add line about database.yml such as:

# AppName
## Bootstrap app

`cd config && cp database.yml{.sample,} && cp secrets.yml{.sample,} && cd -`

## Regenerate database

`rake db:drop; rake db:create; rake db:migrate`

Clean files

  • .gitignore: ignore /test/*, /config/database.yml and /config/secrets.yml
  • app/assets/stylesheets/application.css
  • app/assets/javascripts/application.js
  • app/views/layouts/application.html.erb: implement yield(:head) and yield(:scripts)
  • app/config/routes.rb

Gitflow

Commit these changes on master and have fun 😍

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