Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 184375 - dev-java/jruby-1.0 doesn't find installed gems without "require rubygems"
Summary: dev-java/jruby-1.0 doesn't find installed gems without "require rubygems"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High minor
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 187619
  Show dependency tree
 
Reported: 2007-07-06 03:00 UTC by mikael lammentausta
Modified: 2009-05-23 08:08 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mikael lammentausta 2007-07-06 03:00:00 UTC
It seems that JRuby requires the explicit require 'rubygems' to be able to use installed gems:

 $ /usr/bin/jruby -e "require 'gen'"
 :-1: no such file to load -- gen (LoadError)

This specific gem is installed:

 $ ls /usr/share/jruby/lib/ruby/gems/1.8/gems/gen-0.41.0/
 bin  doc  lib

The gem can be found by explicitly requiring the rubygems package,

 $ /usr/bin/jruby -e "require 'rubygems'; require 'gen'"

Which exits with no errors. Pure CRuby works without this requirement, so this bug may require changes to Ruby scripts run under JRuby.

Reproducible: Always
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2007-08-21 23:31:52 UTC
Pure C ruby only works this way because of the RUBYOPT auto_gem hack we have in portage.
Comment 2 Hans de Graaff gentoo-dev Security 2008-06-28 07:30:34 UTC
My vote would be to close this issue as WONTFIX. While the auto_gem hack is convenient, it also means that code won't be written portably (ie, using a require 'rubygems'). I guess that if JRuby has a similar mechanism we could add that, but...

maybe we should consider removing our auto_gem hack from RUBYOPT altogether?
Comment 3 James Le Cuirot gentoo-dev 2008-07-29 23:16:19 UTC
I don't see a problem with keeping the hack. JRuby includes its own modified copy of rubygems anyway. We didn't install this for a while but I've added it back because the modifications are important. rubygems wasn't actually working for JRuby at all when I tried it. I've created a separate site_ruby script for JRuby called gentoo.rb. It autoloads rubygems and also appends the regular Ruby site_ruby directory to the $LOAD_PATH. Check out 1.1.3 in java-overlay.
Comment 4 Łukasz Damentko (RETIRED) gentoo-dev 2009-03-17 22:13:19 UTC
Moving to herd since nichoj left Gentoo.
Comment 5 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2009-05-23 08:08:28 UTC
gentoo.rb added in 1.2, I think we don't want automatic hacks