Merge pull request #16193 from Bo98/smarter-gem-cleanup
cleanup: smarter gem handling
This commit is contained in:
commit
ae64469d5a
@ -480,11 +480,24 @@ module Homebrew
|
|||||||
|
|
||||||
return if portable_rubies_to_remove.empty?
|
return if portable_rubies_to_remove.empty?
|
||||||
|
|
||||||
bundler_path = vendor_dir/"bundle/ruby"
|
bundler_paths = (vendor_dir/"bundle/ruby").children.select do |child|
|
||||||
if dry_run?
|
basename = child.basename.to_s
|
||||||
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-nx", bundler_path).chomp
|
|
||||||
else
|
next false if basename == ".homebrew_gem_groups"
|
||||||
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-ffqx", bundler_path).chomp
|
next true unless child.directory?
|
||||||
|
|
||||||
|
[
|
||||||
|
"#{Version.new(portable_ruby_latest_version).major_minor}.0",
|
||||||
|
RbConfig::CONFIG["ruby_version"],
|
||||||
|
].uniq.exclude?(basename)
|
||||||
|
end
|
||||||
|
|
||||||
|
bundler_paths.each do |bundler_path|
|
||||||
|
if dry_run?
|
||||||
|
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-nx", bundler_path).chomp
|
||||||
|
else
|
||||||
|
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-ffqx", bundler_path).chomp
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
portable_rubies_to_remove.each do |portable_ruby|
|
portable_rubies_to_remove.each do |portable_ruby|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user