# File lib/rubygems/gem_commands.rb, line 1438 def get_path(gemname, version_req) return gemname if gemname =~ /\.gem$/i specs = SourceIndex.from_installed_gems.search(gemname, version_req) selected = specs.sort_by { |s| s.version }.last return nil if selected.nil? # We expect to find (basename).gem in the 'cache' directory. # Furthermore, the name match must be exact (ignoring case). if gemname =~ /^#{selected.name}$/i filename = selected.full_name + '.gem' return File.join(Gem.dir, 'cache', filename) else return nil end end