Skeleton for new Rails based projects.
Ruby CSS HTML Shell CoffeeScript
Latest commit 1f7d4bd Aug 12, 2016 @ilyasgaraev ilyasgaraev committed with timurvafin upgrade rails to 4.2.7.1 (#467)
Failed to load latest commit information.
app Update foundation to 6 version and change csscomb, scss-lint configs (#… Aug 9, 2016
bin Setup script updated to clean old logs and tmp files (#457) Jul 11, 2016
config Update foundation to 6 version and change csscomb, scss-lint configs (#… Aug 9, 2016
db User factory generate confirmed user by default Jan 7, 2016
doc Update README template Jan 5, 2016
lib fix confirm attribute usage in slim templates Jan 25, 2016
public Move assets to app directory May 26, 2011
spec Update foundation to 6 version and change csscomb, scss-lint configs (#… Aug 9, 2016
.codeclimate.yml Configure linters to work with CodeClimate Engine Based platform (#451) Jun 20, 2016
.env.example Fix typo in .env sample: locahost -> localhost Dec 9, 2015
.erdconfig Add Rails ERD for generating entity-relationship diagrams Aug 17, 2015
.gitattributes Configure .gitattributes to avoid merge conflicts Apr 6, 2016
.gitignore Switch from Thin to Puma Aug 27, 2015
.postcss-sorting.json Update foundation to 6 version and change csscomb, scss-lint configs (#… Aug 9, 2016
.pryrc.example add gem pry-remote Dec 25, 2013
.rspec remove fuubar Mar 21, 2016
.rubocop.yml Configure linters to work with CodeClimate Engine Based platform (#451) Jun 20, 2016
.ruby-version update ruby to 2.3.1 (#460) Jul 25, 2016
.scss-lint.yml Update foundation to 6 version and change csscomb, scss-lint configs (#… Aug 9, 2016
.slim-lint.yml Configure linters to work with CodeClimate Engine Based platform (#451) Jun 20, 2016
Brewfile Add graphviz to Brewfile Aug 19, 2015
CHANGELOG.md upgrade rails to 4.2.7.1 (#467) Aug 12, 2016
CONTRIBUTING.md more detailed release instructions May 18, 2015
Gemfile upgrade rails to 4.2.7.1 (#467) Aug 12, 2016
Gemfile.lock upgrade rails to 4.2.7.1 (#467) Aug 12, 2016
Procfile Switch from Thin to Puma Aug 27, 2015
README.md update ruby to 2.3.1 (#460) Jul 25, 2016
Rakefile force double quotes in ruby May 20, 2015
app.json Add required config vars to app.json Dec 27, 2015
coffeelint.json Configure linters to work with CodeClimate Engine Based platform (#451) Jun 20, 2016
config.ru Update rubocop, rubocop-rspec, active_link_to, faker, slim_lint (#437) Apr 15, 2016

README.md

Rails Base

Build Status Test Coverage Code Climate

Rails Base is the base Rails application template used at Flatstack. It's based on Rails 4 and Ruby 2.3.1.

Application Gems

Development Gems

  • Puma as Rails web server
  • Foreman for managing development stack with Procfile
  • Letter Opener for opening mail in the browser instead of sending it
  • Bullet for detecting N+1 queries and unused eager loading
  • Rubocop and Rubocop-Rspec for reporting violations of the Ruby style guide
  • Brakeman for checking application for common security vulnerabilities
  • Pry Rails for interactively exploring objects
  • Bundler Audit for scanning the Gemfile for insecure dependencies based on published CVEs
  • Spring for fast Rails actions via pre-loading
  • Web Console for better debugging via in-browser IRB consoles
  • SCSS-Lint for reporting violations of SCSS coding conventions
  • Coffeelint to keep Coffeescript code clean and consistent
  • Slim-Lint for reporting violations of Ruby style guide in .slim templates
  • Rails ERD for generating a diagram based on application's AR models

Testing Gems

Initializers

  • mailer.rb - setup default hosts for mailer from configuration
  • requires.rb - automatically requires everything in lib/ & lib/extensions

Scripts

  • bin/setup - setup required gems and migrate db if needed
  • bin/quality - runs rubocop, brakeman, rails_best_practices and bundle-audit for the app
  • bin/ci - should be used in the CI or locally
  • bin/server - to run server locally

Getting Started

Prepare dependencies

Some gems have native extensions. You should have GCC installed on your development machine.

  • qt - to run specs with Capybara Webkit
  • phantomjs198 - to run Javascript unit tests
  • graphviz - to generate Entity-Relationship Diagram

Setup required dependencies from Brewfile:

brew tap Homebrew/bundle
brew bundle

Bootstrap application

  1. Clone application as new project with original repository named "rails-base".

    git clone git://github.com/fs/rails-base.git --origin rails-base [MY-NEW-PROJECT]
  2. Create your new repo on GitHub and push master into it. Make sure master branch is tracking origin repo.

    git remote add origin git@github.com:[MY-GITHUB-ACCOUNT]/[MY-NEW-PROJECT].git
    git push -u origin master
  3. Run setup script

    bin/setup
  4. Run test and quality suits to make sure all dependencies are satisfied and applications works correctly before making changes.

    bin/ci
  5. Run app

    bin/server
  6. Update README

    Do not forget to update application README.md file with detailed information based on the existing template.

    mv doc/README_TEMPLATE.md README.md
    # update README.md
    git commit -am "Update README.md"

Deployment

Heroku

Out of the box Rails Base ready to be deployed to Heroku.com.

  • Heroku Postgres add-on will be used for database.
  • SendGrid add-on required to be able to send emails.
  • NewRelic add-on could be used to monitor application performance.
  • Rollbar add-on could be used to application errors.
heroku create --addons=heroku-postgresql,sendgrid,newrelic,rollbar --remote staging rails-base-example
heroku config:add HOST="rails-base-example.herokuapp.com" MAILER_SENDER_ADDRESS="noreply@rails-base-example.herokuapp.com" NEW_RELIC_APP_NAME="Rails Base"
git push staging master
heroku run rake db:schema:load
heroku open

Credits

Rails Base is maintained by Timur Vafin. It was written by Flatstack with the help of our contributors.