user7264887
user7264887

Reputation: 31

How to control which version of Ruby gets used when running bundle

In ~/src/project/ containing all the files, I'm attempting to run bundle and bundle install, but it tells me I need a gem called "buff-extensions" and that gem installer requires Ruby version >= 2.2.0 to work properly.

When I ran ruby --version, it said Ruby 2.2.4p230 is being used when run from that directory.

I know there are several versions of Ruby on the machine in several places, and I'm struggling to follow the paths and figure out which technology is using which piece.

Upvotes: 0

Views: 55

Answers (2)

user7264887
user7264887

Reputation: 31

I finally figured out the exact incantation in order to get the intended result, and I now realize the situation is unreasonable to expect any stranger to attempt to answer.

It involved chef, and I was supposed to run chef exec bundle.

Upvotes: 0

the Tin Man
the Tin Man

Reputation: 160551

The Bundler docs spell this out:

You can specify the required version of Ruby in the Gemfile with ruby. If the Gemfile is loaded on a different Ruby version, Bundler will raise an exception with an explanation.

ruby '1.9.3'

What this means is that this app has a dependency to a Ruby VM that is ABI compatible with 1.9.3. If the version check does not match, Bundler will raise an exception. This will ensure the running code matches. You can be more specific with the :engine and :engine_version options.

ruby '1.9.3', :engine => 'jruby', :engine_version => '1.6.7'

Upvotes: 1

Related Questions