diff options
| author | Charlie Sharpsteen | 2011-11-14 10:44:18 -0800 |
|---|---|---|
| committer | Charlie Sharpsteen | 2011-11-14 10:44:18 -0800 |
| commit | 16b8267f4a77a5e1bb8307636e2e5510a2d1886c (patch) | |
| tree | 872e73e482c926298250966ab6b24580c6fc9269 /Library/Homebrew | |
| parent | e59cc08809239e6e752c26113321b63822525c8e (diff) | |
| download | homebrew-16b8267f4a77a5e1bb8307636e2e5510a2d1886c.tar.bz2 | |
Add --fresh option to brew install
When invoked, this option will ensure brew doesn't re-use any options from
previous installs of a formula.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 689c4ff68..97292d984 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -245,8 +245,9 @@ class FormulaInstaller # This method gives us a chance to pre-process command line arguments before the # installer forks and `Formula.install` kicks in. def filtered_args - # Did the user actually pass the formula this installer is considering on - # the command line? + # Returns true if the formula attached to this installer was explicitly + # passed on the command line by the user as opposed to being automatically + # added to satisfy a dependency. def explicitly_requested? # `ARGV.formulae` will throw an exception if it comes up with an empty # list. @@ -257,13 +258,23 @@ class FormulaInstaller return false if ARGV.named.empty? ARGV.formulae.include? f end - previous_install = Tab.for_formula f args = ARGV.clone - args.concat previous_install.used_options - args.uniq! # Just in case some dupes were added - %w[--HEAD --verbose -v --debug -d --interactive -i].each {|f| args.delete f} unless explicitly_requested? + %w[ + --debug -d + --fresh + --HEAD + --interactive -i + --verbose -v + ].each {|flag| args.delete flag} unless explicitly_requested? + + unless args.include? '--fresh' + previous_install = Tab.for_formula f + args.concat previous_install.used_options + end + + args.uniq! # Just in case some dupes slipped by return args end |
