From ebbc3438a1e6f9014d049c98c54182a31212b1d8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 25 Aug 2012 11:24:13 -0700 Subject: [PATCH] Move used_options and unused_options to ARGV. --- Library/Homebrew/extend/ARGV.rb | 8 ++++++++ Library/Homebrew/tab.rb | 10 ++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index bdfb8fd523..e8a227258c 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -7,6 +7,14 @@ module HomebrewArgvExtension select {|arg| arg[0..0] == '-'} end + def used_options f + f.build.as_flags & options_only + end + + def unused_options f + f.build.as_flags - options_only + end + def formulae require 'formula' @formulae ||= downcased_unique_named.map{ |name| Formula.factory name } diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 32fb5d3657..1a334600df 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -9,14 +9,8 @@ require 'vendor/multi_json' # `Tab.for_install`. class Tab < OpenStruct def self.for_install f, args - # Retrieve option flags from command line. - arg_options = args.options_only - # Pick off the option flags from the formula's `options` array by - # discarding the descriptions. - formula_options = f.build.as_flags - - Tab.new :used_options => formula_options & arg_options, - :unused_options => formula_options - arg_options, + Tab.new :used_options => args.used_options(f), + :unused_options => args.unused_options(f), :tabfile => f.prefix + "INSTALL_RECEIPT.json", :built_bottle => !!args.build_bottle?, :tapped_from => f.tap