reissue 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/README.md +9 -1
- data/lib/reissue/fragment_handler/git_fragment_handler.rb +43 -9
- data/lib/reissue/fragment_handler.rb +3 -2
- data/lib/reissue/rake.rb +12 -2
- data/lib/reissue/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f62c8ac05132854096bc7ad4cf5b2350a7b53ca183bc8c1090beca3297f3877
|
|
4
|
+
data.tar.gz: 18deca778dae79bca2b168c4ec759b601f1cd762f58b4e2e7b66d9b7ad9fe984
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63e8a825e67c084a31560d7c09006fad20cd4387fc8ea220279e7fc4df8697ca6c4118eb1a9233cf650fe4e28c41588dad9af60384f34d9f4e4500fde9a1f791
|
|
7
|
+
data.tar.gz: 67a8cd01e0a65e6581d6932f1bfb686e02fe131390a4aa11fa4b625345fefb075576cd7c8e4ecc7f3f55da08f4fc8f60402eb122ec84d0010be5ee864c931846
|
data/CHANGELOG.md
CHANGED
|
@@ -5,10 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [0.4.10] - 2026-01-27
|
|
9
|
+
|
|
8
10
|
## [0.4.9] - 2026-01-15
|
|
9
11
|
|
|
10
12
|
### Fixed
|
|
11
13
|
|
|
12
14
|
- Adding delete of remote branch after deling the local branch during the reissue:branch task to help with stale tracking reference. (3f6e1fb)
|
|
13
|
-
|
|
14
|
-
## [0.4.8] - 2025-12-19
|
data/README.md
CHANGED
|
@@ -117,7 +117,15 @@ Reissue::Task.create :reissue do |task|
|
|
|
117
117
|
# When true, fragments are cleared after a release (only applies when using directory fragments)
|
|
118
118
|
# Note: Has no effect when using :git fragments
|
|
119
119
|
task.clear_fragments = true
|
|
120
|
-
|
|
120
|
+
|
|
121
|
+
# Optional: Tag pattern for matching version tags. Defaults to /^v(\d+\.\d+\.\d+.*)$/
|
|
122
|
+
# Must include a capture group for the version number.
|
|
123
|
+
# Only applies when using :git fragments
|
|
124
|
+
# Examples:
|
|
125
|
+
# /^v(\d+\.\d+\.\d+.*)$/ matches "v1.2.3" (default)
|
|
126
|
+
# /^myapp-v(\d+\.\d+\.\d+.*)$/ matches "myapp-v1.2.3"
|
|
127
|
+
task.tag_pattern = /^myapp-v(\d+\.\d+\.\d+.*)$/
|
|
128
|
+
|
|
121
129
|
# Deprecated: Use `fragment` instead of `fragment_directory`
|
|
122
130
|
# task.fragment_directory = "changelog_fragments" # DEPRECATED: Use task.fragment instead
|
|
123
131
|
|
|
@@ -10,6 +10,21 @@ module Reissue
|
|
|
10
10
|
# Regex to match changelog section trailers in commit messages
|
|
11
11
|
TRAILER_REGEX = /^(#{VALID_SECTIONS.join("|")}):\s*(.+)$/i
|
|
12
12
|
|
|
13
|
+
# Default pattern for matching version tags (e.g., "v1.2.3")
|
|
14
|
+
DEFAULT_TAG_PATTERN = /^v(\d+\.\d+\.\d+.*)$/
|
|
15
|
+
|
|
16
|
+
# Initialize the handler with optional tag pattern for custom tag formats
|
|
17
|
+
#
|
|
18
|
+
# @param tag_pattern [Regexp, nil] Optional regex pattern for matching version tags.
|
|
19
|
+
# Must include a capture group for the version number.
|
|
20
|
+
# Examples:
|
|
21
|
+
# - /^v(\d+\.\d+\.\d+.*)$/ matches "v1.2.3" (default)
|
|
22
|
+
# - /^myapp-v(\d+\.\d+\.\d+.*)$/ matches "myapp-v1.2.3"
|
|
23
|
+
# - /^qualified-v(\d+\.\d+\.\d+.*)$/ matches "qualified-v0.3.5"
|
|
24
|
+
def initialize(tag_pattern: nil)
|
|
25
|
+
@tag_pattern = tag_pattern || DEFAULT_TAG_PATTERN
|
|
26
|
+
end
|
|
27
|
+
|
|
13
28
|
# Read changelog entries from git commit trailers
|
|
14
29
|
#
|
|
15
30
|
# @return [Hash] A hash of changelog entries organized by section
|
|
@@ -52,9 +67,11 @@ module Reissue
|
|
|
52
67
|
tag = last_tag
|
|
53
68
|
return nil unless tag
|
|
54
69
|
|
|
55
|
-
# Extract version number from tag
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
# Extract version number from tag using the pattern's capture group
|
|
71
|
+
match = tag.match(@tag_pattern)
|
|
72
|
+
return nil unless match && match[1]
|
|
73
|
+
|
|
74
|
+
::Gem::Version.new(match[1])
|
|
58
75
|
end
|
|
59
76
|
|
|
60
77
|
private
|
|
@@ -103,14 +120,31 @@ module Reissue
|
|
|
103
120
|
commits
|
|
104
121
|
end
|
|
105
122
|
|
|
106
|
-
# Find the
|
|
107
|
-
#
|
|
108
|
-
# Supports both numeric (v1.2.3) and alphanumeric (v2025.10.C) version tags
|
|
123
|
+
# Find the highest semantic version tag matching the configured pattern
|
|
124
|
+
# Uses the tag_pattern regex to filter tags and finds the highest version
|
|
109
125
|
#
|
|
110
|
-
# @return [String, nil] The
|
|
126
|
+
# @return [String, nil] The highest version tag or nil if no tags found
|
|
111
127
|
def find_last_tag
|
|
112
|
-
|
|
113
|
-
|
|
128
|
+
output = `git tag -l 2>/dev/null`.strip
|
|
129
|
+
return nil if output.empty?
|
|
130
|
+
|
|
131
|
+
tags = output.split("\n")
|
|
132
|
+
|
|
133
|
+
matching_tags = tags.filter_map do |tag|
|
|
134
|
+
match = tag.match(@tag_pattern)
|
|
135
|
+
next unless match && match[1]
|
|
136
|
+
|
|
137
|
+
begin
|
|
138
|
+
version = ::Gem::Version.new(match[1])
|
|
139
|
+
{tag: tag, version: version}
|
|
140
|
+
rescue ArgumentError
|
|
141
|
+
nil
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
return nil if matching_tags.empty?
|
|
146
|
+
|
|
147
|
+
matching_tags.max_by { |t| t[:version] }&.dig(:tag)
|
|
114
148
|
end
|
|
115
149
|
|
|
116
150
|
def parse_trailers_from_commits(commits)
|
|
@@ -22,9 +22,10 @@ module Reissue
|
|
|
22
22
|
#
|
|
23
23
|
# @param fragment_option [nil, String, Symbol] The fragment configuration
|
|
24
24
|
# @param valid_sections [Array<String>, nil] List of valid section names (for directory handler)
|
|
25
|
+
# @param tag_pattern [Regexp, nil] Optional regex pattern for matching version tags (for git handler)
|
|
25
26
|
# @return [FragmentHandler] The appropriate handler instance
|
|
26
27
|
# @raise [ArgumentError] If the option is not supported
|
|
27
|
-
def self.for(fragment_option, valid_sections: nil)
|
|
28
|
+
def self.for(fragment_option, valid_sections: nil, tag_pattern: nil)
|
|
28
29
|
case fragment_option
|
|
29
30
|
when nil
|
|
30
31
|
require_relative "fragment_handler/null_fragment_handler"
|
|
@@ -36,7 +37,7 @@ module Reissue
|
|
|
36
37
|
DirectoryFragmentHandler.new(fragment_option, **options)
|
|
37
38
|
when :git
|
|
38
39
|
require_relative "fragment_handler/git_fragment_handler"
|
|
39
|
-
GitFragmentHandler.new
|
|
40
|
+
GitFragmentHandler.new(tag_pattern: tag_pattern)
|
|
40
41
|
else
|
|
41
42
|
raise ArgumentError, "Invalid fragment option: #{fragment_option.inspect}"
|
|
42
43
|
end
|
data/lib/reissue/rake.rb
CHANGED
|
@@ -98,6 +98,15 @@ module Reissue
|
|
|
98
98
|
# Set this to :branch to push to a new branch.
|
|
99
99
|
attr_accessor :push_reissue
|
|
100
100
|
|
|
101
|
+
# Optional regex pattern for matching version tags.
|
|
102
|
+
# Must include a capture group for the version number.
|
|
103
|
+
# Examples:
|
|
104
|
+
# - /^v(\d+\.\d+\.\d+.*)$/ matches "v1.2.3" (default)
|
|
105
|
+
# - /^myapp-v(\d+\.\d+\.\d+.*)$/ matches "myapp-v1.2.3"
|
|
106
|
+
# - /^qualified-v(\d+\.\d+\.\d+.*)$/ matches "qualified-v0.3.5"
|
|
107
|
+
# Default: nil (uses default pattern matching "v1.2.3")
|
|
108
|
+
attr_accessor :tag_pattern
|
|
109
|
+
|
|
101
110
|
def initialize(name = :reissue, formatter: Reissue, tasker: Rake::Task)
|
|
102
111
|
@name = name
|
|
103
112
|
@formatter = formatter
|
|
@@ -116,6 +125,7 @@ module Reissue
|
|
|
116
125
|
@version_limit = 2
|
|
117
126
|
@version_redo_proc = nil
|
|
118
127
|
@push_reissue = :branch
|
|
128
|
+
@tag_pattern = nil
|
|
119
129
|
end
|
|
120
130
|
|
|
121
131
|
attr_reader :formatter, :tasker
|
|
@@ -262,7 +272,7 @@ module Reissue
|
|
|
262
272
|
task "#{name}:preview" do
|
|
263
273
|
if fragment
|
|
264
274
|
require_relative "fragment_handler"
|
|
265
|
-
handler = Reissue::FragmentHandler.for(fragment)
|
|
275
|
+
handler = Reissue::FragmentHandler.for(fragment, tag_pattern: tag_pattern)
|
|
266
276
|
|
|
267
277
|
# Show comparison tag for git trailers
|
|
268
278
|
if fragment == :git && handler.respond_to?(:last_tag)
|
|
@@ -329,7 +339,7 @@ module Reissue
|
|
|
329
339
|
require_relative "fragment_handler"
|
|
330
340
|
require_relative "version_updater"
|
|
331
341
|
|
|
332
|
-
handler = Reissue::FragmentHandler.for(:git)
|
|
342
|
+
handler = Reissue::FragmentHandler.for(:git, tag_pattern: tag_pattern)
|
|
333
343
|
|
|
334
344
|
# Get current version from version file
|
|
335
345
|
version_content = File.read(version_file)
|
data/lib/reissue/version.rb
CHANGED