Merge pull request #4778 from DomT4/gocache_follow_up
cleanup: fix go_cache cleanup
This commit is contained in:
commit
794fe5d21d
@ -39,6 +39,12 @@ module CleanupRefinement
|
|||||||
directory? && %w[go_cache glide_home java_cache npm_cache gclient_cache].include?(basename.to_s)
|
directory? && %w[go_cache glide_home java_cache npm_cache gclient_cache].include?(basename.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def go_cache_directory?
|
||||||
|
# Go makes its cache contents read-only to ensure cache integrity,
|
||||||
|
# which makes sense but is something we need to undo for cleanup.
|
||||||
|
directory? && %w[go_cache].include?(basename.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
def prune?(days)
|
def prune?(days)
|
||||||
return false unless days
|
return false unless days
|
||||||
return true if days.zero?
|
return true if days.zero?
|
||||||
@ -228,6 +234,7 @@ module Homebrew
|
|||||||
entries ||= [cache, cache/"Cask"].select(&:directory?).flat_map(&:children)
|
entries ||= [cache, cache/"Cask"].select(&:directory?).flat_map(&:children)
|
||||||
|
|
||||||
entries.each do |path|
|
entries.each do |path|
|
||||||
|
FileUtils.chmod_R 0755, path if path.go_cache_directory? && !dry_run?
|
||||||
next cleanup_path(path) { path.unlink } if path.incomplete?
|
next cleanup_path(path) { path.unlink } if path.incomplete?
|
||||||
next cleanup_path(path) { FileUtils.rm_rf path } if path.nested_cache?
|
next cleanup_path(path) { FileUtils.rm_rf path } if path.nested_cache?
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user