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

Charles Oliver Nutter charles.nutter at sun.com
Sat Dec 22 08:40:10 EST 2007


Donavan Pantke wrote:
> On Thursday 20 December 2007 09:38:32 pm Charles Oliver Nutter wrote:
>> 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.

Ahh, I see. Well I'll leave it hardcoded for now, and if a RubyGems 
1.0.2 includes the patch I'll upgrade with my fix above instead. Thanks!

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

We'd gladly do that...and also provide a "shell script shebang" special 
constant that people can use to generate scripts correctly (so we can 
just say "jruby scripts should always use env").

- Charlie


More information about the Rubygems-developers mailing list