kettle-dev 1.2.3 → 1.2.4

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: cad2d78d297d0e69cd016624ff87dba0c5fa4bd3af5399d7c97c4e8fcc2af82a
4
- data.tar.gz: '08f58025922178025f79d3ef3004b35f9207e23764c490587ec3ed5dfc240ca5'
3
+ metadata.gz: 73ca5267629934af0b0f044598295a93c287cbace6c0ac2f5e2d1a701a72ca89
4
+ data.tar.gz: 1743ac37975a516f979d135d52c62b8a9fa28171d6df1a82fb58cce4d1676ea1
5
5
  SHA512:
6
- metadata.gz: 12563697c8b719fc13ded6b096fcd92266dbb98f9f8c87a21aad756bebbe2065f7dc17e2be982d1a3765a15c8c3b8cbd0eec88642fc7fb90600e1be88c4db149
7
- data.tar.gz: e3ce95406792e64d08da4db003a5771c45c975155c417176e10972e13ad0e012ed006aa9193b81b1fbecc96d59edb752cba80a26a538c60f824c52228e6110e9
6
+ metadata.gz: afd0cdb05a6f08db4665b634cf38d4f959d08ea73ff526f1757d9168d3aab0a6a6d81ba90a5f20905f8888bd88bbbe55c1c53d15f0d1898202448dac0f204bd3
7
+ data.tar.gz: 92a005b6bb76771bffe3e0e3e3762bc6e11699286119dc009cb61e4c72278666552e07cf0a547c215c586caf7abeea7305767fce2d008342758b5d8fe80cc676
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,21 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [1.2.4] - 2025-11-28
34
+
35
+ - TAG: [v1.2.4][1.2.4t]
36
+ - COVERAGE: 93.53% -- 4701/5026 lines in 31 files
37
+ - BRANCH COVERAGE: 76.61% -- 1913/2497 branches in 31 files
38
+ - 69.78% documented
39
+
40
+ ### Fixed
41
+
42
+ - Fixed comment deduplication in `restore_custom_leading_comments` to prevent accumulation across multiple template runs
43
+ - Comments from destination are now deduplicated before being merged back into result
44
+ - Fixes issue where `:replace` strategy (used by `kettle-dev-setup --force`) would accumulate duplicate comments
45
+ - Ensures truly idempotent behavior when running templating multiple times on the same file
46
+ - Example: `frozen_string_literal` comments no longer multiply from 1→4→5→6 on repeated runs
47
+
33
48
  ## [1.2.3] - 2025-11-28
34
49
 
35
50
  - TAG: [v1.2.3][1.2.3t]
@@ -1507,7 +1522,9 @@ Please file a bug if you notice a violation of semantic versioning.
1507
1522
  - Selecting will run the selected workflow via `act`
1508
1523
  - This may move to its own gem in the future.
1509
1524
 
1510
- [Unreleased]: https://github.com/kettle-rb/kettle-dev/compare/v1.2.3...HEAD
1525
+ [Unreleased]: https://github.com/kettle-rb/kettle-dev/compare/v1.2.4...HEAD
1526
+ [1.2.4]: https://github.com/kettle-rb/kettle-dev/compare/v1.2.3...v1.2.4
1527
+ [1.2.4t]: https://github.com/kettle-rb/kettle-dev/releases/tag/v1.2.4
1511
1528
  [1.2.3]: https://github.com/kettle-rb/kettle-dev/compare/v1.2.2...v1.2.3
1512
1529
  [1.2.3t]: https://github.com/kettle-rb/kettle-dev/releases/tag/v1.2.3
1513
1530
  [1.2.2]: https://github.com/kettle-rb/kettle-dev/compare/v1.2.1...v1.2.2
data/README.md CHANGED
@@ -1026,7 +1026,7 @@ Thanks for RTFM. ☺️
1026
1026
  [📌gitmoji]: https://gitmoji.dev
1027
1027
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
1028
1028
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
1029
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-5.010-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1029
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-5.026-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1030
1030
  [🔐security]: SECURITY.md
1031
1031
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
1032
1032
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
data/README.md.example CHANGED
@@ -548,7 +548,7 @@ Thanks for RTFM. ☺️
548
548
  [📌gitmoji]: https://gitmoji.dev
549
549
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
550
550
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
551
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-5.010-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
551
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-5.026-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
552
552
  [🔐security]: SECURITY.md
553
553
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
554
554
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
data/Rakefile.example CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # kettle-dev Rakefile v1.2.3 - 2025-11-28
3
+ # kettle-dev Rakefile v1.2.4 - 2025-11-28
4
4
  # Ruby 2.3 (Safe Navigation) or higher required
5
5
  #
6
6
  # MIT License (see License.txt)
@@ -590,21 +590,54 @@ module Kettle
590
590
  end
591
591
 
592
592
  def restore_custom_leading_comments(dest_content, merged_content)
593
- block = leading_comment_block(dest_content)
594
- return merged_content if block.strip.empty?
593
+ # Extract and deduplicate leading comments from dest
594
+ dest_block = leading_comment_block(dest_content)
595
+ return merged_content if dest_block.strip.empty?
595
596
 
596
- # Check if the merged content already starts with this block
597
- # Use normalized comparison to handle whitespace differences
597
+ # Parse and deduplicate the dest leading comments
598
+ dest_deduplicated = deduplicate_leading_comment_block(dest_block)
599
+ return merged_content if dest_deduplicated.strip.empty?
600
+
601
+ # Get the merged content's leading comments
598
602
  merged_leading = leading_comment_block(merged_content)
599
603
 
600
- # If merged already has the same or more comprehensive leading comments, don't add
601
- return merged_content if merged_leading.strip == block.strip
602
- return merged_content if merged_content.include?(block.strip)
604
+ # Parse both blocks to compare individual comments
605
+ dest_comments = extract_comment_lines(dest_deduplicated)
606
+ merged_comments = extract_comment_lines(merged_leading)
607
+
608
+ # Find comments in dest that aren't in merged (by normalized text)
609
+ merged_set = Set.new(merged_comments.map { |c| normalize_comment(c) })
610
+ unique_dest_comments = dest_comments.reject { |c| merged_set.include?(normalize_comment(c)) }
611
+
612
+ return merged_content if unique_dest_comments.empty?
603
613
 
604
- # Insert after shebang / frozen string literal comments (same place reminder goes)
614
+ # Add unique dest comments after the insertion point
605
615
  insertion_index = reminder_insertion_index(merged_content)
606
- block = ensure_trailing_newline(block)
607
- merged_content.dup.insert(insertion_index, block)
616
+ new_comments = unique_dest_comments.join + "\n"
617
+ merged_content.dup.insert(insertion_index, new_comments)
618
+ end
619
+
620
+ def deduplicate_leading_comment_block(block)
621
+ # Parse the block as if it were a Ruby file with just comments
622
+ # This allows us to use the same deduplication logic
623
+ parse_result = PrismUtils.parse_with_comments(block)
624
+ return block unless parse_result.success?
625
+
626
+ tuples = create_comment_tuples(parse_result)
627
+ deduplicated_tuples = deduplicate_comment_sequences(tuples)
628
+
629
+ # Rebuild the comment block from deduplicated tuples
630
+ deduplicated_tuples.map { |tuple| tuple[2] + "\n" }.join
631
+ end
632
+
633
+ def extract_comment_lines(block)
634
+ lines = block.to_s.lines
635
+ lines.select { |line| line.strip.start_with?("#") }
636
+ end
637
+
638
+ def normalize_comment(comment)
639
+ # Normalize by removing trailing whitespace and standardizing spacing
640
+ comment.strip
608
641
  end
609
642
 
610
643
  def leading_comment_block(content)
@@ -6,7 +6,7 @@ module Kettle
6
6
  module Version
7
7
  # The gem version.
8
8
  # @return [String]
9
- VERSION = "1.2.3"
9
+ VERSION = "1.2.4"
10
10
 
11
11
  module_function
12
12
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kettle-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -414,10 +414,10 @@ licenses:
414
414
  - MIT
415
415
  metadata:
416
416
  homepage_uri: https://kettle-dev.galtzo.com/
417
- source_code_uri: https://github.com/kettle-rb/kettle-dev/tree/v1.2.3
418
- changelog_uri: https://github.com/kettle-rb/kettle-dev/blob/v1.2.3/CHANGELOG.md
417
+ source_code_uri: https://github.com/kettle-rb/kettle-dev/tree/v1.2.4
418
+ changelog_uri: https://github.com/kettle-rb/kettle-dev/blob/v1.2.4/CHANGELOG.md
419
419
  bug_tracker_uri: https://github.com/kettle-rb/kettle-dev/issues
420
- documentation_uri: https://www.rubydoc.info/gems/kettle-dev/1.2.3
420
+ documentation_uri: https://www.rubydoc.info/gems/kettle-dev/1.2.4
421
421
  funding_uri: https://github.com/sponsors/pboling
422
422
  wiki_uri: https://github.com/kettle-rb/kettle-dev/wiki
423
423
  news_uri: https://www.railsbling.com/tags/kettle-dev
metadata.gz.sig CHANGED
Binary file