diff options
| author | Jack Nagel | 2013-01-23 00:26:28 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-01-26 12:14:47 -0600 |
| commit | cf08b71bf8dc94eaaeb1b0cde68b97a7e02ca129 (patch) | |
| tree | def0a5578f371e60cf1d340637f9b9f33d97d2f1 /Library/Homebrew/build_options.rb | |
| parent | 046d802d0994be84802c6c50b6336b27b6d8ddd5 (diff) | |
| download | brew-cf08b71bf8dc94eaaeb1b0cde68b97a7e02ca129.tar.bz2 | |
FormulaInstaller: construct new ARGV from an Options collection
The array of options that is passed to the spawned build process is a
combination of the current ARGV, options passed in by a dependent
formula, and an existing install receipt. The objects that are
interacting here each expect the resulting collection to have certain
properties, and the expectations are not consistent.
Clear up this confusing mess by only dealing with Options collections.
This keeps our representation of options uniform across the codebase.
We can remove BuildOptions dependency on HomebrewArgvExtension, which
allows us to pass any Array-like collection to Tab.create. The only
other site inside of FormulaInstaller that uses the array is the #exec
call, and there it is splatted and thus we can substitute our Options
collection there as well.
Diffstat (limited to 'Library/Homebrew/build_options.rb')
| -rw-r--r-- | Library/Homebrew/build_options.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index 1718bc4a0..24c49931f 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -7,7 +7,7 @@ class BuildOptions include Enumerable def initialize args - @args = Array.new(args).extend(HomebrewArgvExtension) + @args = Options.coerce(args) @options = Options.new end @@ -37,7 +37,7 @@ class BuildOptions end def include? name - @args.include? '--' + name + args.include? '--' + name end def with? name @@ -55,11 +55,11 @@ class BuildOptions end def head? - @args.flag? '--HEAD' + args.include? '--HEAD' end def devel? - @args.include? '--devel' + args.include? '--devel' end def stable? @@ -68,21 +68,21 @@ class BuildOptions # True if the user requested a universal build. def universal? - @args.include?('--universal') && has_option?('universal') + args.include?('--universal') && has_option?('universal') end # Request a 32-bit only build. # This is needed for some use-cases though we prefer to build Universal # when a 32-bit version is needed. def build_32_bit? - @args.include?('--32-bit') && has_option?('32-bit') + args.include?('--32-bit') && has_option?('32-bit') end def used_options - Options.new((as_flags & @args.options_only).map { |o| Option.new(o) }) + Options.new(@options & @args) end def unused_options - Options.new((as_flags - @args.options_only).map { |o| Option.new(o) }) + Options.new(@options - @args) end end |
