class Bundler::Settings::Mirrors
will be used to probe the mirror address to validate that the mirror replies.
@param prober [Prober object, nil] by default a TCPSocketProbe, this object
Class used to build the mirror set and then find a mirror for a given URI
def each
def each @mirrors.each do |k, v| yield k, v.uri.to_s end end
def fetch_valid_mirror_for(uri)
def fetch_valid_mirror_for(uri) downcased = uri.to_s.downcase mirror = @mirrors[downcased] || @mirrors[Gem::URI(downcased).host] || Mirror.new(uri) mirror.validate!(@prober) mirror = Mirror.new(uri) unless mirror.valid? mirror end
def for(uri)
Depending on the uri having a valid mirror or not, it may be a
Returns a mirror for the given uri.
def for(uri) if @all.validate!(@prober).valid? @all else fetch_valid_mirror_for(Settings.normalize_uri(uri)) end end
def initialize(prober = nil)
def initialize(prober = nil) @all = Mirror.new @prober = prober || TCPSocketProbe.new @mirrors = {} end
def parse(key, value)
def parse(key, value) config = MirrorConfig.new(key, value) mirror = if config.all? @all else @mirrors[config.uri] ||= Mirror.new end config.update_mirror(mirror) end