An update to my somewhat popular How I Start Rails Projects post. As before, I start with:
1 2 3 4 5 6
The only change is bumping Ruby to 2.4.1.
But this leads to a rant:
When I posted the original version, some troll commented something along the lines of:
“You lost me when you said rvm.”
Dude (of any, all, or no gender), you are an idiot. Not because you don’t like RVM, but because it doesn’t matter that you don’t like RVM and you are wasting your time hating on it.
I’m not going to defend RVM because:
You can google and find plenty of people explaining why RVM is wrong and plenty of other people explaining why people who think RVM is wrong are wrong.
I don’t care. I don’t care for the simple reason RVM works for me. I use RVM because that it was the only option at the time. I have nothing against rbenv, I’ve used it on servers. However, I’m not going to spend a day ripping out something that’s working fine for me to replace it with something that’s technically, but not actually functionally, better for me. Use whatever you like, but don’t be a jerk by telling people their tools are somehow inferior to yours.
Back to the task at hand. I edit the Gemfile, first adding:
to the top allowing Heroku and RVM to automatically pickup the Ruby version (rbenv doesn’t do this out of the box, but there is a plugin).
Then I move:
in to the test and development group:
1 2 3 4 5
sqlite3 is fine, preferable even, for development, but in production
you need something more rubust. I create a new production group:
1 2 3 4
I add two development gems I like:
1 2 3 4
dotenv gem allows you to manage project specific environmental
variables by storing them in a
.env file, which we need to ignore:
Awesome Print is a “ruby object pretty printer”. It add an
which nicely formats and syntax highlights ruby objects.
You can read more about
dotenv and Awesome Print in the
Finally, if it’s a user facing project, as opposed to an API, and it doesn’t have it’s own styles, I bring in Bootstrap:
and replace the contents of
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
And then it’s just:
Starting with Rails 5.1.1,
rails new does a
git init unless you
--skip-git option, so that step is no longer necessary.
As always, this is what works for me, but I think it’s a good starting point to think about what works for you.