Niels B.
Niels B.

Reputation: 6310

Specify ruby version for project

What is the recommended way of specifying which ruby version an application uses? Heroku recommends adding it to the Gemfile, e.g.

ruby "2.0.0"

rbenv however seems to look for a .ruby-versionfile.

I would like to make sure that developers will be using the same interpreter regardless of their preferred suite of ruby managers, IDE's, platforms, etc...

Upvotes: 1

Views: 122

Answers (2)

Agis
Agis

Reputation: 33626

You can never be absolutely sure that they are using the version you want. Even if you added an exception in the application boot code that checks for the version at runtime, they could easily bypass it.

Thus said, you should keep the .ruby-version as it's used by RVM, rbenv and chruby, which are very likely that the other developers in your team use.

Upvotes: 3

boulder_ruby
boulder_ruby

Reputation: 39695

I use rvm like so:

rvm use 1.9.3

or

rvm use jruby

before running the program

Upvotes: 0

Related Questions