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:
parent
4b1dd75e6c
commit
2730e45f45
1 changed files with 5 additions and 15 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue