Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Commands::OutdatedCommand#execute_with_cooldown
execute_with_cooldown
lib/rubygems/commands/outdated_command.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/commands/outdated_command.rb, line 53
def execute_with_cooldown
fetcher = Gem::SpecFetcher.fetcher
Gem::Specification.latest_specs(true).each do |local_spec|
dependency = Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
# The :latest index carries only the newest version of each gem,
# which leaves nothing to fall back to when the cooldown excludes
# it, so search the full index instead.
remotes, = fetcher.search_for_dependency dependency,
type: dependency.prerelease? ? :complete : :released
selectable, embargoed = partition_by_cooldown remotes
candidate = selectable.max
candidate = nil unless candidate && local_spec.version < candidate
pending = embargoed.max
pending = nil unless pending && local_spec.version < pending &&
(candidate.nil? || candidate < pending)
next unless candidate || pending
pending = "#{pending} (cooldown #{@cooldown.days}d)" if pending
say "#{local_spec.name} (#{local_spec.version} < #{[candidate, pending].compact.join(", ")})"
end
end
Like Gem::Specification.outdated_and_latest_version, but the newest version outside the cooldown period becomes the update candidate, and newer versions still within the period are annotated.