From f990f083e8758019b7513605d54af6ae129cc913 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Tue, 13 Jul 2010 07:31:43 -0700 Subject: [PATCH] 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. --- Library/Homebrew/extend/ARGV.rb | 4 ++-- Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/optparse.rb | 3 --- bin/brew | 6 +++--- 4 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 Library/Homebrew/optparse.rb diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index 352f5d03d7..d39df7d7f8 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -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] diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 622d6575f8..c46e20b2be 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -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 diff --git a/Library/Homebrew/optparse.rb b/Library/Homebrew/optparse.rb deleted file mode 100644 index 67f6641f8e..0000000000 --- a/Library/Homebrew/optparse.rb +++ /dev/null @@ -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 diff --git a/bin/brew b/bin/brew index e9016704ae..336e3ba1a9 100755 --- a/bin/brew +++ b/bin/brew @@ -126,7 +126,7 @@ begin end elsif ARGV.named.empty? ENV['CLICOLOR']=nil - exec 'ls', *ARGV.options<