From 6868bf0d6ece15d322b1766bf7ff047d4b5e7dcc Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 6 Mar 2012 13:43:41 +0000 Subject: Don't require formula files for `brew rm --force` In fixing this I also made it so that ARGV.kegs will return the LinkedKeg if the symlink is set. Which is almost always is. This neatly avoids most multiple-kegs issues. Fixes Homebrew/homebrew#10685.--- Library/Homebrew/cmd/uninstall.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index 6f0025c48..cddb8ac65 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -1,27 +1,34 @@ require 'keg' +require 'formula' module Homebrew extend self def uninstall raise KegUnspecifiedError if ARGV.named.empty? - unless ARGV.force? + if not ARGV.force? ARGV.kegs.each do |keg| puts "Uninstalling #{keg}..." keg.unlink keg.uninstall end else - ARGV.formulae.each do |f| - if f.rack.directory? - puts "Uninstalling #{f}..." - f.rack.children.each do |keg| + ARGV.named.each do |name| + name = Formula.canonical_name(name) + + # FIXME canonical_name is insane + raise "Invalid usage" if name.include? '/' + + rack = HOMEBREW_CELLAR/name + if rack.directory? + puts "Uninstalling #{name}..." + rack.children.each do |keg| if keg.directory? keg = Keg.new(keg) keg.unlink keg.rmtree end end - f.rack.rmtree + rack.rmtree end end end -- cgit v1.2.3