mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cleanup: fix portable ruby bundler removal logic.
Need to ensure portable rubies are removed last and pass more paramaters to git clean.
This commit is contained in:
parent
d27c5fb2cb
commit
f59c596e4b
@ -347,25 +347,26 @@ module Homebrew
|
|||||||
|
|
||||||
portable_ruby_path = vendor_path/"portable-ruby"
|
portable_ruby_path = vendor_path/"portable-ruby"
|
||||||
portable_ruby_glob = "#{portable_ruby_path}/*.*"
|
portable_ruby_glob = "#{portable_ruby_path}/*.*"
|
||||||
|
portable_rubies_to_remove = []
|
||||||
Pathname.glob(portable_ruby_glob).each do |path|
|
Pathname.glob(portable_ruby_glob).each do |path|
|
||||||
next if !use_system_ruby && portable_ruby_version == path.basename.to_s
|
next if !use_system_ruby && portable_ruby_version == path.basename.to_s
|
||||||
|
|
||||||
if dry_run?
|
portable_rubies_to_remove << path
|
||||||
puts "Would remove: #{path} (#{path.abv})"
|
puts "Would remove: #{path} (#{path.abv})" if dry_run?
|
||||||
else
|
|
||||||
FileUtils.rm_rf path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless Dir.glob(portable_ruby_glob).empty?
|
return if portable_rubies_to_remove.empty?
|
||||||
return unless portable_ruby_path.exist?
|
|
||||||
|
|
||||||
bundler_path = vendor_path/"bundle/ruby"
|
bundler_path = vendor_path/"bundle/ruby"
|
||||||
if dry_run?
|
if dry_run?
|
||||||
puts "Would remove:\n#{Utils.popen_read("git", "clean", "-xnf", bundler_path)}"
|
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-nx", bundler_path).chomp
|
||||||
else
|
else
|
||||||
safe_system "git", "clean", "-xf", bundler_path
|
puts Utils.popen_read("git", "-C", HOMEBREW_REPOSITORY, "clean", "-ffqx", bundler_path).chomp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return if dry_run?
|
||||||
|
|
||||||
|
FileUtils.rm_rf portable_rubies_to_remove
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup_old_cache_db
|
def cleanup_old_cache_db
|
||||||
|
Loading…
x
Reference in New Issue
Block a user