brew/Library/Homebrew/cmd/uninstall.rb
Dave Bayer 84eae3c425 Fix uninstall.rb brew remove --force "Directory not empty" error
Finder activity such as moving the position of an icon can create an unexpected
.DS_Store file in a Cellar directory. This causes `brew remove --force` to throw
an error that is reported as

Error: Directory not empty - /usr/local/Cellar/<formula>

This fix avoids that error, by calling rmtree rather than rmdir.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-08-22 20:26:53 -07:00

32 lines
708 B
Ruby

require 'keg'
module Homebrew extend self
def uninstall
unless ARGV.force?
ARGV.kegs.each do |keg|
puts "Uninstalling #{keg}..."
keg.unlink
keg.uninstall
end
else
ARGV.formulae.each do |f|
rack = f.prefix.parent
if rack.directory?
puts "Uninstalling #{f}..."
rack.children.each do |keg|
if keg.directory?
keg = Keg.new(keg)
keg.unlink
keg.rmtree
end
end
rack.rmtree
end
end
end
rescue MultipleVersionsInstalledError => e
onoe e
puts "Use `brew remove --force #{e.name}` to remove all versions."
end
end