diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-09-05 13:00:09 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-09-05 13:00:09 -0500 |
commit | 092dfb64198c4ed914e280e7ee9097f777467604 (patch) | |
tree | 84b714a3abecefb7dfa9f89476ffa7f0cf7aca4f /lib/bundler/definition.rb | |
parent | 9063885bdc071b9e836d8695b10c7024f5fbb1cc (diff) | |
download | bundler-092dfb64198c4ed914e280e7ee9097f777467604.tar.gz |
[Definition] Lazily create gem_version_promoterseg-gvp-major
This way, it can be reset in #missing_specs?
Diffstat (limited to 'lib/bundler/definition.rb')
-rw-r--r-- | lib/bundler/definition.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 1385ff2a94..ecb41f83c2 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -10,7 +10,6 @@ module Bundler attr_reader( :dependencies, - :gem_version_promoter, :locked_deps, :locked_gems, :platforms, @@ -125,25 +124,25 @@ module Bundler @unlock[:gems] = @locked_specs.for(eager_unlock).map(&:name) end - @gem_version_promoter = create_gem_version_promoter - @dependency_changes = converge_dependencies @local_changes = converge_locals @requires = compute_requires end - def create_gem_version_promoter - locked_specs = - if unlocking? && @locked_specs.empty? && !@lockfile_contents.empty? - # Definition uses an empty set of locked_specs to indicate all gems - # are unlocked, but GemVersionPromoter needs the locked_specs - # for conservative comparison. - Bundler::SpecSet.new(@locked_gems.specs) - else - @locked_specs - end - GemVersionPromoter.new(locked_specs, @unlock[:gems]) + def gem_version_promoter + @gem_version_promoter ||= begin + locked_specs = + if unlocking? && @locked_specs.empty? && !@lockfile_contents.empty? + # Definition uses an empty set of locked_specs to indicate all gems + # are unlocked, but GemVersionPromoter needs the locked_specs + # for conservative comparison. + Bundler::SpecSet.new(@locked_gems.specs) + else + @locked_specs + end + GemVersionPromoter.new(locked_specs, @unlock[:gems]) + end end def resolve_with_cache! @@ -218,6 +217,7 @@ module Bundler @index = nil @resolve = nil @specs = nil + @gem_version_promoter = nil end def requested_specs |