cleanup: use cleanup_path
more consistently
`cleanup_path` already handles the dry-run logic, and also includes those paths in the summary of space freed by `brew cleanup`. Before this change: ❯ brew cleanup --dry-run Would remove: /Users/carlocab/Library/Caches/Homebrew/bootsnap (2,401 files, 41.9MB) After this change: ❯ brew cleanup --dry-run Would remove: /Users/carlocab/Library/Caches/Homebrew/bootsnap (2,401 files, 41.9MB) ==> This operation would free approximately 41.9MB of disk space.
This commit is contained in:
parent
fcb30c1ead
commit
7384bd2b3f
@ -428,7 +428,6 @@ module Homebrew
|
|||||||
next if !use_system_ruby && portable_ruby_latest_version == path.basename.to_s
|
next if !use_system_ruby && portable_ruby_latest_version == path.basename.to_s
|
||||||
|
|
||||||
portable_rubies_to_remove << path
|
portable_rubies_to_remove << path
|
||||||
puts "Would remove: #{path} (#{path.abv})" if dry_run?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return if portable_rubies_to_remove.empty?
|
return if portable_rubies_to_remove.empty?
|
||||||
@ -440,20 +439,16 @@ module Homebrew
|
|||||||
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-ffqx", bundler_path).chomp
|
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-ffqx", bundler_path).chomp
|
||||||
end
|
end
|
||||||
|
|
||||||
return if dry_run?
|
portable_rubies_to_remove.each do |portable_ruby|
|
||||||
|
cleanup_path(portable_ruby) { portable_ruby.rmtree }
|
||||||
FileUtils.rm_rf portable_rubies_to_remove
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup_bootsnap
|
def cleanup_bootsnap
|
||||||
bootsnap = cache/"bootsnap"
|
bootsnap = cache/"bootsnap"
|
||||||
return unless bootsnap.exist?
|
return unless bootsnap.exist?
|
||||||
|
|
||||||
if dry_run?
|
cleanup_path(bootsnap) { bootsnap.rmtree }
|
||||||
puts "Would remove: #{bootsnap} (#{bootsnap.abv})"
|
|
||||||
else
|
|
||||||
FileUtils.rm_rf bootsnap
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup_cache_db(rack = nil)
|
def cleanup_cache_db(rack = nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user