简体   繁体   English

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

[英]specify a range in bundler ruby version

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. 显然,范围适用于宝石,但也许它不可能用于ruby版本。 Or did I get my syntax wrong? 或者我的语法错了?

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'

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. 正如在那里讨论的那样,除非lockfile包含ruby版本,否则这可能是一个坏主意。 Adding the ruby version to the lockfile means Bundler 2 at the earliest. 将ruby版本添加到lockfile最早意味着Bundler 2。

(from an issue that has been filed requesting the addition of a range feature for Ruby versions ) (来自已经提交的请求为Ruby版本添加范围功能的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM