Skip to content

Commit

Permalink
Extract a remove_file_list helper
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed May 6, 2020
1 parent 6ddbf5b commit 8cc6087
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/rubygems/commands/setup_command.rb
Expand Up @@ -550,14 +550,7 @@ def remove_old_lib_files(lib_dir)
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

Expand Down Expand Up @@ -644,6 +637,17 @@ def install_file(file, dest_dir)
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
Expand Down

0 comments on commit 8cc6087

Please sign in to comment.