— Feb 17, 2015
Recently, I went on a personal endeavor to determine the best way to create a new Rails app pre-configured to my liking. I was sick and tired of wasting time replacing and configuring test runners, adding development gems I prefer, and reinventing the README. Why did it take so long for me to do this?
For some reason it took me a long time to discover this handy script. Following
the convention of other “run configuration” files,
you can add options here that you wish to be included every time you rails
new
.
My config…
bundle install
(handled later).keep
filesHere it is:
The command line options can only get me so far. To complete my desired pre-configuration, it’s time to automate the things with Rails application templates.
App templates allow you to define a procedure used to config an app. It has
built in hooks for bundler
and git
. My config…
Here is the full template:
I keep all my configuration files in a Gist so they can be downloaded as needed.
To make sure the template is always used for new apps, I added an alias to my environment.
Creating a new app is as simple as railsup next_big_thing
.
This turned out to be a great learning experience. The task wasn’t as daunting as I had imagined it to be. I am always working to improve these things, so keep an eye on my dotfiles if you’re interested.