diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2021-11-04 22:13:29 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-11-05 07:23:35 +0900 |
commit | 5e855be86be19240257e444a09a95e1ddb355043 (patch) | |
tree | afa60f8739f651923afa32b993ff7718208d4d48 /lib/rubygems | |
parent | 70cbca48b8df97ba75e665e147f6ad8bb39e752d (diff) | |
download | ruby-5e855be86be19240257e444a09a95e1ddb355043.tar.gz |
[rubygems/rubygems] More refactoring of `--destdir` handling
https://github.com/rubygems/rubygems/commit/f42c2025ed
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 98b4b162bc..e3e313c6a7 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: 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: 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: 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}" 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 |