summaryrefslogtreecommitdiff
path: root/lib/rubygems/source.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/source.rb')
-rw-r--r--lib/rubygems/source.rb29
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index 7f38b6325f..5530c2ce32 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -16,7 +16,7 @@ class Gem::Source
:released => 'specs',
:latest => 'latest_specs',
:prerelease => 'prerelease_specs',
- }
+ }.freeze
##
# The URI this source will fetch gems from.
@@ -36,15 +36,6 @@ class Gem::Source
end
@uri = uri
- @api_uri = nil
- end
-
- ##
- # Use an SRV record on the host to look up the true endpoint for the index.
-
- def api_uri # :nodoc:
- require 'rubygems/remote_fetcher'
- @api_uri ||= Gem::RemoteFetcher.fetcher.api_endpoint uri
end
##
@@ -87,9 +78,9 @@ class Gem::Source
# Returns a Set that can fetch specifications from this source.
def dependency_resolver_set # :nodoc:
- return Gem::Resolver::IndexSet.new self if 'file' == api_uri.scheme
+ return Gem::Resolver::IndexSet.new self if 'file' == uri.scheme
- bundler_api_uri = api_uri + './api/v1/dependencies'
+ bundler_api_uri = uri + './api/v1/dependencies'
begin
fetcher = Gem::RemoteFetcher.fetcher
@@ -140,9 +131,9 @@ class Gem::Source
spec_file_name = name_tuple.spec_name
- uri = api_uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
+ source_uri = uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
- cache_dir = cache_dir uri
+ cache_dir = cache_dir source_uri
local_spec = File.join cache_dir, spec_file_name
@@ -152,9 +143,9 @@ class Gem::Source
return spec if spec
end
- uri.path << '.rz'
+ source_uri.path << '.rz'
- spec = fetcher.fetch_path uri
+ spec = fetcher.fetch_path source_uri
spec = Gem::Util.inflate spec
if update_cache? then
@@ -184,7 +175,7 @@ class Gem::Source
file = FILES[type]
fetcher = Gem::RemoteFetcher.fetcher
file_name = "#{file}.#{Gem.marshal_version}"
- spec_path = api_uri + "#{file_name}.gz"
+ spec_path = uri + "#{file_name}.gz"
cache_dir = cache_dir spec_path
local_file = File.join(cache_dir, file_name)
retried = false
@@ -212,7 +203,7 @@ class Gem::Source
def download(spec, dir=Dir.pwd)
fetcher = Gem::RemoteFetcher.fetcher
- fetcher.download spec, api_uri.to_s, dir
+ fetcher.download spec, uri.to_s, dir
end
def pretty_print q # :nodoc:
@@ -220,7 +211,7 @@ class Gem::Source
q.breakable
q.text @uri.to_s
- if api = api_uri
+ if api = uri
q.breakable
q.text 'API URI: '
q.text api.to_s