Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?

后端 未结 2 1840
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 07:42

This comes about because the Gem installation directory used by the gem command, seen when using gem env, is set to something like:



        
相关标签:
2条回答
  • 2020-11-27 08:23

    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.

    0 讨论(0)
  • 2020-11-27 08:26

    I think it's because these versions should be compatible, and if you had separate directories, you'd have to reinstall all your gems with it. This way you can upgrade the version of ruby without having to reinstall all the gems.

    0 讨论(0)
提交回复
热议问题