1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Avoid unnecessary loop

https://github.com/rubygems/rubygems/commit/afaf868b68
This commit is contained in:
David Rodríguez 2021-11-16 15:01:18 +01:00 committed by git
parent 4b1dd75e6c
commit 2730e45f45

View file

@ -691,21 +691,15 @@ module Bundler
# generated
def converge_locked_specs
deps = []
# Build a list of dependencies that are the same in the Gemfile
# and Gemfile.lock. If the Gemfile modified a dependency, but
# the gem in the Gemfile.lock still satisfies it, this is fine
# too.
@dependencies.each do |dep|
if satisfies_locked_spec?(dep)
deps << dep
end
end
converged = []
@locked_specs.each do |s|
# Replace the locked dependency's source with the equivalent source from the Gemfile
dep = @dependencies.find {|d| s.satisfies?(d) }
if dep && (!dep.source || s.source.include?(dep.source))
deps << dep
end
s.source = (dep && dep.source) || sources.get(s.source) unless multisource_allowed?
# Don't add a spec to the list if its source is expired. For example,
@ -763,10 +757,6 @@ module Bundler
resolve
end
def satisfies_locked_spec?(dep)
@locked_specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
end
def metadata_dependencies
@metadata_dependencies ||= begin
ruby_versions = ruby_version_requirements(@ruby_version)