I'm currently in a process of upgrading JRuby trunk with the latest rubygems 1.2, and trying to use the new feature to provide some JRuby specific customization to rubygems via #{RUBY_ENGINE}.rb file.
It worked very well in some cases, but I'm facing some problems when I try to customize things like commands, since that RUBY_ENGINE.rb file is loaded at the end of rubygems.rb file but *before* other things like commands are loaded.
Here are some use cases that I'd like to resolve somehow:
1. gem install and gem update commands. I'd like to customize the default options. More specifically, to enable env_shebang option.
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.
In both cases, I can't redefine/monkey-patch those things from #{RUBY_ENGINE}.rb.
Any suggestions?
Thank you, --Vladimir
P.S. So far, rubygems 1.2 looks *very* impressive speed- and memory-wise. Thanks!! _______________________________________________ Rubygems-developers mailing list Rubygems-develop...@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers
> I'm currently in a process of upgrading JRuby trunk with the latest > rubygems 1.2, and > trying to use the new feature to provide some JRuby specific > customization to rubygems via > #{RUBY_ENGINE}.rb file.
> It worked very well in some cases, but I'm facing some problems when I > try to customize > things like commands, since that RUBY_ENGINE.rb file is loaded at the > end of rubygems.rb > file but *before* other things like commands are loaded.
> Here are some use cases that I'd like to resolve somehow:
> 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.
> 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. _______________________________________________ Rubygems-developers mailing list Rubygems-develop...@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers
On Wed, Jun 25, 2008 at 11:46 PM, Eric Hodel <drbr...@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.
>> 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.
> On Wed, Jun 25, 2008 at 11:46 PM, Eric Hodel <drbr...@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 PLATFORM_DEFAULTS.
>>> 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 Gem::ConfigMap[:ruby_install_name]. _______________________________________________ Rubygems-developers mailing list Rubygems-develop...@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers
Thanks for your support and responses, my comments below.
On Thu, Jun 26, 2008 at 1:50 AM, Eric Hodel <drbr...@segment7.net> wrote: > Ok, I added Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS and > PLATFORM_DEFAULTS.
> I think this will work for `gem update`, but I'm not sure. Can you let me > know if it doesn't work?
Yes, this works perfectly in both cases (I had to add require 'rubygems/config_file' to JRuby's customization file jruby.rb though, which seems to be the proper thing).
The only issue with this is that the help output that lists the default options is not really updated accordingly. So, while we endable --env-shebang in jruby.rb, users won't see from jruby -S gem help install, that this option is enabled.
But, all in all, 4 more direct changes of official rubygems sources are removed, and the only single one remains:
>>>> 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.