Skip to content

Commit 66b5ab7

Browse files
hsbtclaude
andcommitted
Annotate in-cooldown versions in bundle outdated output
bundle outdated still surfaces newer-but-cooldown'd versions instead of hiding them, so the user knows an upgrade is pending rather than silently missing. The prose form gains ", in cooldown for Nd more days" and the table form appends "(cooldown Nd)" to the Latest column. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 82dcf04 commit 66b5ab7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

bundler/lib/bundler/cli/outdated.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ def print_gem(current_spec, active_spec, dependency, groups)
205205

206206
release_date = release_date_for(active_spec)
207207
spec_outdated_info += ", released #{release_date}" unless release_date.empty?
208+
209+
remaining = cooldown_days_remaining(active_spec)
210+
spec_outdated_info += ", in cooldown for #{remaining} more day#{"s" if remaining > 1}" if remaining
211+
208212
spec_outdated_info += ")"
209213

210214
output_message = if options[:parseable]
@@ -221,6 +225,8 @@ def print_gem(current_spec, active_spec, dependency, groups)
221225
def gem_column_for(current_spec, active_spec, dependency, groups)
222226
current_version = "#{current_spec.version}#{current_spec.git_version}"
223227
spec_version = "#{active_spec.version}#{active_spec.git_version}"
228+
remaining = cooldown_days_remaining(active_spec)
229+
spec_version += " (cooldown #{remaining}d)" if remaining
224230
dependency = dependency.requirement if dependency
225231

226232
ret_val = [active_spec.name, current_version, spec_version, dependency.to_s, groups.to_s]
@@ -229,6 +235,15 @@ def gem_column_for(current_spec, active_spec, dependency, groups)
229235
ret_val
230236
end
231237

238+
def cooldown_days_remaining(spec, now = Time.now)
239+
return nil unless spec.respond_to?(:created_at) && spec.created_at
240+
return nil unless spec.respond_to?(:remote) && spec.remote
241+
days = spec.remote.effective_cooldown
242+
return nil if days.nil? || days <= 0
243+
remaining = days - ((now - spec.created_at) / 86_400.0)
244+
remaining > 0 ? remaining.ceil : nil
245+
end
246+
232247
def check_for_deployment_mode!
233248
return unless Bundler.frozen_bundle?
234249
suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?

0 commit comments

Comments
 (0)