From 64e89713dab469a162d042fbc5c3595116937e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 27 Apr 2020 22:23:16 +0200 Subject: [rubygems/rubygems] Extract a `remove_file_list` helper https://github.com/rubygems/rubygems/commit/8cc6087590 --- lib/rubygems/commands/setup_command.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 37a305eb3a..5563b0e105 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -550,14 +550,7 @@ abort "#{deprecation_message}" file.start_with? 'defaults' end - Dir.chdir old_lib_dir do - to_remove.each do |file| - FileUtils.rm_f file - - warn "unable to remove old file #{file} please remove it by hand" if - File.exist? file - end - end + remove_file_list(to_remove, old_lib_dir) end end @@ -644,6 +637,17 @@ abort "#{deprecation_message}" install file, dest_file, :mode => options[:data_mode] || 0644 end + def remove_file_list(files, dir) + Dir.chdir dir do + files.each do |file| + FileUtils.rm_f file + + warn "unable to remove old file #{file} please remove it by hand" if + File.exist? file + end + end + end + def target_bin_path(bin_dir, bin_file) bin_file_formatted = if options[:format_executable] Gem.default_exec_format % bin_file -- cgit v1.2.3