在bundler ruby​​版本中指定一个范围

时间:2021-11-22 07:25:09

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

有没有办法为ruby版本指定范围?

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?

显然,范围适用于宝石,但也许它不可能用于ruby版本。或者我的语法错了?

2 个解决方案

#1


6  

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

您无法为ruby版本设置范围,请参见此处

Syntax is like so:

语法是这样的:

ruby 'RUBY_VERSION', :engine => 'ENGINE', :engine_version => 'ENGINE_VERSION', :patchlevel => 'RUBY_PATCHLEVEL'

#2


1  

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

在Bundler 1.x中是不可能的,因为无法保持与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.

正如在那里讨论的那样,除非lockfile包含ruby版本,否则这可能是一个坏主意。将ruby版本添加到lockfile最早就意味着Bundler 2。

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

(来自已经提交的请求为Ruby版本添加范围功能的问题)

#1


6  

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

您无法为ruby版本设置范围,请参见此处

Syntax is like so:

语法是这样的:

ruby 'RUBY_VERSION', :engine => 'ENGINE', :engine_version => 'ENGINE_VERSION', :patchlevel => 'RUBY_PATCHLEVEL'

#2


1  

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

在Bundler 1.x中是不可能的,因为无法保持与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.

正如在那里讨论的那样,除非lockfile包含ruby版本,否则这可能是一个坏主意。将ruby版本添加到lockfile最早就意味着Bundler 2。

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

(来自已经提交的请求为Ruby版本添加范围功能的问题)