diff options
| author | Jack Nagel | 2014-05-14 12:12:30 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-05-14 14:36:34 -0500 |
| commit | d6483c963a75fa61eede097078bd887cf377abae (patch) | |
| tree | 5fe039ddd31cf7a42956b6dab417933476a6b382 | |
| parent | d1f15e967b51ea9eb7538551ab39f4039b44239b (diff) | |
| download | brew-d6483c963a75fa61eede097078bd887cf377abae.tar.bz2 | |
cleanup: prune old build logs
Closes Homebrew/homebrew#29231.
| -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 |
