diff options
| author | Alyssa Ross | 2016-09-28 20:55:24 +0100 |
|---|---|---|
| committer | Alyssa Ross | 2016-10-25 22:34:35 +0100 |
| commit | 7792acda52c9c3b810959ac2c20066d3cf1fbe15 (patch) | |
| tree | 043c5240b396e4bf12210c81f25e6a8367107855 /Library/Homebrew/cmd | |
| parent | 13d705c5e7683ccfdb415642013daa34b6a0f1e5 (diff) | |
| download | brew-7792acda52c9c3b810959ac2c20066d3cf1fbe15.tar.bz2 | |
uninstall: allow dependent checks to be by-passed
Dependent can be bypassed with `--ignore-dependencies`.
This is now the default for `HOMEBREW_DEVELOPER`s.
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/uninstall.rb | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index 5ab9f116f..b9e50db23 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -23,17 +23,10 @@ module Homebrew ARGV.kegs.group_by(&:rack) end - kegs = kegs_by_rack.values.flatten(1) - - kegs.each do |keg| - dependents = keg.installed_dependents - kegs - if dependents.any? - dependents_output = dependents.map { |k| "#{k.name} #{k.version}" }.join(", ") - conjugation = dependents.count == 1 ? "is" : "are" - ofail "Refusing to uninstall #{keg} because it is required by #{dependents_output}, which #{conjugation} currently installed." - # puts "You can override this and force removal with `brew uninstall --force #{keg.name}`." - next - end + # --ignore-dependencies, to be consistent with install + unless ARGV.include?("--ignore-dependencies") || ARGV.homebrew_developer? + kegs = kegs_by_rack.values.flatten(1) + return if check_for_dependents kegs end kegs_by_rack.each do |rack, kegs| @@ -81,6 +74,20 @@ module Homebrew end end + def check_for_dependents(kegs) + kegs.each do |keg| + dependents = keg.installed_dependents - kegs + if dependents.any? + dependents_output = dependents.map { |k| "#{k.name} #{k.version}" }.join(", ") + conjugation = dependents.count == 1 ? "is" : "are" + ofail "Refusing to uninstall #{keg} because it is required by #{dependents_output}, which #{conjugation} currently installed." + puts "You can override this and force removal with `brew uninstall --ignore-dependencies #{keg.name}`." + return true + end + end + false + end + def rm_pin(rack) Formulary.from_rack(rack).unpin rescue |
