Skip to content

Mossio/hashira-rails

Repository files navigation

hashira-rails Build Status

Hashira (柱) generates apps which are preconfigured with gems and settings that we find useful at Mossio. This project generates Rails apps in particular.

Usage

Dependencies

In order to use this gem, you must have the latest version of Ruby (2.3.3 as of this writing).

Some gems included in your app will have native extensions. You should have a compiler installed and set up on your machine before generating an app. These days, Xcode supplies one with their Command Line Tools. You can easily install them by running xcode-select --install.

Generating a new app

First you'll need to install the gem:

gem install hashira-rails

Then, from any directory, run:

hashira-rails projectname

Your generated Rails app will be available under a projectname directory.

When we make new apps we will typically follow through by setting up some associated services:

Heroku

By default, the generator will assume that you plan on deploying your app to Heroku. During the process, then, it will:

  • Create a staging and production Heroku app
  • Create staging and production Git remotes pointing to those apps
  • Configure staging with RACK_ENV environment variable set to production
  • Add the rails_stdout_logging gem to configure the app to log to standard out, which is how Heroku's logging works.
  • Create a pipeline on Heroku for review apps

The generator makes use of the heroku executable to create and configure apps. If there are any command-line options for heroku you wish to provide you can easily do that. For instance:

hashira-rails app --heroku-flags "--region eu --addons sendgrid,ssl"

You can see all possible options with:

heroku help create

If you don't care about Heroku and want to disable the behavior described above, you can say:

hashira-rails app --heroku false

Git

The generator will automatically initialize a new Git repository after generating the app. You can disable this by saying:

hashira-rails app --skip-git true

GitHub

You can tell the generator to create a GitHub repository along with the app if you wish. The generator will use Hub internally to do this, so you must have that installed first. Then you can say:

hashira-rails app --github organization/project

Spring

As in a standard Rails app, Hashira will generate your Rails app configured with Spring by default. It makes Rails applications load faster, but it might introduce confusing issues around stale code not being refreshed. If you run into an issue during development and you think your application is running old code, you can run spring stop to reset Spring. And if you'd rather not use Spring, run hashira-rails with DISABLE_SPRING=1.

Included gems

Generated apps come bundled with a set of gems that we've found to be invaluable in our projects.

Gems for frontend developers

  • Autoprefixer for automatically augmenting CSS with vendor prefixes
  • Normalize for resetting browser styles
  • Bitters, a foundation for elemental styles and settings
  • Bourbon, a handy set of Sass mixins
  • Neat, an unobtrusive grid system for laying out pages
  • High Voltage, for making static pages such as HTML/CSS mockups

Gems for backend developers

Gems common to all environments

  • The PG gem (and related configuration) for connecting to PostgreSQL, a capable, extensible, and generally awesome database
  • Puma, a speedy, performant, and multi-threaded web server
  • Simple Form, a nice DSL for creating forms whose HTML can be customized in response to frontend developers
  • Sidekiq for running background jobs like a beast
  • Sentry for capturing exceptions that the app produces and logging them in a really nice interface
  • Flutie for setting page titles with ease
  • rack-canonical-host, for ensuring that the URL of the application that users see is what we set it to be
  • rack-timeout for aborting requests that are take too long
  • Recipient Interceptor for preventing emails from being accidentally sent to real people from within staging

Gems that are useful during the development process

Testing-related gems

Other goodies

Your generated Rails app also comes with these extras:

  • An expanded setup script that performs the following checks:
    • Ensures that the correct version of Ruby is installed
    • Ensures that Postgres and Redis are installed and running
    • Ensures that Rubocop and ESLint are installed so that code can be autolinted as it is written in editors like Vim
    • Ensures that Bower is installed and installs Bower dependencies
  • A bin/deploy script for deploying the app to Heroku
  • Basic date and time formats in config/locales/en.yml
  • Rack::Deflater to compress responses with Gzip
  • A low database connection pool limit
  • Safe binstubs
  • Usage of t() and l() in specs without a need to prefix it with I18n.
  • An automatically-created SECRET_KEY_BASE environment variable in all environments
  • Configuration for CircleCI
  • Configuration for Hound
  • HTML code for Segment (a service that bridges analytics services such as Google Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)

Issues

If you run into problems while using this gem, please create an issue.

Legal stuff

hashira-rails is copyright © 2016 Elliot Winkler and the Mossio team. It is adapted from Suspenders, a thoughtbot project. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

hashira-rails generates Rails apps preconfigured with gems that we find useful at Mossio.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published