Class
The global rubygems pool, available via the rubygems.org API. Returns instances of APISpecification.
Attributes
Read
The Gem::Source
that gems are fetched from
Read
The corresponding place to fetch gems.
Class Methods
lib/rubygems/resolver/api_set.rb
View on GitHub
# File tmp/rubies/ruby-3.0.5/lib/rubygems/resolver/api_set.rb, line 29
def initialize(dep_uri = 'https://index.rubygems.org/info/')
super()
dep_uri = URI dep_uri unless URI === dep_uri
@dep_uri = dep_uri
@uri = dep_uri + '..'
@data = Hash.new {|h,k| h[k] = [] }
@source = Gem::Source.new @uri
@to_fetch = []
end
Creates a new APISet
that will retrieve gems from uri
using the RubyGems API URL dep_uri
which is described at guides.rubygems.org/rubygems-org-api
Instance Methods
lib/rubygems/resolver/api_set.rb
View on GitHub
# File tmp/rubies/ruby-3.0.5/lib/rubygems/resolver/api_set.rb, line 47
def find_all(req)
res = []
return res unless @remote
if @to_fetch.include?(req.name)
prefetch_now
end
versions(req.name).each do |ver|
if req.dependency.match? req.name, ver[:number], @prerelease
res << Gem::Resolver::APISpecification.new(self, ver)
end
end
res
end
Return an array of APISpecification objects matching DependencyRequest req
.
lib/rubygems/resolver/api_set.rb
View on GitHub
# File tmp/rubies/ruby-3.0.5/lib/rubygems/resolver/api_set.rb, line 122
def lines(str)
lines = str.split("\n")
header = lines.index("---")
header ? lines[header + 1..-1] : lines
end
No documentation available
lib/rubygems/resolver/api_set.rb
View on GitHub
# File tmp/rubies/ruby-3.0.5/lib/rubygems/resolver/api_set.rb, line 128
def parse_gem(string)
@gem_parser ||= GemParser.new
@gem_parser.parse(string)
end
No documentation available
lib/rubygems/resolver/api_set.rb
View on GitHub
# File tmp/rubies/ruby-3.0.5/lib/rubygems/resolver/api_set.rb, line 69
def prefetch(reqs)
return unless @remote
names = reqs.map {|r| r.dependency.name }
needed = names - @data.keys - @to_fetch
@to_fetch += needed
end
A hint run by the resolver to allow the Set
to fetch data for DependencyRequests reqs
.