class Bundler::Bundle
def cleanup(valid, options)
def cleanup(valid, options) to_delete = gems to_delete.delete_if do |spec| valid.any? { |other| spec.name == other.name && spec.version == other.version } end valid_executables = valid.map { |s| s.executables }.flatten.compact to_delete.each do |spec| Bundler.logger.info "Deleting gem: #{spec.name} (#{spec.version})" cleanup_spec(spec) # Cleanup the bin directory spec.executables.each do |bin| next if valid_executables.include?(bin) Bundler.logger.info "Deleting bin file: #{bin}" FileUtils.rm_rf(bindir.join(bin)) end end end