简体   繁体   English

在heroku推送上更改Ruby版本

[英]Ruby version change on heroku push

Ruby version is changed while pushing into the heroku. Ruby版本在推入heroku时发生了变化。

       Ruby version change detected. Clearing bundler cache.
   Old: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
   New: ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]

now heroku run 'ruby -v' returning ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux] . 现在heroku run 'ruby -v'返回ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]

But ruby -v still returning ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] . ruby -v仍然返回ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]

Here is my rvm list 这是我的rvm列表

rvm list

rvm rubies

=* ruby-1.9.2-p290 [ i686 ]

# => - current
# =* - current && default
#  * - default

I don't want to change the ruby version. 我不想改变ruby版本。 How it happen?. 怎么会发生? How can i solve this issue. 我该如何解决这个问题。 Please help. 请帮忙。

I got the same info so I think it was change in Heroku Ruby version (mind that only patchlevel changed) 我得到了相同的信息所以我认为这是Heroku Ruby版本的变化(介意只有补丁级别更改)

You probably can't revert this change on Heroku side, but you definately should upgrade your own Ruby version. 您可能无法在Heroku端恢复此更改,但您肯定应升级自己的Ruby版本。

Heroku has instructions about how to specify a ruby version. Heroku有关于如何指定ruby版本的说明。 The document is here: https://devcenter.heroku.com/articles/ruby-versions . 该文件位于: https//devcenter.heroku.com/articles/ruby-versions As @JohnBeynon said, Heroku is a PaaS so they manage many things for you including the patch version (see next paragraph). 正如@JohnBeynon所说,Heroku是一个PaaS,所以他们为你管理很多东西,包括补丁版本(见下一段)。 None of your RVM settings will change anything on Heroku as Heroku doesn't use RVM. 由于Heroku不使用RVM,因此没有任何RVM设置会在Heroku上更改任何内容。

To specify the version of ruby you want, add this to your Gemfile: 要指定所需的ruby版本,请将其添加到Gemfile:

ruby "1.9.2"

In your case, you can't specify the patch version so you can't fix this; 在您的情况下,您无法指定修补程序版本,因此您无法解决此问题; however, this patch version change is a good thing. 但是,这个补丁版本的改变是件好事。 It will still be compatible, it will just have more security updates and bug fixes. 它仍然是兼容的,它只会有更多的安全更新和错误修复。 You should also upgrade your local machine rather than trying to downgrade your servers. 您还应升级本地计算机,而不是尝试降级服务器。 There is more on this at: https://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku 还有更多内容: https//blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku

While you can specify the version of Ruby for you app, you can't specify a patch version, such as Ruby 1.9.2-p290. 虽然您可以为您的应用程序指定Ruby的版本,但您无法指定修补程序版本,例如Ruby 1.9.2-p290。 Ruby patches often include important bug and security fixes and are extremely compatible. Ruby补丁通常包含重要的错误和安全修复程序,并且非常兼容。 Heroku will provide the most secure patch level of whatever minor version number you request. Heroku将提供您所请求的任何次要版本号的最安全补丁级别。

Heroku will never change the major or minor version of Ruby your app is running against only the patch level. Heroku永远不会改变您的应用程序仅针对补丁级别运行的主要或次要版本的Ruby。

In your Gemfile you can specify major/minor with 在您的Gemfile中,您可以指定major / minor

ruby '1.9.2'

But you cannot specify the patch level as Heroku will manage that for you. 但是你无法指定补丁级别,因为Heroku将为你管理。 Also, when your app is on Heroku Rvm isn't used so that won't make a difference. 此外,当你的应用程序在Heroku Rvm上时,不使用,所以不会有所作为。 So as Heroku change patch levels of ruby (as indicated on their changelog) you will see this type of behaviour occurring. 因此,当Heroku更改ruby的补丁级别时(如其更改日志中所示),您将看到此类行为发生。

you do not have to change the ruby version locally, ruby patchlevels should not introduce incompatibilities, you should be fine developing on older patch and deploying on newer ... that said bad things can happen as always and ruby team might be forced to introduce an incompatibility in patchlevel because of security issues. 你不必在本地更改ruby版本,ruby补丁级别不应该引入不兼容性,你应该在较旧的补丁上进行良好的开发并在较新的部署... ...说坏事可能会一如既往地发生,而ruby团队可能会被迫引入由于安全问题,补丁级别不兼容。

so the best is to upgrade your local ruby version with: 所以最好用以下方法升级你的本地ruby版本:

rvm get stable
rvm upgrade 1.9.2

or to be more explicit: 或者更明确:

rvm upgrade 1.9.2-p290 1.9.2-p320

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

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