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-...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers
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.
Thanks for very quick response!
On Wed, Jun 25, 2008 at 11:46 PM, Eric Hodel <drb...@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.
Thanks,
--Vladimir
Ok, I added Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS and
PLATFORM_DEFAULTS.
Add:
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
Gem::ConfigMap[:ruby_install_name].
Thanks for your support and responses, my comments below.
On Thu, Jun 26, 2008 at 1:50 AM, Eric Hodel <drb...@segment7.net> wrote:
> Ok, I added Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS and
> PLATFORM_DEFAULTS.
And I just integrated that into JRuby.
> Add:
>
> 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?
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.
I'll talk about it in a separate email.
Thanks,
--Vladimir