Class: Bundler::Interactive::VersionResolver
- Inherits:
-
Object
- Object
- Bundler::Interactive::VersionResolver
- Defined in:
- lib/bundler/interactive/version_resolver.rb
Overview
Gathers the candidate versions for every outdated gem.
For each installed gem it computes:
* the currently installed (locked) version,
* the in-range latest that dependency resolution selected (which already
respects the Gemfile constraint and, when configured, the cooldown
window),
* the absolute latest published version from the gem's source, and
* the in-range version held back by cooldown, if any.
Collaborators are injected so the resolver can be unit-tested without a live Bundler environment.
Instance Method Summary collapse
-
#initialize(current_specs:, resolved_definition:, dependencies:, cooldown_days: 0) ⇒ VersionResolver
constructor
A new instance of VersionResolver.
- #outdated_gems ⇒ Object
Constructor Details
#initialize(current_specs:, resolved_definition:, dependencies:, cooldown_days: 0) ⇒ VersionResolver
Returns a new instance of VersionResolver.
18 19 20 21 22 23 |
# File 'lib/bundler/interactive/version_resolver.rb', line 18 def initialize(current_specs:, resolved_definition:, dependencies:, cooldown_days: 0) @current_specs = current_specs @resolved_definition = resolved_definition @dependencies = dependencies @cooldown_days = cooldown_days.to_i end |
Instance Method Details
#outdated_gems ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bundler/interactive/version_resolver.rb', line 25 def outdated_gems current_specs.sort_by(&:name).each_with_object([]) do |current_spec, list| resolved = resolved_definition.find_resolved_spec(current_spec) next unless resolved gem = build(current_spec, resolved) # A gem is worth listing when it offers any upgrade target — an # in-range bump, a newer git revision, or a version beyond the # declared constraint (which `bundle outdated` surfaces too). list << gem if gem.upgradable? end end |