为什么我们要将 Ruby 1.9.2/1.9.3 gems 安装到 1.9.1 文件夹中? [英] Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?

查看:30
本文介绍了为什么我们要将 Ruby 1.9.2/1.9.3 gems 安装到 1.9.1 文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是因为 gem 命令使用的 Gem 安装目录(在使用 gem env 时看到的)设置为类似:

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

我的问题是为什么?

不应该叫文件夹:

<base_ruby_dir>/lib/ruby/gems/1.9.x

<base_ruby_dir>/lib/ruby/gems/1.9

否则不可能每个版本的 Ruby 都有一个,例如:

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.

推荐答案

在 Ruby 1.9.0 中,C 接口从 Ruby 1.8 系列更改.

In Ruby 1.9.0, the C interface was changed from the Ruby 1.8 series.

编译为本机代码的 Gems 必须重新编译.

Gems that compile to native code had to be recompiled.

接口在 Ruby 1.9.1 中再次更改,并在 Ruby 1.9.2 & 中保持不变.3. 这解释了您在路径中看到的 1.9.1.

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.

这个想法是你可以在你的系统上安装不同版本的 Ruby,并且 gems 将在具有相同 C api 的组中共享.因此 Ruby 1.8.6 和 1.8.7 可以共享它们的 gem,Ruby 1.9.1、.2 和 .3 也可以.

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.

不过,这不一定是最好的主意.在任何情况下,大多数人使用 rvm 来访问不同版本的 Ruby 并且 rvm 将每个版本的 gems 分开,而不考虑 C api 版本.

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 gems 安装到 1.9.1 文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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