diff options
author | David Rodriguez <[email protected]> | 2024-05-09 17:51:44 +0200 |
---|---|---|
committer | git <[email protected]> | 2024-05-16 13:34:33 +0000 |
commit | c55c11d7d5813683dde3eb7791bc2a9d5d39556d () | |
tree | d9367638dc28b6ffd3d9dd56b4d652fe667f517a /lib | |
parent | 35c5c7edb9c77398de65cef0636a3cdd2e539bb5 (diff) |
[rubygems/rubygems] Fix binstubs sometimes not getting regenerated when `--destdir` is given
This was only working for gems also installed in the default gem home. https://.com/rubygems/rubygems/commit/47df02dbd9
-rw-r--r-- | lib/rubygems/commands/pristine_command.rb | 15 | ||||
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/installer.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 22 | ||||
-rw-r--r-- | lib/rubygems/specification_record.rb | 32 |
5 files changed, 47 insertions, 26 deletions
@@ -57,7 +57,7 @@ class Gem::Commands::PristineCommand < Gem::Command 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 @@ -103,21 +103,25 @@ extensions will be restored. end def execute specs = if options[:all] - Gem::Specification.map # `--extensions` must be explicitly given to pristine only gems # with extensions. elsif options[:extensions_set] && options[:extensions] && options[:args].empty? - Gem::Specification.select do |spec| spec.extensions && !spec.extensions.empty? end elsif options[:only_missing_extensions] - Gem::Specification.select(&:missing_extensions?) else get_all_gem_names.sort.map do |gem_name| - Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse end.flatten end @@ -176,7 +180,6 @@ 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, @@ -585,6 +585,8 @@ abort "#{deprecation_message}" args = %w[--all --only-executables --silent] args << "--bindir=#{bindir}" if options[:env_shebang] args << "--env-shebang" end @@ -344,7 +344,7 @@ class Gem::Installer say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil? - Gem::Specification.add_spec(spec) load_plugin @@ -925,31 +925,15 @@ class Gem::Specification < Gem::BasicSpecification # Enumerate every known spec. See ::dirs= and ::add_spec to set the list of # specs. - def self.each - return enum_for(:each) unless block_given? - - _all.each do |x| - yield x - end end ## # Returns every spec that matches +name+ and optional +requirements+. def self.find_all_by_name(name, *requirements) - req = Gem::Requirement.create(*requirements) - env_req = Gem.env_requirement(name) - - matches = stubs_for(name).find_all do |spec| - req.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version) - end.map(&:to_spec) - - if name == "bundler" && !req.specific? - require_relative "bundler_version_finder" - Gem::BundlerVersionFinder.prioritize!(matches) - end - - matches end ## @@ -111,6 +111,38 @@ module Gem all.map(&:full_name) end ## # Return the best specification in the record that contains the file matching +path+. |