diff options
| -rw-r--r-- | Library/Homebrew/cmd/cleanup.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 732883e1a..456d28d29 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -10,6 +10,7 @@ module Homebrew extend self if ARGV.named.empty? cleanup_cellar cleanup_cache + cleanup_logs unless ARGV.dry_run? cleanup_lockfiles rm_DS_Store @@ -19,6 +20,20 @@ module Homebrew extend self end end + def cleanup_logs + time = Time.now - 2 * 7 * 24 * 60 * 60 # two weeks + HOMEBREW_LOGS.subdirs.each do |dir| + if dir.mtime < time + if ARGV.dry_run? + puts "Would remove: #{dir}" + else + puts "Removing: #{dir}..." + dir.rmtree + end + end + end + end + def cleanup_cellar HOMEBREW_CELLAR.subdirs.each do |rack| begin |
