ARGV - rename method that conflicts with optparse
optparse adds an "options" method to ARGV, and so does Homebrew. Rename this method (and remove optparse blocking script) so that Homebrew plays nicer with external Ruby software. This fixes the issue where "gem install thin" would break "brew server", for instance.
This commit is contained in:
parent
6612a04917
commit
f990f083e8
@ -7,7 +7,7 @@ module HomebrewArgvExtension
|
||||
@named ||= reject{|arg| arg[0..0] == '-'}
|
||||
end
|
||||
|
||||
def options
|
||||
def options_only
|
||||
select {|arg| arg[0..0] == '-'}
|
||||
end
|
||||
|
||||
@ -59,7 +59,7 @@ module HomebrewArgvExtension
|
||||
end
|
||||
|
||||
def flag? flag
|
||||
options.each do |arg|
|
||||
options_only.each do |arg|
|
||||
return true if arg == flag
|
||||
next if arg[1..1] == '-'
|
||||
return true if arg.include? flag[2..2]
|
||||
|
||||
@ -106,7 +106,7 @@ class FormulaInstaller
|
||||
fork do
|
||||
begin
|
||||
read.close
|
||||
exec '/usr/bin/nice', '/usr/bin/ruby', '-I', File.dirname(__FILE__), '-rinstall', f.path, '--', *ARGV.options
|
||||
exec '/usr/bin/nice', '/usr/bin/ruby', '-I', File.dirname(__FILE__), '-rinstall', f.path, '--', *ARGV.options_only
|
||||
rescue => e
|
||||
Marshal.dump(e, write)
|
||||
write.close
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
# This file is put here to prevent loading of real optparse.rb,
|
||||
# which killed Homebrew. Details of issue can be found here:
|
||||
# http://github.com/mxcl/homebrew/issues#issue/97
|
||||
6
bin/brew
6
bin/brew
@ -126,7 +126,7 @@ begin
|
||||
end
|
||||
elsif ARGV.named.empty?
|
||||
ENV['CLICOLOR']=nil
|
||||
exec 'ls', *ARGV.options<<HOMEBREW_CELLAR if HOMEBREW_CELLAR.exist?
|
||||
exec 'ls', *ARGV.options_only<<HOMEBREW_CELLAR if HOMEBREW_CELLAR.exist?
|
||||
elsif ARGV.verbose? or not $stdout.tty?
|
||||
exec "find", *ARGV.kegs+%w[-not -type d -print]
|
||||
else
|
||||
@ -257,7 +257,7 @@ begin
|
||||
|
||||
when 'log'
|
||||
Dir.chdir HOMEBREW_REPOSITORY
|
||||
args = ARGV.options
|
||||
args = ARGV.options_only
|
||||
args.unshift ARGV.formulae.first.path unless ARGV.named.empty?
|
||||
exec "git", "log", *args
|
||||
|
||||
@ -276,7 +276,7 @@ begin
|
||||
|
||||
when 'cat'
|
||||
Dir.chdir HOMEBREW_REPOSITORY
|
||||
exec "cat", ARGV.formulae.first.path, *ARGV.options
|
||||
exec "cat", ARGV.formulae.first.path, *ARGV.options_only
|
||||
|
||||
when 'outdated'
|
||||
outdated_brews.each do |keg, name, version|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user