为什么我们将Ruby 1.9.2 / 1.9.3 gem安装到1.9.1文件夹中? [英] Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?
问题描述
这是因为在使用 gem env
时看到的 gem
命令使用的Gem安装目录是设置为如下所示:
< base_ruby_dir> /lib/ruby/gems/1.9.1
我的问题是为什么?
不应该调用该文件夹:
< base_ruby_dir> /lib/ruby/gems/1.9.x
或
< base_ruby_dir> / lib / ruby /gems/1.9
或者每个版本的Ruby都不能有一个,例如:
c:/ruby191/lib/ruby/gems/1.9.1
c:/ ruby192 / lib / ruby / gems / 1.9.2
c:/ruby193/lib/ruby/gems/1.9.3
不是一个关键的问题,我知道,我只是想知道。
在Ruby 1.9.0中,C接口从Ruby 1.8系列。
编译为本地代码的宝石必须是重新编译。
界面在Ruby 1.9.1中再次更改,并且在Ruby 1.9.2& 3.这解释了你在你的路径中看到的1.9.1。
这个想法是你可以在你的系统上安装不同版本的Ruby,并且这些gem将被共享在具有相同C api的组内。所以Ruby 1.8.6和1.8.7可以分享他们的宝石,Ruby 1.9.1,.2和.3也是如此。
这不一定是最好的想法,虽然。在任何情况下,大多数人使用 rvm
来访问不同版本的Ruby,并且 rvm
为每个版本保持独立的gem,而不管的C api版本。
This comes about because the Gem installation directory used by the gem
command, seen when using gem env
, is set to something like:
<base_ruby_dir>/lib/ruby/gems/1.9.1
My question is why?
Shouldn't the folder be called:
<base_ruby_dir>/lib/ruby/gems/1.9.x
or
<base_ruby_dir>/lib/ruby/gems/1.9
or else couldn't there be one per version of Ruby, like:
c:/ruby191/lib/ruby/gems/1.9.1
c:/ruby192/lib/ruby/gems/1.9.2
c:/ruby193/lib/ruby/gems/1.9.3
Not a critical problem I know, I was just wondering.
In Ruby 1.9.0, the C interface was changed from the Ruby 1.8 series.
Gems that compile to native code had to be recompiled.
The interface was again changed in Ruby 1.9.1 and kept the same in Ruby 1.9.2 & 3. This explains the 1.9.1 you are seeing in your path.
The idea is that you can install different versions of Ruby on your system and that gems would be shared within groups having the same C api. So Ruby 1.8.6 and 1.8.7 could share their gems, and so could Ruby 1.9.1, .2 and .3.
It's not necessarily the best idea, though. In any case, most people use rvm
to access different versions of Ruby and rvm
keeps gems separate for each version, irrespective of the C api version.
这篇关于为什么我们将Ruby 1.9.2 / 1.9.3 gem安装到1.9.1文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!