Merge pull request #16193 from Bo98/smarter-gem-cleanup
cleanup: smarter gem handling
This commit is contained in:
		
						commit
						ae64469d5a
					
				@ -480,12 +480,25 @@ module Homebrew
 | 
			
		||||
 | 
			
		||||
      return if portable_rubies_to_remove.empty?
 | 
			
		||||
 | 
			
		||||
      bundler_path = vendor_dir/"bundle/ruby"
 | 
			
		||||
      bundler_paths = (vendor_dir/"bundle/ruby").children.select do |child|
 | 
			
		||||
        basename = child.basename.to_s
 | 
			
		||||
 | 
			
		||||
        next false if basename == ".homebrew_gem_groups"
 | 
			
		||||
        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
 | 
			
		||||
 | 
			
		||||
      portable_rubies_to_remove.each do |portable_ruby|
 | 
			
		||||
        cleanup_path(portable_ruby) { portable_ruby.rmtree }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user