kettle-changelog 1.0.5 → 1.0.6

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: 987f0528fbdee3c91c47d9675fe79fe3e4993f69c4b759ee7413a07c0b6eece9
4
- data.tar.gz: d20d9e1fff2153b932cb3961d8bb56fd8bd02b0e9257b4b2844eaaa70ac7cb11
3
+ metadata.gz: 91116b5db1a2ec7a70b8bb798aae0e19222ee9eded29fc26b8bdf80e0efd0d0d
4
+ data.tar.gz: f1dd9b8ff5dc27c2393a87f4fa74c2323910248fe8765755a2a47ca74aabe105
5
5
  SHA512:
6
- metadata.gz: d379f0164efc1c4d7214607eb2e745895dce3cb5e0702da2d27d63f62f376ec077b842061e74d98a93ca4ad9015cc3200e4daf8ca73a3d9ba338e8bbb339fc61
7
- data.tar.gz: 21ecb7793e5b0ebc36d2e0987419a3b9f900267ce04e1edabdfa18c5c3f3e72bc112d6456a95bdc2b8f79df77dc7cf58cd7b2057049aa90238ebd501d1796a8d
6
+ metadata.gz: 383cbcaed4483a26f407bb7f9b433cddb77799f8f6c91b7f241e07c893f8ef41c2982ba071694d5197017bac689eb7c2b7afd82d6feb0d0384cdc565be37c9bf
7
+ data.tar.gz: 2b3233ceb38ae67fd12e82d03fa56590f028b5738aa5ebaaf731e6e6a071f5cc849c3ad1843535305184122cfa3478a7ca5d398312e02d726a890b78a740d9a1
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,19 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [1.0.6] - 2026-08-29
34
+
35
+ - TAG: [v1.0.6][1.0.6t]
36
+ - COVERAGE: 94.27% -- 1119/1187 lines in 6 files
37
+ - BRANCH COVERAGE: 77.31% -- 385/498 branches in 6 files
38
+ - 38.89% documented
39
+
40
+ ### Fixed
41
+
42
+ - Consolidate repeated keyed project-file summaries when updating a prepared release section.
43
+
44
+ - Consolidate repeated keyed project-file summaries within each published release during changelog reformatting.
45
+
33
46
  ## [1.0.5] - 2026-08-28
34
47
 
35
48
  - TAG: [v1.0.5][1.0.5t]
@@ -179,7 +192,9 @@ Please file a bug if you notice a violation of semantic versioning.
179
192
 
180
193
  - Initial release
181
194
 
182
- [Unreleased]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.5...HEAD
195
+ [Unreleased]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.6...HEAD
196
+ [1.0.6]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.5...v1.0.6
197
+ [1.0.6t]: https://github.com/kettle-dev/kettle-changelog/releases/tag/v1.0.6
183
198
  [1.0.5]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.4...v1.0.5
184
199
  [1.0.5t]: https://github.com/kettle-dev/kettle-changelog/releases/tag/v1.0.5
185
200
  [1.0.4]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.3...v1.0.4
data/README.md CHANGED
@@ -397,7 +397,7 @@ Thanks for RTFM. ☺️
397
397
  [📌gitmoji]: https://gitmoji.dev
398
398
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
399
399
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
400
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-1.143-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
400
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-1.187-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
401
401
  [🔐security]: https://github.com/kettle-dev/kettle-changelog/blob/main/SECURITY.md
402
402
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
403
403
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -425,6 +425,7 @@ module Kettle
425
425
  updated = convert_heading_tag_suffix_to_list(changelog)
426
426
  updated = normalize_legacy_release_headings(updated)
427
427
  updated = remove_redundant_historical_placeholders(updated)
428
+ updated = collapse_keyed_project_file_updates_by_release(updated)
428
429
  updated = normalize_heading_spacing(updated)
429
430
  updated = ensure_footer_spacing(updated)
430
431
  updated = updated.rstrip + "\n"
@@ -460,6 +461,15 @@ module Kettle
460
461
  lines.each_with_index.reject { |_line, index| removals.any? { |range| range.cover?(index) } }.map(&:first).join
461
462
  end
462
463
 
464
+ def collapse_keyed_project_file_updates_by_release(changelog)
465
+ lines = changelog.to_s.lines
466
+ changelog_release_sections(lines).sort_by { |section| section.fetch(:start) }.reverse_each do |section|
467
+ range = section.fetch(:start)...section.fetch(:finish)
468
+ lines[range] = KeyedEntryUpserter.collapse_project_file_updates(lines[range].join).lines
469
+ end
470
+ lines.join
471
+ end
472
+
463
473
  def changelog_release_sections(lines)
464
474
  headings = lines.each_index.filter_map do |index|
465
475
  match = lines[index].match(/^## \[(#{CHANGELOG_VERSION_PATTERN_SOURCE})\]/o)
@@ -710,7 +720,8 @@ module Kettle
710
720
  end
711
721
  end
712
722
 
713
- ([leading] + sections.map { |section| section.fetch(:heading) + trim_blank_lines(section.fetch(:lines)).join }).join.rstrip + "\n"
723
+ merged = ([leading] + sections.map { |section| section.fetch(:heading) + trim_blank_lines(section.fetch(:lines)).join }).join.rstrip + "\n"
724
+ KeyedEntryUpserter.collapse_project_file_updates(merged)
714
725
  end
715
726
 
716
727
  def strip_release_metadata(release_body)
@@ -5,6 +5,67 @@ module Kettle
5
5
  class KeyedEntryUpserter
6
6
  SECTIONS = %w[Added Changed Deprecated Removed Fixed Security].freeze
7
7
  KEY_PREFIX = "[kc]"
8
+ PROJECT_FILE_UPDATE_FIRST_LINE = /\A[-*]\s+\[kc\]\s+([^\s:]+):\s+updated\s+\d+\s+project\s+files?:\s*\z/
9
+ PROJECT_FILE_UPDATE_CATEGORY_LINE = /\A\s{2,}[-*]\s+(.+?)\s+\((\d+)\)\s*\z/
10
+
11
+ class << self
12
+ # Consolidates repeated maintenance summaries after a prepared release
13
+ # is updated in place. The AST supplies list-item boundaries; the two
14
+ # regular expressions only parse the stable text payload inside those
15
+ # already-classified Markdown items.
16
+ def collapse_project_file_updates(source)
17
+ require "ast/crispr/markdown/markly"
18
+ context = Ast::Crispr::Markdown::Markly.document_context(content: source.to_s, source_label: "CHANGELOG.md")
19
+ updates = context.structural_owners(owner_scope: :list_items)
20
+ .select { |item| item.depth == 1 }
21
+ .filter_map { |item| project_file_update_record(item) }
22
+ duplicate_groups = updates.group_by { |update| update.fetch(:key) }.values.select { |group| group.length > 1 }
23
+ return source.to_s if duplicate_groups.empty?
24
+
25
+ lines = source.to_s.lines
26
+ duplicate_groups.flatten.sort_by { |update| update.fetch(:start_line) }.reverse_each do |update|
27
+ group = duplicate_groups.find { |candidate| candidate.include?(update) }
28
+ first = group.min_by { |candidate| candidate.fetch(:start_line) }
29
+ replacement = (update == first) ? project_file_update_entry(group).lines : []
30
+ lines[(update.fetch(:start_line) - 1)...update.fetch(:end_line)] = replacement
31
+ end
32
+ lines.join
33
+ end
34
+
35
+ private
36
+
37
+ def project_file_update_record(item)
38
+ lines = item.source.to_s.lines
39
+ key_match = PROJECT_FILE_UPDATE_FIRST_LINE.match(lines.shift.to_s.strip)
40
+ return unless key_match
41
+
42
+ counts = lines.filter_map do |line|
43
+ match = PROJECT_FILE_UPDATE_CATEGORY_LINE.match(line)
44
+ next unless match
45
+
46
+ [match[1].tr(" ", "_").to_sym, match[2].to_i]
47
+ end.to_h
48
+ return if counts.empty?
49
+
50
+ {
51
+ key: key_match[1],
52
+ counts: counts,
53
+ start_line: item.location.start_line,
54
+ end_line: item.location.end_line
55
+ }
56
+ end
57
+
58
+ def project_file_update_entry(entries)
59
+ counts = entries.each_with_object(Hash.new(0)) do |entry, totals|
60
+ entry.fetch(:counts).each { |category, count| totals[category] += count }
61
+ end
62
+ total = counts.values.sum
63
+ details = counts.sort_by { |category, _count| category.to_s }.map do |category, count|
64
+ " - #{category.to_s.tr("_", " ")} (#{count})"
65
+ end
66
+ ["- #{KEY_PREFIX} #{entries.first.fetch(:key)}: updated #{total} project file#{"s" unless total == 1}:", *details, ""].join("\n")
67
+ end
68
+ end
8
69
 
9
70
  def initialize(section:, key:, entry:, legacy_prefixes: [], root: Kettle::Dev::CIHelpers.project_root)
10
71
  @root = root
@@ -5,7 +5,7 @@ module Kettle
5
5
  # Version namespace for this gem.
6
6
  module Version
7
7
  # Current gem version.
8
- VERSION = "1.0.5"
8
+ VERSION = "1.0.6"
9
9
  end
10
10
  # Current gem version exposed at the traditional constant location.
11
11
  VERSION = Version::VERSION # Traditional Constant Location
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kettle-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -63,7 +63,7 @@ dependencies:
63
63
  requirements:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: 3.0.15
66
+ version: 3.0.17
67
67
  - - "<"
68
68
  - !ruby/object:Gem::Version
69
69
  version: 4.0.0
@@ -73,7 +73,7 @@ dependencies:
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 3.0.15
76
+ version: 3.0.17
77
77
  - - "<"
78
78
  - !ruby/object:Gem::Version
79
79
  version: 4.0.0
@@ -304,10 +304,10 @@ licenses:
304
304
  - AGPL-3.0-only
305
305
  metadata:
306
306
  homepage_uri: https://kettle-changelog.galtzo.com
307
- source_code_uri: https://github.com/kettle-dev/kettle-changelog/tree/v1.0.5
308
- changelog_uri: https://github.com/kettle-dev/kettle-changelog/blob/v1.0.5/CHANGELOG.md
307
+ source_code_uri: https://github.com/kettle-dev/kettle-changelog/tree/v1.0.6
308
+ changelog_uri: https://github.com/kettle-dev/kettle-changelog/blob/v1.0.6/CHANGELOG.md
309
309
  bug_tracker_uri: https://github.com/kettle-dev/kettle-changelog/issues
310
- documentation_uri: https://www.rubydoc.info/gems/kettle-changelog/1.0.5
310
+ documentation_uri: https://www.rubydoc.info/gems/kettle-changelog/1.0.6
311
311
  funding_uri: https://github.com/sponsors/pboling
312
312
  wiki_uri: https://github.com/kettle-dev/kettle-changelog/wiki
313
313
  news_uri: https://www.railsbling.com/tags/kettle-changelog
metadata.gz.sig CHANGED
Binary file