[Rubygems-developers] Customizing rubygems via #{RUBY_ENGINE}.rb

Eric Hodel drbrain at segment7.net
Wed Jun 25 19:50:58 EDT 2008

On Jun 25, 2008, at 14:53 PM, Vladimir Sizikov wrote:
> On Wed, Jun 25, 2008 at 11:46 PM, Eric Hodel <drbrain at segment7.net>  
> wrote:
>>> 1. gem install and gem update commands. I'd like to customize the
>>> default options.
>>> More specifically, to enable env_shebang option.
>> I think Gem::ConfigFile can be changed to set this as default.   
>> I'll explore
>> it.
> The ideal case would be to have zero "hacks/patches" over official
> rubygems sources, so if there is a way to provide command defaults and
> not modifying
> the official sources, that would be the best.
> I think #{RUBY_ENGINE}.rb is a good start.

Ok, I added Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS and  


Gem::ConfigFile::PLATFORM_DEFAULTS['install'] = '--env-shebang'
Gem::ConfigFile::PLATFORM_DEFAULTS['update'] = '--env-shebang'

I think this will work for `gem update`, but I'm not sure.  Can you  
let me know if it doesn't work?

(In the future, Gem::InstallUpdateOptions needs to be connected into  
these common options, I'm not sure how to do that yet.)

>>> 2. installer.rb has shebang(bin_file_name) method that works not
>>> ideally with JRuby on Windows,
>>> and I'd like to provide customized version of that.
>> How do you want to change shebang?  Maybe we can make the change in  
>> the
>> installer instead.
> In JRuby, the main executable name on Windows is jruby.bat. If you
> have the shebang:
> #!/usr/bin/env jruby.bat
> That won't work on Cygwin, but
> #!/usr/bin/env jruby  - will work
> So, we currently modify that shebang method to return the  
> appropriate one.

I saw your paste (http://pastie.org/222204) with the change you're  
making to Installer.  Do you think an overridable  
Gem.ruby_executable_name would be sufficient? By default it would be  

More information about the Rubygems-developers mailing list