[Rubyinstaller-devel] Pik and GEM_HOME, GEM_PATH and my environment

Luis Lavena luislavena at gmail.com
Sun Jun 21 13:16:07 EDT 2009

Hello Guys,

I wanted to share my lovely experience so far using Pik...

I just love it!

Gordon: thank you for making by batch files (rb18 and rb19) deprecate
so easily :-D

I've a few comments so far on this, and my results of trying to hack
GEM_PATH and GEM_HOME in the gem_home branch, please take those with a
grain of salt since I haven't invested a lot of time on understanding
Pik too much :-D

First, my background:

I don't install gems inside each ruby installation. Instead, I install
them into a share ".gems" place in my HOME.

But I don't share gems between 1.8.x and 1.9.x (which is a bummer for
binary gems)

So, what I did is follow what Gem.default_path returns:

C:\Users\Luis\Tools>SET GEM_HOME=

C:\Users\Luis\Tools>SET GEM_PATH

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> Gem.default_path
=> ["C:\\Users\\Luis/.gem/ruby/1.8",

As you can see, the first option is ".gem/ruby/1.8"

Now, the same for 1.9.x:

irb(main):001:0> require 'rubygems'
=> false
irb(main):002:0> Gem.default_path
=> ["C:\\Users\\Luis/.gem/ruby/1.9.1",

Notice that the version is not "1.9" but "1.9.1", this is because it
uses RbConfig::CONFIG['ruby_version'] to determine the version of the
API compatibility layer.

FYI: 1.9.2-dev so far remains as 1.9.1.

So, with that in mind, wanted to replicate this into my "ruby
switching" scripts, which I lamely put here:


As you can see, pretty lame, but works.

Since I don't have time right now to update my previous multiruby
scripts, used those batches for long time.

Anyhow, been trying to put this into Pik, but I'm stuck. Since
GEM_HOME should also be in the PATH (with \bin)... wonder:

Shouldn't switch_path_to defer it's writing and return the resulting
PATH? In that way, I should be able to hook, under the same PATH of
GEM_HOME, instead of default to ENV['PATH'] as is right now.

Comments? Suggestions?

Thank you!
Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the Rubyinstaller-devel mailing list