Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

specify a range in bundler ruby version

Is there a way to specify a range for ruby version?

ruby '~> 2.1.0'
Your Ruby version is 2.1.1, but your Gemfile specified ~> 2.1.0

ruby '>= 2.1.0'
Your Ruby version is 2.1.1, but your Gemfile specified >= 2.1.0

Obviously, ranges works for gems, but maybe it's not possible for ruby version. Or did I get my syntax wrong?

like image 595
tyrantkhan Avatar asked Apr 16 '14 17:04

tyrantkhan


2 Answers

You can't set a range for the ruby version, see here

Syntax is like so:

ruby 'RUBY_VERSION', :engine => 'ENGINE', :engine_version => 'ENGINE_VERSION', :patchlevel => 'RUBY_PATCHLEVEL'
like image 129
Mike H-R Avatar answered Sep 27 '22 16:09

Mike H-R


It is not possible in Bundler 1.x because it cannot be done maintaining backward compatibility with the format of Gemfile.lock.

As discussed there, this is arguably a bad idea unless the lockfile contains the ruby version. Adding the ruby version to the lockfile means Bundler 2 at the earliest.

(from an issue that has been filed requesting the addition of a range feature for Ruby versions)

like image 37
gioele Avatar answered Sep 27 '22 16:09

gioele