ruby-on-rails - 在 Gemfile 中设置 ruby​​ 版本

标签 ruby-on-rails ruby bundler gemfile

我可以在 Gemfile 中设置 ruby​​ 版本如下:

ruby '2.0.0'

但是如果我想要一个特定的版本作为 2.0.0-p353 怎么办?

当我将它添加到 Gemfile 时,我得到:

Your Ruby version is 2.0.0, but your `Gemfile` specified 2.0.0-p353

甚至可以设置特定版本吗?

最佳答案

在 Bundler 1.3 及更早版本中,您 couldn’t specify the patchlevel :

The ruby directive explicitly leaves out the ability to specify a patch level. Ruby patches often include important bug and security fixes and are extremely compatible.

这在 1.5 版中发生了变化,the docs now say :

In the ruby directive, :patchlevel is optional, as patchlevel releases are usually compatible and include important security fixes. The patchlevel option checks the RUBY_PATCHLEVEL constant, and if not specified then bundler will simply ignore it.

所以你可以像这样指定补丁级别:

ruby '2.0.0', :patchlevel => '353'

关于ruby-on-rails - 在 Gemfile 中设置 ruby​​ 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22427515/

相关文章:

ruby-on-rails - Paperclip 会自动清理文件名吗?

ruby-on-rails - 如何在rescue_from中呈现500页

ruby-on-rails - 使用 Cucumber 验证错误

ruby-on-rails - 授权逻辑 : verifying login/password

ruby-on-rails - 如何使用私有(private)方法保持 DRY?

Ruby 流式传输 tar/gz

ruby-on-rails - 我的 Rails 文件的 Nginx 权限被拒绝错误?

plugins - Aurelia - 如何做可以在运行时加载的复合应用程序

ruby-on-rails - 用于使用 bundler 进行自动测试的特定于平台的 gem

ruby-on-rails - 没有要加载的文件 -- bundle 程序 (LoadError)