Suspenders
This is Philosophie's fork of Suspenders, a Rails application template originally created by thoughtbot. This repo has strayed significantly from thoughtbot's and is not intended to go back upstream.
Installation
First install the gem:
gem install philosophies-suspenders
Or update if you already have the gem installed:
gem update philosophies-suspenders
Then run:
philosophies-suspenders projectname
This will create a Rails app in projectname
using the latest version of Rails.
Gemfile
To see the latest and greatest gems, look at Suspenders' Gemfile, which will be appended to the default generated projectname/Gemfile. After the first bundle install, Suspenders will apply pessimistic version-locking on the Gemfile to only allow patch-level updates.
It includes application gems like:
-
Airbrake for exception notification,
set your API key in the environment with
AIRBRAKE_API_KEY
- Autoprefixer Rails for CSS vendor prefixes
- Sidekiq for background processing
-
Flutie for
page_title
andbody_class
view helpers -
Rails Assets for managing frontend dependencies,
including by default:
- jquery
- jquery-ujs
- New Relic RPM for monitoring performance
- Postgres for access to the Postgres database
- Rack Canonical Host to ensure all requests are served from the same domain
- Rack Timeout to abort requests that are taking too long
- Simple Form for form markup and style
- Title for storing titles in translations
- Puma to serve HTTP requests
- rails_12factor for easier Heroku deploys
And development gems like:
- Dotenv for loading environment variables
- Pry Rails for interactively exploring objects
- Pry ByeBug for interactively debugging behavior
- Bundler Audit for scanning the Gemfile for insecure dependencies based on published CVEs
- Spring for fast Rails actions via pre-loading
- Better Errors for better debugging via in-browser IRB consoles.
- RuboCop with Philosophie's default configuration to enforce Ruby Community Styleguide.
And testing gems like:
- Capybara and Capybara Webkit for integration testing
- Factory Girl for test data
- RSpec for unit testing
- RSpec Mocks for stubbing and spying
- Shoulda Matchers for common RSpec matchers
- Timecop for testing time
Other goodies
Suspenders also comes with:
- Rails' flashes set up and in application layout
- A few nice time formats set up for localization
-
Rack::Deflater
to compress responses with Gzip - A low database connection pool limit
- Safe binstubs
- t() and l() in specs without prefixing with I18n
- An automatically-created
SECRET_KEY_BASE
environment variable in all environments - The analytics adapter Segment (and therefore config for Google Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
- Webpacker (optional)
Webpack(er)
Optionally use Webpacker instead of (or in addition to) asset pipeline:
philosophies-suspenders my_new_app --webpack
CSS Frameworks
You can optionally install a CSS Framework options: bourbon_n_friends, bootstrap, foundation
philosophies-suspenders my_new_app --css-framework=CSS_FRAMEWORK
Heroku
By default, suspenders will:
- Creates a staging and production Heroku app
- Sets them as
staging
andproduction
Git remotes - Configures staging with
RACK_ENV
andRAILS_ENV
environment variables set tostaging
- Adds the Rails 12factor gem
- Adds free Sendgrid add-on and configure SMTP settings to use it
- Adds free Airbrake add-on
- Adds free Papertrail add-on
Please ensure your Heroku account has a verified credit card in order for the above addons to be installed.
You can optionally specify alternate Heroku flags:
philosophies-suspenders app \
--heroku-flags "--region eu --addons newrelic,pgbackups,ssl"
See all possible Heroku flags:
heroku help create
You can bypass all Heroku functionality with the --skip-heroku
option:
philosophies-suspenders app --skip-heroku true
Git
By default, suspenders will:
- Initialize a new git repository
- Create
staging
andproduction
branches for deployment - Make an initial commit
By default, pre-commit hooks are setup to run bin/rails
. To override this while committing pass the --no-verify
option to your commit.
You can optionally provide a remote URL via the --origin
option and suspenders
will push all branches to that remote.
philosophies-suspenders app --origin git@github.com:philosopie/app.git
You can bypass all git functionality with the --skip-git
option:
philosophies-suspenders app --skip-git true
GitHub
You can optionally create a GitHub repository for the suspended Rails app. It requires that you have Hub on your system:
curl http://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub
philosophies-suspenders app --github organization/project
This has the same effect as running:
hub create organization/project
Spring
Suspenders uses spring by default.
It makes Rails applications load faster, but it might introduce confusing issues
around stale code not being refreshed.
If you think your application is running old code, run spring stop
.
And if you'd rather not use spring, add DISABLE_SPRING=1
to your login file.
Dependencies
Suspenders requires the latest version of Ruby.
Some gems included in Suspenders have native extensions. You should have GCC installed on your machine before generating an app with Suspenders.
Use OS X GCC Installer for Snow Leopard (OS X 10.6).
Use Command Line Tools for XCode for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
We use Capybara Webkit for full-stack JavaScript integration testing. It requires QT. Instructions for installing QT are here.
PostgreSQL needs to be installed and running for the db:create
rake task.
Contributing / Feature requests
Philosophie's Suspenders is meant to support the core functionality of a new rails project. Many nice to have features are therefore not appropriate. If you have an idea for a new feature, here are the steps for having it added:
- please bring your idea up in the #nerds channel first to gauge it's popularity
- if you are able to, create a PR for the new functionality
- if you need help creating a PR find someone to pair with
Deploy new version to rubygems
-
sign up to rubygems.org
-
get an existing owner to add you to publish permissions using
gem owner philosophies-suspenders -a <email address>
- clone the repo locally and verify install
git clone git@github.com:philosophie/suspenders.git
cd suspenders
bundle
- make changes
- PR and commit to master
- bump the version straight to master
#lib/suspenders/version.rb
VERSION = "x.x.x"
- signin as rubygems user
gem signin
- release to rubygems
rake release
Update to newest ruby and rails versions
- update ruby version in
lib/suspenders/version.rb
- update ruby version in
.ruby-version
License
Suspenders is Copyright © 2008-2015 thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.