From f97d8e3905f4ede7403be512df4aaeccc59147be Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Sat, 10 Feb 2018 09:05:06 +0000 Subject: [PATCH] diagnostic: implement cache size check --- Library/Homebrew/diagnostic.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index dbd6aa0c14..cc364eaaa4 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -835,6 +835,17 @@ module Homebrew EOS end + def check_for_large_cache + return unless HOMEBREW_CACHE.exist? + return if ENV["CI"] # CI can be expected to have a large cache. + cache_size = HOMEBREW_CACHE.disk_usage + return unless cache_size > 2_147_483_648 + <<~EOS + Your HOMEBREW_CACHE is using #{disk_usage_readable(cache_size)} of disk space. + You may wish to consider running `brew cleanup`. + EOS + end + def check_for_other_frameworks # Other frameworks that are known to cause problems when present frameworks_to_check = %w[