Class: Reissue::FragmentHandler::GitFragmentHandler
- Inherits:
-
Reissue::FragmentHandler
- Object
- Reissue::FragmentHandler
- Reissue::FragmentHandler::GitFragmentHandler
- Defined in:
- lib/reissue/fragment_handler/git_fragment_handler.rb
Overview
Handles reading changelog entries from git commit trailers
Constant Summary collapse
- DEFAULT_TAG_PATTERN =
Default pattern for matching version tags (e.g., “v1.2.3”)
/^v(\d+\.\d+\.\d+.*)$/
Instance Method Summary collapse
-
#clear ⇒ nil
Clear operation is a no-op for git trailers.
-
#initialize(tag_pattern: nil) ⇒ GitFragmentHandler
constructor
Initialize the handler with optional tag pattern for custom tag formats.
-
#last_tag ⇒ String?
Get the last version tag used for comparison.
-
#last_tag_version ⇒ Gem::Version?
Get the version from the last git tag.
-
#read ⇒ Hash
Read changelog entries from git commit trailers.
-
#read_version_bump ⇒ Symbol?
Read version bump from git commit trailers.
Methods inherited from Reissue::FragmentHandler
Constructor Details
#initialize(tag_pattern: nil) ⇒ GitFragmentHandler
Initialize the handler with optional tag pattern for custom tag formats
18 19 20 |
# File 'lib/reissue/fragment_handler/git_fragment_handler.rb', line 18 def initialize(tag_pattern: nil) @tag_pattern = tag_pattern || DEFAULT_TAG_PATTERN end |
Instance Method Details
#clear ⇒ nil
Clear operation is a no-op for git trailers
35 36 37 |
# File 'lib/reissue/fragment_handler/git_fragment_handler.rb', line 35 def clear nil end |
#last_tag ⇒ String?
Get the last version tag used for comparison
42 43 44 45 |
# File 'lib/reissue/fragment_handler/git_fragment_handler.rb', line 42 def last_tag return nil unless git_available? && in_git_repo? find_last_tag end |
#last_tag_version ⇒ Gem::Version?
Get the version from the last git tag
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/reissue/fragment_handler/git_fragment_handler.rb', line 60 def last_tag_version tag = last_tag return nil unless tag # Extract version number from tag using the pattern's capture group match = tag.match(@tag_pattern) return nil unless match && match[1] ::Gem::Version.new(match[1]) end |
#read ⇒ Hash
Read changelog entries from git commit trailers
25 26 27 28 29 30 |
# File 'lib/reissue/fragment_handler/git_fragment_handler.rb', line 25 def read return {} unless git_available? && in_git_repo? commits = commits_since_last_tag parse_trailers_from_commits(commits) end |
#read_version_bump ⇒ Symbol?
Read version bump from git commit trailers
50 51 52 53 54 55 |
# File 'lib/reissue/fragment_handler/git_fragment_handler.rb', line 50 def read_version_bump return nil unless git_available? && in_git_repo? commits = commits_since_last_tag parse_version_bump_from_commits(commits) end |