5

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
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
  • I don't think heroku will pay any attention to gemset specifications -- your gemset isn't on heroku, so a name of a gemset doesn't mean anything. You don't need it to, if you're using bundler (Which you are if you're using Rails). Your Gemfile.lock does everything a gemset needs to do for heroku deploy, specifying exactly what version of what gems need to be installed. – jrochkind Sep 27 '15 at 12:45
  • Possible duplicate of https://stackoverflow.com/questions/16087120/should-i-check-in-ruby-gemset-and-or-ruby-version?noredirect=1&lq=1 – Abhi Jul 14 '21 at 17:39

1 Answers1

1

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.

Brad Johnson
  • 153
  • 9
  • OK. So I guess there's really two files that specify the ruby version: .ruby-version for the local/team env, and the Gemfile for the production env (Heroku). I'm taking your advice to keep them matched. Thanks! – Gino Mempin Sep 28 '15 at 12:31