Template for new Rails projects.
To get going clone this repository and perform the following steps:
- Clone this repository
- You can now run
bin/configure
, which will help you in configuring the template. Alternatively perform all of the following steps manually. - Change application name in
config/application.rb
. - Update
database.yml
to reflect the new application name. - Update
TODO
items inconfig/environments/production.rb
. - If you plan on using Figaro, copy
config/application.yml.example
toconfig/application.yml
. - ESLint is preconfigured for modern JS with React support (AirBnB styleguide). If you want to use
it install packages with
npm install
, otherwise remove.eslintrc
andpackage.json
. - If you don't plan on tracking the template, you can remove the
.git
directory. Otherwise you can rename the remote:$ git remote rename origin rails_new
- Add your new remote as appropriate.
Note that ES6 will not work by default for files in app/assets/javascript
because Uglifier will fail to process them.
If you want to use ES6 there, you can modify config/production.rb
:
- config.assets.js_compressor = :uglifier
+ config.assets.js_compressor = Uglifier.new(harmony: true)
Also note that for everything to work properly on Heroku, you need to set up your buildpacks like this:
heroku buildpacks:clear
heroku buildpacks:set heroku/nodejs
heroku buildpacks:add heroku/ruby
We did not enable this by default yet, since this feature still seems to be in flux and Uglifier may get replaced by alternative tools in the short to mid term.
- If you want to use AirBrake, make sure the following 2 environment variables are set:
AIRBRAKE_PROJECT_ID
AIRBRAKE_API_KEY
- New Relic is pre configured in
config/newrelic.yml
, but you need to comment in the environment variables for it work on Heroku (lines 10 and 17).
Variable | Comment |
---|---|
GOOGLE_ANALYTICS_ID | Will be added to the main application layout if set |
BLOCK_HTTP_TRACE | Disable HTTP TRACE method if set to true/t/1 |
DATABASE_URL | Used for production env, automatically set by Heroku |
HTTP_METHOD_BLACKLIST | If you want to block more than just TRACE, e.g. "TRACE,OPTIONS" |
PORT | Port Puma will listen on, defaults to 3000 |
RAILS_LOG_TO_STDOUT | Set by Heroku Ruby buildpack, set manually on other platforms if needed |
RAILS_MAX_THREADS | Number of Puma threads, defaults to 5 |
All of the following have been installed and pre-configured.
- Rails 5.1.0
- Ruby 2.4.1
- pg for
ActiveRecord
- The app is preconfigured for Google Analytics, just add
GOOGLE_ANALYTICS_ID
to the environment.
All of these are managed by yarn
.
- bullet
- bundler-audit
- capybara
- database_cleaner
- devise
- factory_girl_rails
- high_voltage
- memory_profiler
- poltergeist
- rack-mini-profiler
- shoulda-matchers
- spring-commands-rspec
- webmock
The following default Rails gems have been removed: