2015-12-29 12:57:48 +01:00
|
|
|
require "cleanup"
|
2015-11-17 16:51:56 +05:30
|
|
|
require "utils"
|
2010-09-11 20:22:54 +01:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2010-09-11 20:22:54 +01:00
|
|
|
def cleanup
|
|
|
|
if ARGV.named.empty?
|
2015-12-29 12:57:48 +01:00
|
|
|
Cleanup.cleanup
|
2010-09-11 20:22:54 +01:00
|
|
|
else
|
2015-12-29 12:57:48 +01:00
|
|
|
ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f }
|
2013-05-15 12:45:35 -05:00
|
|
|
end
|
2015-11-17 16:51:56 +05:30
|
|
|
|
2015-12-29 12:57:48 +01:00
|
|
|
if Cleanup.disk_cleanup_size > 0
|
|
|
|
disk_space = disk_usage_readable(Cleanup.disk_cleanup_size)
|
2015-11-17 16:51:56 +05:30
|
|
|
if ARGV.dry_run?
|
|
|
|
ohai "This operation would free approximately #{disk_space} of disk space."
|
|
|
|
else
|
|
|
|
ohai "This operation has freed approximately #{disk_space} of disk space."
|
|
|
|
end
|
|
|
|
end
|
2013-05-15 12:45:35 -05:00
|
|
|
end
|
2012-08-10 16:33:47 -04:00
|
|
|
end
|