diff options
| author | Charlie Sharpsteen | 2011-11-26 21:03:46 -0800 |
|---|---|---|
| committer | Charlie Sharpsteen | 2011-11-27 14:37:31 -0800 |
| commit | b5f942764a58c1a04e04de83e94eb59a915ee3cb (patch) | |
| tree | e9de60f8fd6e267122c06a09dafe35ac59e285f3 /Library/Homebrew/extend | |
| parent | 9ecb2ceb299b771eb3710aea3747f3112d5af45c (diff) | |
| download | brew-b5f942764a58c1a04e04de83e94eb59a915ee3cb.tar.bz2 | |
Re-work ARGV filtering to properly handle --HEAD
Previously, stripping arguments like `--HEAD` for dependencies failed because
that flag affects the installation prefix encoded into formula objects. The
previous implementation of `ARGV` filtering tried to contain all changes to a
single method call before the `FormulaInstaller` forks. This update spreads
things out a bit:
- The Homebrew `ARGV` extension adds a new method, `filter_for_dependencies`
which strips flags like `--HEAD`, yields to a block, then restores the
original contents of ARGV.
- The `explicitly_requested?` test, which returns true or false depending on
if a formula object is a member of `ARGV.formulae`, is now a method of
`Formula` objects.
- `FormulaInstaller` objects now execute the installation of dependencies
inside an `ARGV.filter_for_dependencies` block if the dependency was
`explicitly_requested?`.
Fixes Homebrew/homebrew#8668.
Closes Homebrew/homebrew#7724.
Diffstat (limited to 'Library/Homebrew/extend')
| -rw-r--r-- | Library/Homebrew/extend/ARGV.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index e46c0b038..9a86e86ec 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -96,6 +96,24 @@ module HomebrewArgvExtension Homebrew.help_s end + def filter_for_dependencies + # Clears some flags that affect installation, yields to a block, then + # restores to original state. + old_args = clone + + %w[ + --debug -d + --fresh + --interactive -i + --verbose -v + --HEAD + ].each {|flag| delete flag} + + yield + + replace old_args + end + private def downcased_unique_named |
