diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-04-27 22:23:16 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-08 14:13:29 +0900 |
commit | 64e89713dab469a162d042fbc5c3595116937e8d (patch) | |
tree | f99eed359e973e88cdbcd012ebed747d547be5b0 | |
parent | c74d306b22606da28669264f8c449fe697c1fd3f (diff) |
[rubygems/rubygems] Extract a `remove_file_list` helper
https://github.com/rubygems/rubygems/commit/8cc6087590
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3092
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 20 |
1 files 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 |