如何使用 RVM 并创建全局可用的 gems? [英] How do I use RVM and create globally available gems?

查看:14
本文介绍了如何使用 RVM 并创建全局可用的 gems?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Mac OSX 10.6.4 并安装了 RVM.到目前为止它很棒,我真的很喜欢它让我在同一台机器上管理多个版本的 rails 和 ruby​​ 的方式而不会头疼!

I'm running Mac OSX 10.6.4 and have installed RVM. Its been great so far, I really love the way it lets me manage having multiple versions of rails and ruby on the same machine without headaches!

但是,我不想为每个设置都安装某些 gem(例如乘客).有没有办法在宝石组之间共享宝石?我有一个 1.8.7@rails2.3.8 和 1.9.2@rails3,我可以将诸如乘客、mysql 和 capistrano 之类的 gem 安装一次并与所有版本一起使用吗?

However, I don't want to have to install certain gems (such as passenger) for each setup. Is there a way to share gems between gemsets? I have a 1.8.7@rails2.3.8 and 1.9.2@rails3, can I have gems such as passenger, mysql, and capistrano installed once and used with all versions?

推荐答案

有一种叫做全局 gemset 的东西,它在你的某个 ruby​​ 版本的所有 gemset 之间共享.但是你不能在 ruby​​ 版本之间共享 gem.

There is something called the global gemset, and it is shared between all your gemsets of a certain ruby-version. But you can't share gems between ruby-versions.

但是,您可以做的是创建一个 gem 列表,当添加新的 ruby​​ 版本时,这些 gem 将自动安装.此处对此进行了描述.简而言之:编辑一个名为 ~/.rvm/gemsets/global.gems 的文件,以包含您希望每个 ruby​​ 版本的 gem 列表.

However, what you can do is create a list of gems that will be installed automatically when adding a new ruby version. That is described here. In short: edit a file called ~/.rvm/gemsets/global.gems to contain the list of gems you want to be there for each ruby-version.

希望有帮助.

这篇关于如何使用 RVM 并创建全局可用的 gems?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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