Check if Cellar and Cache exist before cleaning.

This commit is contained in:
Mike McQuaid 2012-12-16 19:14:27 +00:00
parent 7d61bfe88f
commit 7ed19d4c62

View File

@ -7,6 +7,7 @@ module Homebrew extend self
def cleanup
if ARGV.named.empty?
if HOMEBREW_CELLAR.directory?
HOMEBREW_CELLAR.children.each do |rack|
begin
cleanup_formula rack.basename.to_s if rack.directory?
@ -15,6 +16,7 @@ module Homebrew extend self
# instead of core formulae.
end
end
end
clean_cache
# seems like a good time to do some additional cleanup
unless ARGV.dry_run?
@ -54,6 +56,7 @@ module Homebrew extend self
end
def clean_cache
return unless HOMEBREW_CACHE.directory?
HOMEBREW_CACHE.children.each do |pn|
next unless pn.file?
version = pn.version