From e3ed1ccb15a1169aaad42a4c9e8f59db198f5434 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 17 May 2015 21:22:29 +0800 Subject: [PATCH] uninstall: load formula from rack Closes Homebrew/homebrew#39524. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/uninstall.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index f6a4cd684c..22cafd9ddf 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -11,9 +11,8 @@ module Homebrew puts "Uninstalling #{keg}... (#{keg.abv})" keg.unlink keg.uninstall - rm_pin keg.name - - rack = keg/".." + rack = keg.rack + rm_pin rack if rack.directory? versions = rack.subdirs.map(&:basename) verb = versions.length == 1 ? "is" : "are" @@ -36,7 +35,7 @@ module Homebrew end end - rm_pin name + rm_pin rack end end rescue MultipleVersionsInstalledError => e @@ -44,7 +43,7 @@ module Homebrew puts "Use `brew remove --force #{e.name}` to remove all versions." end - def rm_pin name - Formulary.factory(name).unpin rescue nil + def rm_pin rack + Formulary.from_rack(rack).unpin rescue nil end end