Gems and custom_require problem for ruby(1.9.2dev)/rubygems(1.3.6) installed in $HOME

I installed ruby 1.9.2dev (2010-03-17 trunk 26961) [i686-linux] in my
$HOME dir using configure --prefix=$HOME && make install
also i set PATH=$HOME/bin:$PATH

Then, I tried to run rake test on edge rails version, having required
gems installed via “bundle install”

gem list shows them installed

But, “rake test”, complained that it cannot find required rubygems,
like: activerecord/test/cases/helper.rb:12:in `require’: no such file
to load – mocha

As a workaround, it started only with following RUBYOPT options:

RUBYOPT="-rubygems -rrubygems/custom_require" rake test

What am I missing that causes the problem?

Also, here is sample IRB session showing the issue:
$ irb
irb(main):001:0> RUBY_VERSION
=> “1.9.2”
irb(main):002:0> Gem::VERSION
=> “1.3.6”
irb(main):003:0> require ‘mocha’
LoadError: no such file to load – mocha
from (irb):3:in require' from (irb):3 from /home/nlugovoi/bin/irb:12:in
irb(main):004:0> require ‘rubygems’
=> false
irb(main):005:0> require ‘mocha’
LoadError: no such file to load – mocha
from (irb):5:in require' from (irb):5 from /home/nlugovoi/bin/irb:12:in
irb(main):006:0> require ‘rubygems/custom_require’
=> true
irb(main):007:0> require ‘mocha’
=> true
irb(main):008:0> Gem.path
=> ["/home/nlugovoi/.gem/ruby/1.9.1",
“/home/nlugovoi/lib/ruby/gems/1.9.1”]

Here is another oddity, and I could not trace source of it:

irb(main):001:0> Gem::ConfigMap
=> {:EXEEXT=>"", :RUBY_SO_NAME=>“ruby”, :arch=>“i686-linux”,
:bindir=>"/home/nlugovoi/lib/ruby/bin",
:libdir=>"/home/nlugovoi/lib/ruby/lib", :ruby_install_name=>“ruby”,
:ruby_version=>“1.9.1”,
:rubylibprefix=>"/home/nlugovoi/lib/ruby/lib/ruby",
:sitedir=>"/home/nlugovoi/lib/ruby/lib/ruby/site_ruby",
:sitelibdir=>"/home/nlugovoi/lib/ruby/lib/ruby/site_ruby/1.9.1"}
irb(main):002:0> Gem.path
=> ["/home/nlugovoi/.gem/ruby/1.9.1",
“/home/nlugovoi/lib/ruby/lib/ruby/gems/1.9.1”]
irb(main):003:0> Gem.clear_paths
=> nil
irb(main):004:0> Gem::ConfigMap
=> {:EXEEXT=>"", :RUBY_SO_NAME=>“ruby”, :arch=>“i686-linux”,
:bindir=>"/home/nlugovoi/bin", :libdir=>"/home/nlugovoi/lib",
:ruby_install_name=>“ruby”, :ruby_version=>“1.9.1”,
:rubylibprefix=>"/home/nlugovoi/lib/ruby",
:sitedir=>"/home/nlugovoi/lib/ruby/site_ruby",
:sitelibdir=>"/home/nlugovoi/lib/ruby/site_ruby/1.9.1",
:datadir=>"/home/nlugovoi/share",
:vendordir=>"/home/nlugovoi/lib/ruby/vendor_ruby",
:vendorlibdir=>"/home/nlugovoi/lib/ruby/vendor_ruby/1.9.1"}
irb(main):005:0> Gem.path
=> ["/home/nlugovoi/.gem/ruby/1.9.1",
“/home/nlugovoi/lib/ruby/gems/1.9.1”]

so, at the moment of loading, Gem::ConfigMap points to wrong
directories, :rubylibprefix=>"$HOME/lib/ruby/lib/ruby" instead of
:rubylibprefix=>"$HOME/lib/ruby", and fixes that only after
Gem.clear_paths

How can that happen that in gem_prelude.rb ConfigMap receives such
incorrect values?

Actually, that seems to be a bug, introduced in svn rev26881, that
results in :

ruby.c:448:
rb_const_set(rb_cObject, rb_intern_const(“TMP_RUBY_PREFIX”),
rb_obj_freeze(rb_str_new(RUBY_LIB_PREFIX,
sizeof(RUBY_LIB_PREFIX)-1)));

added to ruby bugs: http://redmine.ruby-lang.org/issues/show/2978

sorry for the noise

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs