How do RVM and rbenv actually work?

后端 未结 5 1067
暖寄归人
暖寄归人 2020-12-02 03:54

I am interested in how RVM and rbenv actually work.

Obviously they swap between different versions of Ruby and gemsets, but how is this achieved? I had assumed they

5条回答
  •  感动是毒
    2020-12-02 04:27

    rvm system
    env > before
    rvm jruby # or whatever
    env > after
    diff after before
    

    Gives you approximately:

    < GEM_HOME=$HOME/.gem/ruby/1.9.1
    ---
    > GEM_HOME=$HOME/.rvm/gems/jruby-1.6.6
    < GEM_PATH=$HOME/.gem/ruby/1.9.1
    ---
    > GEM_PATH=$HOME/.rvm/gems/jruby-1.6.6:$HOME/.rvm/gems/jruby-1.6.6@global
    *bunch of rvm_*
    > MY_RUBY_HOME=$HOME/.rvm/rubies/jruby-1.6.6
    > RUBY_VERSION=jruby-1.6.6
    > IRBRC=$HOME/.rvm/rubies/jruby-1.6.6/.irbrc
    

    And it prepends:

    $HOME/.rvm/gems/jruby-1.6.6/bin:$HOME/.rvm/gems/jruby-1.6.6@global/bin
    

    to $PATH

提交回复
热议问题