hebillas icon indicating copy to clipboard operation
hebillas copied to clipboard

New version of our Rails template, working on top of Suspenders

HEBILLAS: The suspenders companion

thoughtbot's Suspenders makes a fantastic base for any new Rails project, but it's also very opinionated.

Using it, we found ourselves changing elements to suits more our stack.

Thankfully, under the hood, using suspenders is the same as using rails new, so it allows us to apply a rails template on top of it, and tweak it to our need.

We found this approach more suitable than maintaining a fork, or asking the lovely guys at thoughbot to comply with our need.

If you're thinking about extending Hebillas, just make sure not to make your change as mandatory, and always ask users if they want the change to be applied.

Requirements

This template is based to work on top of thoughtbot's Suspenders (v1.37).

How to use

Assuming that you have Suspenders installed, you'll need to checkout the repo:

git clone [email protected]:cookieshq/hebillas.git

And then run suspenders, passing the template:

suspenders app_name -m hebillas/template.rb

It will ask you if you want to install certain gems and install them for you, along with other goodies. In the end, it will ask you if you want your database to be migrated.

What to do after

  • Fix the first failing test that is created if you choose to create your database. It's basically about adding a root on your routes.rb.

List of gems installed

This list does not include dependencies of the gems listed!

  • devise - optional
  • active_admin - optional. Available if you choose to install Devise. Because active_admin does not yet support Devise 4, if you choose to install it, branch 3 of Devise will be installed. If not, the latest Devise version will be installed.
  • haml-rails - we'll convert all .erb files to .haml while generating the application
  • bootstrap-sass - we'll remove bourbon, neat, refills and associated files. Additionally we'll set up all the imports for in scss (_bootstrap-custom.scss) and js (application.js) so you can easily comment out any component you won't be using.
  • font-awesome-rails - we'll install and set it up properly for instant use.
  • paperclip - Our favourite image uploading and attachement. Optional
  • roadie 2.4.3

On the development group:

On the test and development groups:

On the test group:

Also it:

  • Generates a .gitignore file with some common files and folders that we add.
  • Puts in a default skeleton for JS code organization, as per told in this post
  • Puts in an email template and style as per told in this post
  • Creates a stylesheet skeleton that is SMACSS compliant.
  • Edits application.css(.scss) and application.js to use bootstrap.
  • Edits application.rb to add rspec and action mailer config.
  • Edits development.rb to add action mailer config.
  • Creates a test and runs it (it will fail) to get your TDD/BDD on ;)
  • If you choose to, it will create a tmuxinator configuration file on the root of the project, add it to the gitignore and link it on the ~/tmuxinator/ folder. Keep in mind that it wont install the tmuxinator gem, nor tmux, for you.

Future improvements

  • Give user choice to remove EC6 and use CoffeeScript.
  • Give user choice to use Bugsnag or Airbrake (or none).
  • Give user choice to user letter_opener instead of mailcatcher (or none).
  • Check Heroku option on suspenders and get in additional options if needed/available.
  • Create a version that can be run from the raw link on github (i.e.: embedding all files on the template).
  • Separate long strings into auxiliary methods, for the sake of code readability.