Class: Bozo::Versioning::VersionBumper

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/bozo/versioning/version_bumper.rb

Instance Method Summary collapse

Methods included from Logging

#log_debug, #log_fatal, #log_info, #log_warn

Instance Method Details

#bump(part) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bozo/versioning/version_bumper.rb', line 7

def bump(part)
  unless can_be_bumped?
    raise VersionBumpError.new "State of the repository means the version can't be bumped. Ensure the staging index is empty."
  end

  version = Version.load_from_file
  original_version = version.to_s

  version.bump part
  version.write_to_file

  commit_version original_version, version

  log_info "Bumped #{original_version} to #{version}"
end