cleanup: prune old build logs

Closes Homebrew/homebrew#29231.
This commit is contained in:
Jack Nagel 2014-05-14 12:12:30 -05:00
parent d1f15e967b
commit d6483c963a

View File

@ -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