[Rubygems-developers] How best to change defaults for RubyGems in JRuby

Charles Oliver Nutter charles.nutter at sun.com
Thu Dec 20 21:38:32 EST 2007

Eric Hodel wrote:
> I added a patch that moved most of the defaults methods into rubygems/ 
> defaults.rb.  Perhaps RubyGems could conditionally define things  
> depending upon platform in that file?

Well let me describe the changes I'm making. I'm updating JRuby to 
RubyGems 1.0.0 right now.

First change in install_update_options.rb:

   # Default options for the gem install command.
   def install_update_defaults_str
     '--rdoc --no-force --no-test --wrappers --env-shebang'

I don't know if this is anything more than informational

Second change is in installer.rb:

     if true || @env_shebang then
       "#!/usr/bin/env jruby"

The "if true" needs some explaining. I can't find where to make 
env_shebang true by default. The other place I tried, also in installer, 
didn't seem to make a difference:

    options = {
       :force => false,
       :install_dir => Gem.dir,
       :exec_format => false,
       :env_shebang => true # this doesn't seem to work
     }.merge options

...so the if true || @env_shebang is just to hardcode it to always use 
env shebangs (since JRuby startup script is always just a shell script). 
And of course the shebang string itself is changed to say "jruby" 
instead of "ruby" since it's normally hardcoded to be "ruby". It would 
probably be nice if that used some runtime-specific value.

So basically what would be nice is if I didn't have to remember to hunt 
down and patch these locations each time we updated RubyGems...or simply 
to have a single place I can tweak them to JRuby. That's probably going 
to be useful in the future with other implementations getting close to 
running RubyGems as well.

- Charlie

More information about the Rubygems-developers mailing list