[Rubygems-developers] rubygems passing ARGV to extension builders breaks usage via API
drbrain at segment7.net
Thu Sep 18 19:45:50 EDT 2008
On Sep 18, 2008, at 16:23 PM, Chad Woolley wrote:
> When building native gems, Rubygems does this:
> * in the gem binary, if there is a '--' arg, it clones ARGV to
> preserve the options
> * Eventually, the extension builders like ext/ext_conf_builder.rb and
> ext/rake_builder.rb passes the unmodified ARGV in.
> This causes problems when RubyGems is invoked via the GemRunner API
> (which happens after the binary), because there is no way to set ARGV
> (and you shouldn't have to anyway).
You can set ARGV, but you shouldn't have to.
$ ruby -e 'p ARGV; ARGV.replace %w[1 2 3]; p ARGV' -- a b c
["a", "b", "c"]
["1", "2", "3"]
> I believe the right way to fix this would be to:
> 1. move the code to stash all args after '--' into GemRunner
> 2. Make it stash the args somewhere and eventually pass it down to the
> ext builders
> 3. make the ext builders use these args instead of using ARGV directly
I like this proposal. Gem::Command could handle this, and have an
accessor for something like "extra argv". I don't want to try to put
this in for the next release though.
> This is a problem for my project, and I believe it will be a problem
> for Rails too - when they remove the built-in mysql support in the
> near future and require the mysql gem to be used, there will be no way
> for config.gems to programatically pass options to the mysql gem
> build, which is usually required.
More information about the Rubygems-developers