Class: Milestoner::Tagger
- Inherits:
-
Object
- Object
- Milestoner::Tagger
- Extended by:
- Forwardable
- Defined in:
- lib/milestoner/tagger.rb
Overview
Handles the tagging of a project repository. :reek:TooManyMethods
Instance Attribute Summary collapse
-
#commit_prefixes ⇒ Object
readonly
Returns the value of attribute commit_prefixes.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #commit_list ⇒ Object
- #commit_prefix_regex ⇒ Object
- #commits ⇒ Object
-
#create(version, sign: false) ⇒ Object
:reek:BooleanParameter.
-
#initialize(commit_prefixes: [], git: Git::Kit.new) ⇒ Tagger
constructor
A new instance of Tagger.
Constructor Details
Instance Attribute Details
#commit_prefixes ⇒ Object (readonly)
Returns the value of attribute commit_prefixes.
15 16 17 |
# File 'lib/milestoner/tagger.rb', line 15 def commit_prefixes @commit_prefixes end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
15 16 17 |
# File 'lib/milestoner/tagger.rb', line 15 def version @version end |
Instance Method Details
#commit_list ⇒ Object
37 38 39 |
# File 'lib/milestoner/tagger.rb', line 37 def commit_list commits.map { |commit| "- #{commit}" } end |
#commit_prefix_regex ⇒ Object
25 26 27 28 |
# File 'lib/milestoner/tagger.rb', line 25 def commit_prefix_regex return Regexp.new("") if commit_prefixes.empty? Regexp.union commit_prefixes end |
#commits ⇒ Object
30 31 32 33 34 35 |
# File 'lib/milestoner/tagger.rb', line 30 def commits groups = build_commit_prefix_groups group_by_commit_prefix groups sort_by_commit_prefix groups groups.values.flatten.uniq end |
#create(version, sign: false) ⇒ Object
:reek:BooleanParameter
42 43 44 45 46 47 |
# File 'lib/milestoner/tagger.rb', line 42 def create version, sign: false @version = Versionaire::Version version fail(Errors::Git, "Unable to tag without commits.") unless git.commits? return if existing_tag? git_tag sign: sign end |