diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2021-11-05 20:57:41 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-05 05:47:46 +0900 |
commit | a72aecac3ae81e955997e4d789504e60196e2697 (patch) | |
tree | 58b5704ade519a5fa10c35bc613529bed43d69dc /lib | |
parent | 9dc76e102ec00bb93b7aafaaa1309ca426d02595 (diff) |
[rubygems/rubygems] Don't write outside of destdir when regenerating plugins
https://github.com/rubygems/rubygems/commit/141ef4cb9a
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/commands/pristine_command.rb | 10 | ||||
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index 41547ce73b..13979b0a59 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -50,6 +50,11 @@ class Gem::Commands::PristineCommand < Gem::Command options[:env_shebang] = value end + add_option('-i', '--install-dir DIR', + 'Gem repository to get binstubs and plugins installed') do |value, options| + options[:install_dir] = File.expand_path(value) + end + add_option('-n', '--bindir DIR', 'Directory where executables are', 'located') do |value, options| @@ -163,11 +168,12 @@ extensions will be restored. end bin_dir = options[:bin_dir] if options[:bin_dir] + install_dir = options[:install_dir] if options[:install_dir] installer_options = { :wrappers => true, :force => true, - :install_dir => spec.base_dir, + :install_dir => install_dir || spec.base_dir, :env_shebang => env_shebang, :build_args => spec.build_args, :bin_dir => bin_dir, @@ -177,7 +183,7 @@ extensions will be restored. installer = Gem::Installer.for_spec(spec, installer_options) installer.generate_bin elsif options[:only_plugins] - installer = Gem::Installer.for_spec(spec) + installer = Gem::Installer.for_spec(spec, installer_options) installer.generate_plugins else installer = Gem::Installer.at(gem, installer_options) diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index adceb62dce..ed1fcaa4b8 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -610,6 +610,7 @@ abort "#{deprecation_message}" args = %w[--all --only-plugins --silent] args << "--bindir=#{bindir}" + args << "--install-dir=#{default_dir}" command = Gem::Commands::PristineCommand.new command.invoke(*args) |