aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/source.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/source.rb')
-rw-r--r--lib/rubygems/source.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index 394ea6cf22..bcf814b010 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -52,6 +52,24 @@ class Gem::Source
alias_method :eql?, :==
+ ##
+ # Returns a Set that can fetch specifications from this source.
+
+ def dependency_resolver_set # :nodoc:
+ uri = api_uri
+
+ bundler_api_uri = api_uri + './api/v1/dependencies'
+
+ begin
+ fetcher = Gem::RemoteFetcher.fetcher
+ fetcher.fetch_path bundler_api_uri, nil, true
+ rescue Gem::RemoteFetcher::FetchError
+ Gem::DependencyResolver::IndexSet.new self
+ else
+ Gem::DependencyResolver::APISet.new bundler_api_uri
+ end
+ end
+
def hash
@uri.hash
end