mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import rubygems 1.6.0 (released version @ 58d8a0b9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
86bb0af7ea
commit
25a9b62d45
73 changed files with 2408 additions and 719 deletions
|
@ -7,6 +7,7 @@
|
|||
require 'rubygems/command'
|
||||
require 'rubygems/installer'
|
||||
require 'rubygems/version_option'
|
||||
require 'rubygems/remote_fetcher'
|
||||
|
||||
class Gem::Commands::UnpackCommand < Gem::Command
|
||||
|
||||
|
@ -39,16 +40,6 @@ class Gem::Commands::UnpackCommand < Gem::Command
|
|||
"#{program_name} GEMNAME"
|
||||
end
|
||||
|
||||
def download dependency
|
||||
found = Gem::SpecFetcher.fetcher.fetch dependency
|
||||
|
||||
return if found.empty?
|
||||
|
||||
spec, source_uri = found.first
|
||||
|
||||
Gem::RemoteFetcher.fetcher.download spec, source_uri
|
||||
end
|
||||
|
||||
#--
|
||||
# TODO: allow, e.g., 'gem unpack rake-0.3.1'. Find a general solution for
|
||||
# this, so that it works for uninstall as well. (And check other commands
|
||||
|
@ -79,8 +70,9 @@ class Gem::Commands::UnpackCommand < Gem::Command
|
|||
# TODO: see comments in get_path() about general service.
|
||||
|
||||
def find_in_cache(filename)
|
||||
Gem.path.each do |gem_dir|
|
||||
this_path = File.join gem_dir, 'cache', filename
|
||||
|
||||
Gem.path.each do |path|
|
||||
this_path = Gem.cache_gem(filename, path)
|
||||
return this_path if File.exist? this_path
|
||||
end
|
||||
|
||||
|
@ -111,15 +103,17 @@ class Gem::Commands::UnpackCommand < Gem::Command
|
|||
|
||||
selected = specs.sort_by { |s| s.version }.last
|
||||
|
||||
return download(dependency) if selected.nil?
|
||||
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(selected.file_name)
|
||||
return download(dependency) unless path
|
||||
|
||||
path = find_in_cache selected.file_name
|
||||
|
||||
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless path
|
||||
|
||||
path
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue