简体   繁体   English

如何找到用于特定Ruby版本或Rails版本的Gem版本

[英]How to find which Gem Version to use for a certain Ruby Version or Rails Version

I use multiple rails versions which coincides with ruby versions. 我使用与Rails版本一致的多个rails版本。 For example: 例如:

server1: server1的:

  • Rails 2.3.11 Rails 2.3.11
  • Ruby 1.8.7p375 红宝石1.8.7p375

server2: 服务器2:

  • Rails 3.2.18 导轨3.2.18
  • Ruby 2.2.10p489 Ruby 2.2.10p489

For each of these scenarios, how can I determine which gem -v to use? 对于每种情况,我如何确定要使用哪个gem -v? Is there a list somewhere I can refer to? 我可以参考一下清单吗?

If I understand your question properly, you're asking how you can determine which ruby version you can use for a specific rails version. 如果我正确地理解了您的问题,那么您正在询问如何确定可用于特定Rails版本的红宝石版本。

The ActiveRecord gemspec ( https://github.com/rails/rails/blob/3-0-stable/activerecord/activerecord.gemspec ) specifies a ruby constraint: ActiveRecord gemspec( https://github.com/rails/rails/blob/3-0-stable/activerecord/activerecord.gemspec )指定了红宝石约束:

s.required_ruby_version = '>= 1.8.7'

You can also look at the .travis.yml file on the repo. 您还可以查看存储库上的.travis.yml文件。

As an example, for rails 3.2: https://github.com/rails/rails/blob/3-2-stable/.travis.yml you'll see that they were running the whole test suite for all those ruby versions: 例如,对于rails 3.2: https : //github.com/rails/rails/blob/3-2-stable/.travis.yml,您将看到它们正在为所有这些ruby版本运行整个测试套件:

rvm:
  - 1.8.7
  - 1.9.2
  - 1.9.3
  - 2.0.0
  - 2.1.8
  - 2.2.6
  - 2.3.3

Which means that rails 3.2 should be compatible with any of those ruby versions. 这意味着rails 3.2应该与任何红宝石版本兼容。

https://rubygems.org/gems/rails/versions/5.2.1.rc1 Refer to the above link, if you are supposed to use rails version 5.2.1.rc1, then required ruby version will be atleast 2.2.2 and above. https://rubygems.org/gems/rails/versions/5.2.1.rc1参考上面的链接,如果您应该使用rails版本5.2.1.rc1,则所需的ruby版本至少为2.2.2,并且以上。 So from 2.2.2 to 2.5.1 ie latest version, any ruby version you can choose. 因此,从2.2.2到2.5.1,即最新版本,您可以选择任何红宝石版本。 Required ruby gems versions will be >= 1.8.11. 所需的红宝石宝石版本将> = 1.8.11。

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

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