Class: GemKit::Release::Commands::Bump

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

Overview

The deadline check lives here rather than at release time because the bump is the last moment anyone can be stopped: once the version file says 5.0.0, every promise to disappear "in 5.0" is already broken.

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(segment = "patch") ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/gem_kit/release/commands/bump.rb', line 16

def call(segment = "patch")
  current = project.version.to_s

  begin
    target = VersionFile.bump(current, segment)
  rescue VersionFile::Error => error
    fail_with(error.message)
  end

  problems = gate.bump_problems(target)
  unless problems.empty?
    unless options[:force]
      refuse("Refusing to bump #{current} -> #{target}:",
             problems + ["", "Remove them, then bump. Override with --force."])
    end

    say("--force given; bumping past #{problems.size} deprecation(s) anyway.")
  end

  version_file.write(target)
  say("#{current} -> #{target}")

  relock(target)

  upcoming = gate.upcoming_deprecations(target)
  unless upcoming.empty?
    say("#{upcoming.size} deprecation(s) still outstanding (none due in #{target}).")
  end

  # The changelog is the one release artefact nothing regenerates, and
  # the one most easily forgotten — so say so loudly.
  say
  say("#{RED}now run: gem kit changelog --write#{RESET}")
end