Class: GemKit::Release::Commands::Deprecations

Inherits:
Command
  • Object
show all
Defined in:
lib/gem_kit/release/commands/deprecations.rb

Overview

Without a version: everything outstanding. With one: only what comes due there, failing if anything does — which is what makes it usable as a CI gate.

Constant Summary

Constants inherited from Command

Command::RED, Command::RESET

Instance Attribute Summary

Attributes inherited from Command

#options

Instance Method Summary collapse

Methods inherited from Command

#fail_with, #gate, #initialize, #lines, #project, #refuse, #relative, #render, #say, #version_file

Constructor Details

This class inherits a constructor from GemKit::Release::Commands::Command

Instance Method Details

#call(version = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gem_kit/release/commands/deprecations.rb', line 15

def call(version = nil)
  project.load!
  registry = Deprecate.registry

  if registry.empty?
    say("No deprecations declared.")
    return
  end

  if version.nil?
    say("#{registry.size} outstanding deprecation(s) (current version #{project.version}):")
    return render(registry)
  end

  due = GemKit::Deprecate.pending(version)
  if due.empty?
    say("No deprecations come due at #{version}. (#{registry.size} outstanding overall.)")
    return
  end

  refuse("#{due.size} deprecation(s) come due at #{version} and must be removed first:", lines(due))
end