diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2025-04-12 18:04:14 +0200 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-04-15 16:47:19 +0900 |
| commit | c910e85b022bca1518dc720af968fbaf58fa453e (patch) | |
| tree | ef3d9c6803ac6edc6c1a9279767fb4f67121593f | |
| parent | 0ad7cf17a00d7f183f4fb41a9c4b595ea8bb99cd (diff) | |
[rubygems/rubygems] Extract some logic to a method and expand comment
https://github.com/rubygems/rubygems/commit/ed31e888fd
| -rw-r--r-- | lib/bundler/lazy_specification.rb | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 808a4cc722..061e4bb91e 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -216,23 +216,28 @@ module Bundler end if search - if search.platform == platform - # We don't validate dependencies of locally installed gems but accept - # what's in the lockfile instead for performance, since loading - # dependencies of locally installed gems would mean evaluating all - # gemspecs, which would affect `bundler/setup` performance - if search.is_a?(StubSpecification) - search.dependencies = dependencies - else - if !source.is_a?(Source::Path) && search.runtime_dependencies.sort != dependencies.sort - raise IncorrectLockfileDependencies.new(self) - end - end - end + validate_dependencies(search) if search.platform == platform search.locked_platform = platform if search.instance_of?(RemoteSpecification) || search.instance_of?(EndpointSpecification) end search end + + # Validate dependencies of this locked spec are consistent with dependencies + # of the actual spec that was materialized. + # + # Note that we don't validate dependencies of locally installed gems but + # accept what's in the lockfile instead for performance, since loading + # dependencies of locally installed gems would mean evaluating all gemspecs, + # which would affect `bundler/setup` performance. + def validate_dependencies(spec) + if spec.is_a?(StubSpecification) + spec.dependencies = dependencies + else + if !source.is_a?(Source::Path) && spec.runtime_dependencies.sort != dependencies.sort + raise IncorrectLockfileDependencies.new(self) + end + end + end end end |
