lib/bundler/source/rubygems.rb in bundler-1.8.9 vs lib/bundler/source/rubygems.rb in bundler-1.9.0.pre
- old
+ new
@@ -34,19 +34,15 @@
def hash
@remotes.hash
end
def eql?(o)
- o.is_a?(Rubygems) && o.credless_remotes == credless_remotes
+ o.is_a?(Rubygems) && remotes_equal?(o.remotes)
end
alias == eql?
- def include?(o)
- o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
- end
-
def can_lock?(spec)
spec.source.is_a?(Rubygems)
end
def options
@@ -202,23 +198,19 @@
end
end
protected
- def credless_remotes
- remotes.map(&method(:suppress_configured_credentials))
- end
-
- private
-
def source_uris_for_spec(spec)
specs.search_all(spec.name).inject([]) do |uris, s|
uris << s.source_uri.without_credentials if s.source_uri
uris
end
end
+ private
+
def loaded_from(spec)
"#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec"
end
def cached_gem(spec)
@@ -313,10 +305,12 @@
# because ensuring we have all the gems we need involves downloading
# the gemspecs of those gems, if the non-api sites contain more than
# about 100 gems, we just treat all sites as non-api for speed.
allow_api = idx.size < API_REQUEST_LIMIT && dependency_names.size < API_REQUEST_LIMIT
+ Bundler.ui.debug "Need to query more than #{API_REQUEST_LIMIT} gems." \
+ " Downloading full index instead..." unless allow_api
if allow_api
api_fetchers.each do |f|
Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug?
idx.use f.specs(dependency_names, self)
@@ -372,9 +366,13 @@
# Ruby 2.1, where all included gems have this summary
return true if spec.summary =~ /is bundled with Ruby/
# Ruby 2.0, where gemspecs are stored in specifications/default/
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
+ end
+
+ def remotes_equal?(other_remotes)
+ remotes.map(&method(:suppress_configured_credentials)) == other_remotes.map(&method(:suppress_configured_credentials))
end
end
end
end