/rails-jumpstart

Easily jumpstart a new Rails application with a bunch of great features by default

Primary LanguageRubyMIT LicenseMIT

Rails Jumpstart Template

Start your Rails app with some great defaults and gems out of the box.

Getting Started

Jumpstart is a Rails template, so you pass it in as an option when creating a new app.

Requirements

You'll need the following installed to run the template successfully:

Recommended

These are optional and nice to have, but the template will work without them:

  • foreman (gem install foreman)
    • DO NOT ADD TO GEMFILE
  • terminal-notifier (gem install terminal-notifier)
    • DO NOT ADD TO GEMFILE

Installation (optional)

To make this the default Rails application template on your system, create a ~/.railsrc file with these contents:

-d postgresql --skip-coffee --skip-turbolinks -m https://raw.githubusercontent.com/web-ascender/rails-jumpstart/master/template.rb

Usage

To generate a Rails application using this template, pass the options below to rails new, like this:

$ rails new myapp -d postgresql --skip-coffee --skip-turbolinks -m https://raw.githubusercontent.com/web-ascender/rails-jumpstart/master/template.rb

Remember that options must go after the name of the application ("myapp" in this case). The only database supported by this template is PostgreSQL.

If you’ve installed this template as your default (using ~/.railsrc as described above), then all you have to do is run:

$ rails new myapp

What is included?

Below is a summary of what this template does. You can check all the features by following the code in template.rb

  • webpack (webpacker) to serve all JS and CSS
    • renames the default app/javascript folder to app/webpacker
    • configures default pack in app/webpacker/packs/application.js
    • sprockets (asset pipeline) is left intact to serve images only
  • haml / hamlit for view templates
  • bootstrap (v4) UI framework
    • including jQuery and Popper.js dependencies
  • $, jQuery, and jquery provided as window globals by default (for 3rd party compatibility)
    • Provide plugin and expose-loader
  • devise for authentication
    • generated devise bootstrap-themed views for user login, signup, forgot password, etc
    • User model with additional first_name and last_name attributes
  • Font Awesome 5 SVG icons
  • sidekiq for background jobs
    • Web UI mounted at /admin/sidekiq by default
  • whenever for cron scheduling
  • jb simple and fast JSON views (jbuilder replacement)
  • httprb a fast Ruby HTTP client with a chainable API, streaming support, and more

Helpers

JavaScript Libraries

  • jQuery, jQuery UI
  • jQuery UI DatePicker configured out-of-the-box
    • also a custom date_input simple_form input helper
  • select2 dropdown library (with Bootstrap v4 theme)
  • axios Promise based HTTP client for AJAX requests

Content / Layout

  • Nice starter layout based on Bootstrap 4
  • Top Shared Navbar
  • User menu in upper-right (login, my account, my profile, logout)
  • Bottom sticky footer
  • Nice rails flash messages shown at the bottom of the screen (and auto-hide after a few seconds)

Development

OPTIONAL (user prompts during execution)

How does it work?

This project works by hooking into the standard Rails application templates system, with some caveats. The entry point is the template.rb file in the root of this repository.

Rails generators are very lightly documented; what you’ll find is that most of the heavy lifting is done by Thor. The most common methods used by this template are Thor’s directory, copy_file, template, run, insert_into_file, and gsub_file.

Inspiration

Authors