specify a range in bundler ruby version

别来无恙 提交于 2019-12-22 04:56:12

问题


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?


回答1:


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'



回答2:


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)



来源:https://stackoverflow.com/questions/23116456/specify-a-range-in-bundler-ruby-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!