使用rvm的rubygems的多个版本? [英] Use multiple versions of rubygems with rvm?

查看:97
本文介绍了使用rvm的rubygems的多个版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机上有两个项目:
- 一个旧的Rails 2.3应用程序,需要使用rubygems 1.6并且不能在rubygems 1.8下运行;
- 一款需要rubygems 1.8的新应用程序,并且不会在rubygems 1.6下运行。

每个项目都有自己的rvm gemset,但是我无法确定了解如何为他们提供不同版本的rubygems本身:




  • gem update --system [version]导致gem --version给出相同的答案都在;

  • rvm gemset [version]具有相同的结果。



我在一个项目中运行rubygems 1.6.2,在另一个项目中运行1.8.11?




澄清,这里是我想要做什么


  • 在目录A中,有一个带有选择gemset A和rubygems 1.6的命令的.rvmrc。 2

  • 在目录B中,使用命令选择gemset B和rubygems .rvmrc

  • 同时打开两个终端会话,一个在目录A中,另一个在目录B中

  • 在目录A中输入gem --version并参阅1.6.2 宝石 - 版本在目录B中,参见1.8.11 正确的方法是创建不同的命名(-n)安装你想要安装的ruby,并根据你想要的rubygem版本命名它们,比如

      rvm - 安装使用1.9.2-nrg186&& rvm ruby​​gems 1.8.6&& gem --list 
    rvm --install使用1.9.2-nrg1810&& rvm ruby​​gems 1.8.10&& gem --list

    原因是您只能有1个版本的rubygems激活任何给定的时间。这也是因为每个ruby都定义了一个依赖于某个特定的rubygems版本的版本,该版本已知或者预期可以使用(不管它是否可以与另一个版本兼容)。



    这是处理多个rubygems需求并消除潜在问题的预期方法。有关详细信息,请参阅 https://gist.github.com/1273035


    I have two projects on my computer: - An old Rails 2.3 app that needs rubygems 1.6 and won't run under rubygems 1.8; - A newer app that needs rubygems 1.8 and won't run under rubygems 1.6.

    Each project has its own rvm gemset, but I can't figure out how to give them different versions of rubygems itself:

    • gem update --system [version] results in gem --version giving the same answer in both;
    • rvm gemset [version] has the same result.

    How can I run rubygems 1.6.2 in one project and 1.8.11 in the other?


    To clarify, here's what I want to do:

    • In directory A, have a .rvmrc with commands that select gemset A and rubygems 1.6.2
    • In directory B, have a .rvmrc with commands that select gemset B and rubygems latest
    • Have two terminal sessions open at the same time, one in directory A and the other in directory B
    • Type "gem --version" in directory A and see "1.6.2"
    • Type "gem --version" in directory B and see "1.8.11"

    解决方案

    The correct way is to created different named (-n) installs of the ruby you want installed and name them according to the rubygem version you want such as

    rvm --install use 1.9.2-nrg186 && rvm rubygems 1.8.6 && gem --list
    rvm --install use 1.9.2-nrg1810 && rvm rubygems 1.8.10 && gem --list
    

    The reason for this is that you can only have 1 version of rubygems active an any given time. This is also due to the fact that each ruby defines a dependency on a specific rubygems version that version is known or expected to work with (regardless of if it can work with another or not).

    This is the expected way to handle the multiple rubygems requirement and to eliminate potential problems. See https://gist.github.com/1273035 for specifics detailing this.

    这篇关于使用rvm的rubygems的多个版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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