reissue 0.4.13 → 0.4.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b4d46ca42d94ccf491e32974d657b0b799d1bc38dec50bfc422b324211c0dba
4
- data.tar.gz: 0b9f9a2043e53cb0c534d1a2a96c9367a816fa44b49c6a6dce29586a6566ec8c
3
+ metadata.gz: d2dd0d8b9bc11f6c5b8f974bc0f0c0b561f2e879071e2aa00fe012a322d20e73
4
+ data.tar.gz: 0246c52e013c0309a7373b38f608bef56727e1265849e81898ea0b815b10db43
5
5
  SHA512:
6
- metadata.gz: 543483500981a91880361b000cf9864c4ace92183d283ad25f0d849f574a5176e2c59349789c7e9852963d7513b790561012e7c42ebab8d69d2d81520ef520c5
7
- data.tar.gz: c3c8da6ffbbe90a734b74c49922ec4acec0b1d1d9597ed3f496aee88336f932cb5fe8d631830abc6d131cefd10eaec61903696421f04c4935ed3428b23e615c3
6
+ metadata.gz: 7c678257f51a73f69708a38da1865dee98884d09619dd7f57a79541a05d40c5192206bafdb6fdbce12db4380e6c6428c2a6ac6c09a514888219426637572837d
7
+ data.tar.gz: 7cd5a57329c381a236edb74da800bd82f9ff21c59cc156c88f15789df3996aa81c0926a67840516f07327785b67acc67ec145d3f2eeeca7d82bda9f9db9baa4b
data/CHANGELOG.md CHANGED
@@ -5,15 +5,20 @@ 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.13] - 2026-02-10
8
+ ## [0.4.14] - 2026-02-11
9
9
 
10
10
  ### Added
11
11
 
12
- - Hoe plugin for integrating Reissue into Hoe-based projects (f5dde22)
13
- - Hoe plugin usage documentation in README and reissue:initialize task output (2bbd4ea)
14
-
15
- ## [0.4.12] - 2026-02-09
12
+ - Reissue.changelog_sections accessor with configurable, ordered section list (3da8a89)
13
+ - changelog_sections option to Rake task and Hoe plugin (3da8a89)
16
14
 
17
15
  ### Changed
18
16
 
19
- - reissue:bump now reads Version trailers regardless of whether the version file matches the last tag (98905d6)
17
+ - DirectoryFragmentHandler and GitFragmentHandler use centralized sections instead of their own constants (3da8a89)
18
+
19
+ ## [0.4.13] - 2026-02-10
20
+
21
+ ### Added
22
+
23
+ - Hoe plugin for integrating Reissue into Hoe-based projects (f5dde22)
24
+ - Hoe plugin usage documentation in README and reissue:initialize task output (2bbd4ea)
data/README.md CHANGED
@@ -80,7 +80,7 @@ This hooks into Hoe's release lifecycle:
80
80
  - `prerelease` - Runs `reissue:bump` and `reissue:finalize` before release
81
81
  - `postrelease` - Runs `reissue` to bump version for the next development cycle
82
82
 
83
- All configuration options are available as `reissue_`-prefixed attributes (e.g., `reissue_version_file`, `reissue_changelog_file`). The version file defaults to `lib/#{name}/version.rb`.
83
+ All configuration options are available as `reissue_`-prefixed attributes (e.g., `reissue_version_file`, `reissue_changelog_file`, `reissue_changelog_sections`). The version file defaults to `lib/#{name}/version.rb`.
84
84
 
85
85
  ### Non-Gem Projects
86
86
 
@@ -140,6 +140,11 @@ Reissue::Task.create :reissue do |task|
140
140
  # Note: Has no effect when using :git fragments
141
141
  task.clear_fragments = true
142
142
 
143
+ # Optional: Ordered list of valid changelog sections. Controls validation and display order.
144
+ # Defaults to: %w[Added Changed Deprecated Removed Fixed Security]
145
+ # Custom sections can be added; setting is idempotent (duplicates removed, names capitalized)
146
+ task.changelog_sections = %w[Major Added Changed Deprecated Removed Fixed Security]
147
+
143
148
  # Optional: Tag pattern for matching version tags. Defaults to /^v(\d+\.\d+\.\d+.*)$/
144
149
  # Must include a capture group for the version number.
145
150
  # Only applies when using :git fragments
@@ -193,7 +198,7 @@ Security: Rate limiting on login attempts"
193
198
 
194
199
  ### Supported Sections
195
200
 
196
- Git trailers use the standard Keep a Changelog sections:
201
+ Git trailers use the standard [Keep a Changelog](http://keepachangelog.com/) sections by default:
197
202
  - `Added:` for new features
198
203
  - `Changed:` for changes in existing functionality
199
204
  - `Deprecated:` for soon-to-be removed features
@@ -201,6 +206,12 @@ Git trailers use the standard Keep a Changelog sections:
201
206
  - `Fixed:` for any bug fixes
202
207
  - `Security:` for vulnerability fixes
203
208
 
209
+ You can customize the valid sections with `changelog_sections`. This controls both which trailer names are recognized and the order sections appear in the changelog:
210
+
211
+ ```ruby
212
+ task.changelog_sections = %w[Major Added Changed Deprecated Removed Fixed Security]
213
+ ```
214
+
204
215
  ### How It Works
205
216
 
206
217
  1. When you run `rake reissue`, it finds all commits since the last version tag
data/lib/hoe/reissue.rb CHANGED
@@ -7,6 +7,7 @@ module Hoe::Reissue
7
7
  :reissue_version_limit, :reissue_version_redo_proc,
8
8
  :reissue_fragment, :reissue_clear_fragments,
9
9
  :reissue_retain_changelogs, :reissue_tag_pattern,
10
+ :reissue_changelog_sections,
10
11
  :reissue_commit, :reissue_commit_finalize,
11
12
  :reissue_push_finalize, :reissue_push_reissue,
12
13
  :reissue_updated_paths
@@ -20,6 +21,7 @@ module Hoe::Reissue
20
21
  self.reissue_clear_fragments = false
21
22
  self.reissue_retain_changelogs = false
22
23
  self.reissue_tag_pattern = nil
24
+ self.reissue_changelog_sections = nil
23
25
  self.reissue_commit = true
24
26
  self.reissue_commit_finalize = true
25
27
  self.reissue_push_finalize = false
@@ -37,6 +39,7 @@ module Hoe::Reissue
37
39
  clear_fragments: reissue_clear_fragments,
38
40
  retain_changelogs: reissue_retain_changelogs,
39
41
  tag_pattern: reissue_tag_pattern,
42
+ changelog_sections: reissue_changelog_sections,
40
43
  commit: reissue_commit,
41
44
  commit_finalize: reissue_commit_finalize,
42
45
  push_finalize: reissue_push_finalize,
@@ -5,15 +5,13 @@ require "pathname"
5
5
  module Reissue
6
6
  # Handler for reading fragments from a directory
7
7
  class DirectoryFragmentHandler < FragmentHandler
8
- DEFAULT_VALID_SECTIONS = %w[added changed deprecated removed fixed security].freeze
9
-
10
8
  attr_reader :directory, :valid_sections
11
9
 
12
10
  # Initialize the handler with a directory path
13
11
  #
14
12
  # @param directory [String] The path to the fragments directory
15
13
  # @param valid_sections [Array<String>, nil] List of valid section names, or nil to allow all
16
- def initialize(directory, valid_sections: DEFAULT_VALID_SECTIONS)
14
+ def initialize(directory, valid_sections: Reissue.changelog_sections)
17
15
  @directory = directory
18
16
  @fragment_directory = Pathname.new(directory)
19
17
  @valid_sections = valid_sections
@@ -4,12 +4,6 @@ module Reissue
4
4
  class FragmentHandler
5
5
  # Handles reading changelog entries from git commit trailers
6
6
  class GitFragmentHandler < FragmentHandler
7
- # Valid changelog sections that can be used as trailers
8
- VALID_SECTIONS = %w[Added Changed Deprecated Removed Fixed Security].freeze
9
-
10
- # Regex to match changelog section trailers in commit messages
11
- TRAILER_REGEX = /^(#{VALID_SECTIONS.join("|")}):\s*(.+)$/i
12
-
13
7
  # Default pattern for matching version tags (e.g., "v1.2.3")
14
8
  DEFAULT_TAG_PATTERN = /^v(\d+\.\d+\.\d+.*)$/
15
9
 
@@ -76,6 +70,10 @@ module Reissue
76
70
 
77
71
  private
78
72
 
73
+ def trailer_regex
74
+ /^(#{Reissue.changelog_sections.join("|")}):\s*(.+)$/io
75
+ end
76
+
79
77
  def git_available?
80
78
  system("git --version", out: File::NULL, err: File::NULL)
81
79
  end
@@ -161,7 +159,7 @@ module Reissue
161
159
  i += 1
162
160
  next if line.strip.empty?
163
161
 
164
- if (match = line.match(TRAILER_REGEX))
162
+ if (match = line.match(trailer_regex))
165
163
  section_name = normalize_section_name(match[1])
166
164
  trailer_value = match[2].strip
167
165
 
@@ -170,7 +168,7 @@ module Reissue
170
168
  next_line = lines[i].rstrip
171
169
  # Stop at empty line or another changelog trailer
172
170
  break if next_line.strip.empty?
173
- break if next_line.match(TRAILER_REGEX)
171
+ break if next_line.match(trailer_regex)
174
172
 
175
173
  trailer_value += " #{next_line.strip}"
176
174
  i += 1
data/lib/reissue/rake.rb CHANGED
@@ -107,6 +107,11 @@ module Reissue
107
107
  # Default: nil (uses default pattern matching "v1.2.3")
108
108
  attr_accessor :tag_pattern
109
109
 
110
+ # The ordered list of valid changelog sections.
111
+ # Controls both validation (which sections are accepted) and ordering (how they appear).
112
+ # Default: nil (uses Reissue.changelog_sections)
113
+ attr_accessor :changelog_sections
114
+
110
115
  def initialize(name = :reissue, formatter: Reissue, tasker: Rake::Task)
111
116
  @name = name
112
117
  @formatter = formatter
@@ -126,6 +131,7 @@ module Reissue
126
131
  @version_redo_proc = nil
127
132
  @push_reissue = :branch
128
133
  @tag_pattern = nil
134
+ @changelog_sections = nil
129
135
  end
130
136
 
131
137
  attr_reader :formatter, :tasker
@@ -184,6 +190,8 @@ module Reissue
184
190
  end
185
191
 
186
192
  def define
193
+ Reissue.changelog_sections = changelog_sections if changelog_sections
194
+
187
195
  desc description
188
196
  task name, [:segment] do |task, args|
189
197
  segment = args[:segment] || "patch"
@@ -314,9 +322,8 @@ module Reissue
314
322
  end
315
323
  else
316
324
  puts "Changelog entries that will be added:\n\n"
317
- # Sort sections in Keep a Changelog order
318
- section_order = %w[Added Changed Deprecated Removed Fixed Security]
319
- sorted_sections = entries.keys.sort_by { |k| section_order.index(k) || 999 }
325
+ # Sort sections in configured changelog order
326
+ sorted_sections = entries.keys.sort_by { |k| Reissue.changelog_sections.index(k) || 999 }
320
327
 
321
328
  sorted_sections.each do |section|
322
329
  items = entries[section]
@@ -445,6 +452,9 @@ namespace :reissue do
445
452
  task.push_reissue = :branch # Push strategy: false, true, or :branch
446
453
  task.push_finalize = false # Push after finalize: false, true, or :branch
447
454
 
455
+ # Custom changelog sections (controls validation and ordering)
456
+ # task.changelog_sections = %w[Added Changed Deprecated Removed Fixed Security]
457
+
448
458
  # Custom tag pattern for version detection (must include capture group)
449
459
  # task.tag_pattern = /^myapp-v(\\d+\\.\\d+\\.\\d+.*)$/
450
460
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reissue
4
- VERSION = "0.4.13"
4
+ VERSION = "0.4.14"
5
5
  end
data/lib/reissue.rb CHANGED
@@ -7,6 +7,16 @@ require_relative "reissue/fragment_handler"
7
7
 
8
8
  # Reissue is a module that provides functionality for updating version numbers and changelogs.
9
9
  module Reissue
10
+ DEFAULT_CHANGELOG_SECTIONS = %w[Added Changed Deprecated Removed Fixed Security].freeze
11
+
12
+ def self.changelog_sections
13
+ @changelog_sections ||= DEFAULT_CHANGELOG_SECTIONS.dup
14
+ end
15
+
16
+ def self.changelog_sections=(sections)
17
+ @changelog_sections = Array(sections).map(&:capitalize).uniq
18
+ end
19
+
10
20
  # Updates the version number and changelog.
11
21
  #
12
22
  # @param version_file [String] The path to the version file.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reissue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay