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

Donavan Pantke avatar at spellboundnet.com
Sat Dec 22 00:22:35 EST 2007


On Thursday 20 December 2007 09:38:32 pm Charles Oliver Nutter wrote:
> 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'
>    end
>
> 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"
>      else
>
> 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

This is because :env_shebang  is being set by install_update_options.rb. Since 
the option already exists, the merge is overriding your default. I submitted 
patch 16508 which should make the above work properly.

>
> ...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.

Honestly, it would be real nice if Ruby interpreters would define a standard 
constant that contains the name of the interpreter executable. Would be easy 
to define, and instead of playing patching games, gems could just use that 
constant.

>
> 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
> _______________________________________________
> Rubygems-developers mailing list
> Rubygems-developers at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubygems-developers


More information about the Rubygems-developers mailing list