cleanup: do cleanup even without a Cellar.

This commit is contained in:
Mike McQuaid 2015-08-13 10:31:37 +01:00
parent e49a043401
commit 04b350dce5

View File

@ -4,10 +4,6 @@ require "bottles"
module Homebrew
def cleanup
# individual cleanup_ methods should also check for the existence of the
# appropriate directories before assuming they exist
return unless HOMEBREW_CELLAR.directory?
if ARGV.named.empty?
cleanup_cellar
cleanup_cache
@ -35,6 +31,7 @@ module Homebrew
end
def cleanup_cellar
return unless HOMEBREW_CELLAR.directory?
HOMEBREW_CELLAR.subdirs.each do |rack|
begin
cleanup_formula Formulary.from_rack(rack)
@ -92,6 +89,8 @@ module Homebrew
next unless version
next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1])
next unless HOMEBREW_CELLAR.directory?
begin
f = Formulary.from_rack(HOMEBREW_CELLAR/name)
rescue FormulaUnavailableError, TapFormulaAmbiguityError