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
- @@major_trigger =
'is_breaking'
- @@minor_trigger =
"type == 'feat'"
- @@patch_trigger =
"type == 'fix'"
Class Method Summary collapse
- .greatest_change_in(commit_list) ⇒ Object
-
.triggers_major?(type, scope, is_breaking) ⇒ Boolean
In this block method arguments can be used by user.
- .triggers_minor?(type, scope) ⇒ Boolean
- .triggers_patch?(type, scope) ⇒ Boolean
Class Method Details
.greatest_change_in(commit_list) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/get/subcommand/describe/change.rb', line 65 def greatest_change_in(commit_list) commit_list .grep(Git::CONVENTIONAL_COMMIT_REGEX) .map(&:to_change) .max { |a, b| CHANGE_TYPE.index(a) <=> CHANGE_TYPE.index(b) } end |
.triggers_major?(type, scope, is_breaking) ⇒ Boolean
In this block method arguments can be used by user. Also ‘eval` is needed to allow users to define their custom triggers. rubocop:disable Lint/UnusedMethodArgument rubocop:disable Security/Eval
35 36 37 |
# File 'lib/get/subcommand/describe/change.rb', line 35 def triggers_major?(type, scope, is_breaking) eval(@@major_trigger) end |
.triggers_minor?(type, scope) ⇒ Boolean
39 40 41 |
# File 'lib/get/subcommand/describe/change.rb', line 39 def triggers_minor?(type, scope) eval(@@minor_trigger) end |
.triggers_patch?(type, scope) ⇒ Boolean
43 44 45 |
# File 'lib/get/subcommand/describe/change.rb', line 43 def triggers_patch?(type, scope) eval(@@patch_trigger) end |