在Gemfile中设置红宝石版本 [英] Set ruby version in Gemfile

查看:56
本文介绍了在Gemfile中设置红宝石版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 Gemfile 中设置红宝石版本,如下所示:

I can set ruby version in Gemfile as follows:

ruby '2.0.0'

但是如果我想将特定版本设为<$ c $,该怎么办? c> 2.0.0-p353 ?

But what if I want to have a particular version as 2.0.0-p353?

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

When I add it to Gemfile, I get:

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

是否甚至可以设置特定版本?

Is it even possible to set a particular version?

推荐答案

在Bundler的1.3版或更早版本中,无法指定补丁程序级别

In Version 1.3 and earlier of Bundler you couldn’t specify the patchlevel:


ruby​​ 指令显式地排除了指定补丁程序级别的能力。 Ruby修补程序通常包含重要的错误和安全修复程序,并且兼容性极强。

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中已更改,文档现在说

This changed in version 1.5, the docs now say:


ruby​​ 指令,:patchlevel 是可选的,因为修补程序级别的发行版通常是兼容的,并且包含重要的安全修复程序。 patchlevel选项检查 RUBY_PATCHLEVEL 常量,如果未指定常量,则捆绑程序将忽略它。

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.

因此您可以这样指定补丁级别:

So you can specify the patchlevel like this:

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

这篇关于在Gemfile中设置红宝石版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆