ruby-changes:69592
From: David <ko1@a...>
Date: Fri, 5 Nov 2021 07:23:51 +0900 (JST)
Subject: [ruby-changes:69592] 5e855be86b (master): [rubygems/rubygems] More refactoring of `--destdir` handling
https://git.ruby-lang.org/ruby.git/commit/?id=5e855be86b From 5e855be86be19240257e444a09a95e1ddb355043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Thu, 4 Nov 2021 22:13:29 +0100 Subject: [rubygems/rubygems] More refactoring of `--destdir` handling https://github.com/rubygems/rubygems/commit/f42c2025ed --- lib/rubygems/commands/setup_command.rb | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 98b4b162bc8..e3e313c6a78 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -437,7 +437,6 @@ By default, this RubyGems will install gem as: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L437 end def generate_default_man_dir - install_destdir = options[:destdir] prefix = options[:prefix] if prefix.empty? @@ -447,15 +446,10 @@ By default, this RubyGems will install gem as: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L446 man_dir = File.join prefix, 'man' end - unless install_destdir.empty? - man_dir = prepend_destdir(man_dir) - end - - man_dir + prepend_destdir_if_present(man_dir) end def generate_default_dirs - install_destdir = options[:destdir] prefix = options[:prefix] site_or_vendor = options[:site_or_vendor] @@ -467,12 +461,7 @@ By default, this RubyGems will install gem as: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L461 bin_dir = File.join prefix, 'bin' end - unless install_destdir.empty? - lib_dir = prepend_destdir(lib_dir) - bin_dir = prepend_destdir(bin_dir) - end - - [lib_dir, bin_dir] + [prepend_destdir_if_present(lib_dir), prepend_destdir_if_present(bin_dir)] end def files_in(dir) @@ -618,6 +607,13 @@ abort "#{deprecation_message}" https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L607 private + def prepend_destdir_if_present(path) + destdir = options[:destdir] + return path if destdir.empty? + + prepend_destdir(path) + end + def prepend_destdir(path) File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, '')) end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/