On Dec 24, 2009, at 4:02 , Jeroen van Meeuwen wrote:
# gem install facter
installs facter to /usr/local/share/ruby/gems/facter-<version>, along
with the facter.gemspec in /usr/local/share/ruby/specifications/ and so
forth, but facter itself won't work.
I mentioned this in an off-list message to Jeroen (just joined the list now, hello
everyone!), but I think the issue comes down to the fact that gem_prelude.rb's
implementation of Gem.default_dir doesn't match the implementation in
lib/rubygems/defaults.rb. (The latter is the full rubygems 1.3.1 version that ships
within ruby 1.9.1.) To me it looks like an upstream bug; I can't imagine why they
should be implemented so differently. With default MRI paths, they both return
(approximately?) the same results, but with this new structure they don't match. In
particular, gem_prelude's version returns a nonsensical path.
You can compare the two versions by simply doing this, in a fresh irb instance:
# the gem_prelude.rb version
> Gem.default_dir
=>
"/usr/lib64/ruby-1.9.1/gems"
# trigger method_missing to swap in the full/real rubygems
> Gem.asdf
NoMethodError: undefined method `asdf' for
Gem:Module
from <internal:gem_prelude>:341:in `method_missing'
from (irb):2
from /usr/bin/irb-1.9.1:12:in `<main>'
# the lib/rubygems/defaults.rb version
> Gem.default_dir
=> "/usr/local/share/ruby/"
I believe the noisy strace you are seeing is simply ruby's usual Kernel.require
process of searching the whole load path. When I modified gem_prelude.rb so that its
default_dir agreed with rubygems', suddenly everything else started working too. E.g.
"require 'facter'" works for me now, in a fresh irb instance.
I piggybacked my change onto the patch you've already included in your RPM, since you
were already tweaking gem_prelude.rb. Patch-to-your-patch attached (same one I emailed
directly earlier).
Like I said before though, I think there's an upstream bug here too... why do the
default_dir methods work so differently?
-Ben