formula_installer: fix option-with-value handling

When passing formula options with value, e.g. `--with-qt=5`, to the
child process responsible for building a formula, `ARGV.value` would be
invoked with `nil`. Handle this more elegantly (no change in behavior).

For consistency, use a regular expression adapted from `Options.create`
instead of the somewhat bogus one used before.
This commit is contained in:
Martin Afanasjew 2016-05-11 06:04:35 +02:00
parent 745a1312dc
commit 2e961dc9de

View File

@ -538,9 +538,9 @@ class FormulaInstaller
end
formula.options.each do |opt|
name = opt.name[/\A(.+)=\z$/, 1]
value = ARGV.value(name)
args << "--#{name}=#{value}" if name && value
name = opt.name[/^([^=])+=$/, 1]
value = ARGV.value(name) if name
args << "--#{name}=#{value}" if value
end
args