JRuby & rubygems' load path

Hi,

I am having problems with the use of the “test-unit” gem under JRuby in
1.9 mode.

I wrote the following code to explain:

require ‘rubygems’
gem ‘test-unit’
puts Gem.find_files(“test/unit”)

Result under Ruby 1.9.2:

c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.1.2/lib/test/unit.rb
c:/Ruby192/lib/ruby/1.9.1/test/unit.rb

Result under JRuby 1.5.6 + --1.8:

C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/test-unit-2.1.2/lib/test/unit.rb
C:/jruby-1.5.6/lib/ruby/1.8/test/unit.rb

Result under JRuby 1.5.6 + --1.9:

C:/jruby-1.5.6/lib/ruby/1.9/test/unit.rb
C:/jruby-1.5.6/lib/ruby/gems/1.8/gems/test-unit-2.1.2/lib/test/unit.rb

For the story, this has consequences when testing under Netbeans, which
isn’t compatible with the MiniTest implementation of test cases.

Still, I don’t get why the activation of the “test-unit” doesn’t modify
the loading path under JRuby+1.9, while all other versions disagree.

Any ideas?

Philippe

It would seem that JRuby --1.9:

  • isn’t shipped with its own version of rubygems.rb (contrarily to Ruby
    1.9.2) but defaults to the one given in:

    C:/jruby-1.5.6/lib/ruby/site_ruby/1.8

  • adds the paths of the installed gems to the end of the load path
    rather than the beginning (for a reason, I’m still looking for).

I finally understood that the built-in “gem_prelude.rb” is to
incriminate. It modifies the load path in order to include those of all
the latest versions of the installed gems. That may be fine (although
perhaps a bit hackish) but the problem is that it adds at the end of the
load path instead of the beginning.
Well, that’s if I understood well.