Rails in a single command

Rails is always evolving. Sure, many people will argue that the framework (and subsequent community) is not iterating as quickly as Javascript but for many people, that's a good thing :smile:.

As for me, I started developing Rails apps in 2007 and I think it continues to do what it does best, focus on it's core product offering: metaprogramming. For example, here are a few commands that continue to make the Rails experience awesome.

Create an out-of-the-box app using a single line of code:

rails new [app_name] -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

Why does this single line of code kick ass? Simple, the prompt helps you build out your entire development and production environment using a single line of code.

First it asks whether you want to build a starter application.

Then it asks you which type of application. I picked rails-devise-roles so that I can offer user registration, authentication and roles.

If you're not familiar with Devise, I suggest reading this SitePoint tutorial.

I've tried Pundit too and it's also easy to work with.

Pick your development server.

Pick your production server. I usually just pick whatever Heroku uses.

Pick your database. Again, I just pick whatever Heroku uses.

I find erb to be painful to work with so I'll pick HAML.

I love that I get to pick a test framework. If you're not familiar with Rspec or Capybara, I suggest this Pluralsight tutorial.

Decide if you care about Continuous testing.

I usually pick Bootstrap for a front-end development.

I'm a big fan of SendGrid for mail. Gmail is good too.

A second question about Devise. I pick #2 or #3 (Invitable).

Yes, I want an Admin interface for the database.

Yes, I will eventually add my Google Analytics tracking code.

I will likely deploy on Heroku.

Keep on Turbolinks to speed up my app.

Yes, please at a robots.txt for SEO.

Yes, please publish it to my Github repo.

WOW! All of that from a single command line. Amazing!


JS on the up-and-up

ExpressJS has a similar command-line generator. So does Angular 2 and Yeoman so I'm optimistic that Atwood's Law will eventually become a reality.


Resources