简体   繁体   English

RVM:创建一个不从全局继承的 gemset?

[英]RVM: create a gemset that doesn't inherit from global?

I'm starting work on a project written in Rails 2. It looks like it requires an older version of Rake, which is in my global gemset for Ruby 1.8.7.我正在开始一个用 Rails 2 编写的项目。看起来它需要旧版本的 Rake,它位于我的 Ruby 1.8.7 的全局 gemset 中。 I'd like to avoid uninstalling the global 1.8.7 rake just for this one app.我想避免仅为这个应用程序卸载全局 1.8.7 rake。

Is there anyway I can create a gemset that would ignore the global gemset?无论如何我可以创建一个忽略全局gemset的gemset吗?

Edit: the most obvious solution I want to avoid is uninstalling gems from the global gemset.编辑:我想避免的最明显的解决方案是从全局 gemset 中卸载 gem。 In my particular situation I started some work on a legacy app.在我的特殊情况下,我开始了一些遗留应用程序的工作。 It breaks with gems like rake 0.9.3 and my debugging gems (awesome_print, hirb, wirb, etc).它打破了像 rake 0.9.3 这样的 gem 和我的调试 gem(awesome_print、hirb、wirb 等)。 While my current solution (in the comment below) is a hack, it appears to be the least amount of work for what I want.虽然我目前的解决方案(在下面的评论中)是一个 hack,但它似乎是我想要的最少的工作量。 I was hoping that there was some gemset exception command that I didn't know about.我希望有一些我不知道的 gemset 异常命令。

You should be able to run rvm gemset empty test on your newly created gemset to remove all gems (local and global), then an bundle install should only install the gemfile gems.您应该能够在新创建的 gemset 上运行rvm gemset empty test以删除所有 gem(本地和全局),然后bundle install应该只安装 gemfile gem。

Yes you can.是的你可以。 You need to run rvm gemset create {gemset_name} .您需要运行rvm gemset create {gemset_name} That will create an empty gemset, and you'll have to install all the gems with their versions in there (just gem install..., without sudo).这将创建一个空的 gemset,并且您必须在其中安装所有 gem 及其版本(只需 gem install ...,没有 sudo)。

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

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