End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::Commands::UnpackCommand#get_path
get_path(dependency)
lib/rubygems/commands/unpack_command.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems/commands/unpack_command.rb, line 154
def get_path(dependency)
return dependency.name if dependency.name =~ /\.gem$/i
specs = dependency.matching_specs
selected = specs.max_by {|s| s.version }
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless
selected
return unless dependency.name =~ /^#{selected.name}$/i
# We expect to find (basename).gem in the 'cache' directory. Furthermore,
# the name match must be exact (ignoring case).
path = find_in_cache File.basename selected.cache_file
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless path
path
end
Return the full path to the cached gem file matching the given name and version requirement. Returns ‘nil’ if no match.
Example:
Example
get_path 'rake', '> 0.4' # "/usr/lib/ruby/gems/1.8/cache/rake-0.4.2.gem" get_path 'rake', '< 0.1' # nil get_path 'rak' # nil (exact name required)