mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rubygems*: Updated to RubyGems 2.0
* test/rubygems*: ditto. * common.mk (prelude): Updated for RubyGems 2.0 source rearrangement. * tool/change_maker.rb: Allow invalid UTF-8 characters in source files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3f606b7063
commit
9694bb8cac
214 changed files with 14049 additions and 7085 deletions
|
@ -24,11 +24,17 @@ class Gem::FakeFetcher
|
|||
|
||||
attr_reader :data
|
||||
attr_reader :last_request
|
||||
attr_reader :api_endpoints
|
||||
attr_accessor :paths
|
||||
|
||||
def initialize
|
||||
@data = {}
|
||||
@paths = []
|
||||
@api_endpoints = {}
|
||||
end
|
||||
|
||||
def api_endpoint(uri)
|
||||
@api_endpoints[uri] || uri
|
||||
end
|
||||
|
||||
def find_data(path)
|
||||
|
@ -57,6 +63,15 @@ class Gem::FakeFetcher
|
|||
end
|
||||
end
|
||||
|
||||
def cache_update_path uri, path = nil
|
||||
if data = fetch_path(uri)
|
||||
open(path, 'wb') { |io| io.write data } if path
|
||||
data
|
||||
else
|
||||
Gem.read_binary(path) if path
|
||||
end
|
||||
end
|
||||
|
||||
# Thanks, FakeWeb!
|
||||
def open_uri_or_path(path)
|
||||
data = find_data(path)
|
||||
|
@ -98,7 +113,13 @@ class Gem::FakeFetcher
|
|||
|
||||
def download spec, source_uri, install_dir = Gem.dir
|
||||
name = File.basename spec.cache_file
|
||||
path = File.join install_dir, "cache", name
|
||||
path = if Dir.pwd == install_dir then # see fetch_command
|
||||
install_dir
|
||||
else
|
||||
File.join install_dir, "cache"
|
||||
end
|
||||
|
||||
path = File.join path, name
|
||||
|
||||
Gem.ensure_gem_subdirectories install_dir
|
||||
|
||||
|
@ -114,14 +135,13 @@ class Gem::FakeFetcher
|
|||
end
|
||||
|
||||
def download_to_cache dependency
|
||||
found = Gem::SpecFetcher.fetcher.fetch dependency, true, true,
|
||||
dependency.prerelease?
|
||||
found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
|
||||
|
||||
return if found.empty?
|
||||
|
||||
spec, source_uri = found.first
|
||||
spec, source = found.first
|
||||
|
||||
download spec, source_uri
|
||||
download spec, source.uri.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue