Inspiration for the recent restructure from Matt Brictson's rails-template project
A custom template and supporting files to generate a new Rails 5 SaaS application.
This template is designed to work with:
The template requires that you have rails ~> 5.0 so before using it
make sure you have the new release with:
$ gem install rails
To make this template the default template used for all new rails
applications, create (or modify) a ~/.railsrc file and add:
-d postgresql
-m https://raw.githubusercontent.com/badmonkeys/saas_monkey/master/template.rb
The template can be easily used during the creation of a new Rails 5 application in several ways.
$ rails new app_name \
-d postgresql \
-m https://raw.githubusercontent.com/badmonkeys/saas_monkey/master/template.rb
The template responds to certain command line arguments passed to the
rails new generator. All of these commands start with m_ like
--m_git. Most of the arguments are boolean and appear or don't.
However, for arguments like --m_remote and --m_user a value must be
set like this: --m_user=Admin. The = is important.
| Argument | Type | Notes |
|---|---|---|
| m_git | Boolean | When present, sets up a new git repository and commits template output |
| m_remote | String | Set with --m_remote=BLAH, sets the upstream URL for an origin git remote |
| m_devise | Boolean | When present, sets up devise |
| m_user | String | Set with --m-user=Admin, sets the class name used by Devise |
| m_heroku | Boolean | When present, sets up a new heroku app and pushes the initial build (Heroku Toolbelt must be installed and logged in prior to running the template) |
| m_minimal | Boolean | When present, runs only the basic install and skips all other setup including git, devise, heroku |
| m_force | Boolean | When present, no interactive questions are asked during installation (Everything defaults to false, except git unless otherwise passed on the command line) |
README for the current set of gems in this template and their usage Coming Soon
The template will ask during the application process if you'd like to
setup Devise for authentication. The default response to this
question is no. You can enter any response matching /^y(es)?/i to
install and configure Devise. The devise class you want to use (Usually
User) is also configurable through a question and defaults to User
The template now asks after installation if you'd like to create a new
heroku app for this project. If you answer "yes"-y (i.e. y, Y, or
yes) it will create a new app using the heroku toolbelt and configure
the free-tier of the NewRelic RPM addon. The name of your new heroku app
will be the dasherize version of the name provided to the rails new
command. It also uses initializes Heroku binstubs
so that working with the heroku app has never been easier. Simply use
production when you want to use the heroku toolbelt like so:
$ production run console
$ production logs
$ production addons:create ...
Fork It! This is just a quick starting point built from my workflow and default tools. Feel free to fork it, clone it, flame it, whatever. Just make sure to make it your own!