Module: ChangeHandler

Included in:
Describe
Defined in:
lib/get/subcommand/describe/change.rb

Overview

Module which handles change-related tasks.

Constant Summary collapse

CHANGE_TYPE =

Array with change types in ascending order of importance.

i[NONE PATCH MINOR MAJOR].freeze
DEFAULT_MAJOR_TRIGGER =
'is_breaking'
DEFAULT_MINOR_TRIGGER =
"type == 'feat'"
DEFAULT_PATCH_TRIGGER =
"type == 'fix'"

Instance Method Summary collapse

Instance Method Details

#updated_stable_version(stable_version) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/get/subcommand/describe/change.rb', line 33

def updated_stable_version(stable_version)
  return Git::DEFAULT_RELEASE_VERSION if stable_version.nil?

  greatest_change_from_stable_version = Git.with_commit_list_from(stable_version) do |commits_from_version|
    greatest_change_in(commits_from_version)
  end
  split_version = stable_version.split('.')
  case greatest_change_from_stable_version
  when :MAJOR
    "#{split_version[0].to_i + 1}.0.0"
  when :MINOR
    "#{split_version[0].to_i}.#{split_version[1].to_i + 1}.0"
  when :PATCH
    "#{split_version[0].to_i}.#{split_version[1].to_i}.#{split_version[2].to_i + 1}"
  else
    "#{split_version[0].to_i}.#{split_version[1].to_i}.#{split_version[2].to_i}"
  end
end