Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I include .ruby-version and .ruby-gemset when deploying a rails app?

I just followed this RailsApps install/setup tutorial, which uses RVM and creates a .ruby-version and a .ruby-gemset to specify the Ruby version and a project-specific gemset.

I already read this post regarding on what to do to these files for version control.

My question is how about when deploying to hosting platforms, like Heroku? They point to your git repository which may or may not include these files. Is it still OK to check-in .ruby-version when deploying?

For example, the Heroku docs says the the Ruby version is specified via Gemfile or environment variable. So I'm a little confused if platforms like Heroku respect these RVM-generated files.

Notes:

  • Ruby v2.2.3
  • RVM v1.26.11
like image 206
Gino Mempin Avatar asked Nov 09 '22 04:11

Gino Mempin


1 Answers

Per the docs Heroku will look for your Ruby version in a few places: 1) Gemfile 2) An environment variable called CUSTOM_RUBY_VERSION

I prefer to specify the Ruby version in my Gemfile.

So, Heroku should ignore .ruby-version. The Ruby you specify in your Gemfile should probably match the version specified in .ruby-version

As a general rule I would check .ruby-version into source control.

like image 72
Brad Johnson Avatar answered Nov 15 '22 06:11

Brad Johnson