kettle-changelog 1.0.15 → 1.0.17
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +37 -1
- data/README.md +16 -2
- data/exe/kettle-changelog +33 -2
- data/lib/kettle/changelog/release.rb +117 -0
- data/lib/kettle/changelog/release_stats.rb +56 -0
- data/lib/kettle/changelog/version.rb +1 -1
- data/lib/kettle/changelog.rb +2 -0
- data.tar.gz.sig +0 -0
- metadata +11 -9
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee6b07a027f22c0e6c360ac67be49800b54ffac928d2d73d3454274b85777851
|
|
4
|
+
data.tar.gz: f0d9d01c8cdcb82e7c735a0c291d94eccfa8ad4fc7f8b2579a4303bd9b837ab9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f42ce068435ac53abd52e44db3e96628be8edcb73480bb06b2fd12c31af752141c8510367dccbee022f176e4eaa783b6386c643db72ebca6b7f1c0b7cf563b87
|
|
7
|
+
data.tar.gz: 768171e1a51cccf8d25efa3c20a6ba2aac758eb130a980c5f5b992030b14ac334572c918be4261292c0e46ade5a0e646232922252f58486b6f23d33752ed0622
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,38 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [1.0.17] - 2026-11-08
|
|
34
|
+
|
|
35
|
+
- TAG: [v1.0.17][1.0.17t]
|
|
36
|
+
- COVERAGE: 93.62% -- 1263/1349 lines in 8 files
|
|
37
|
+
- BRANCH COVERAGE: 78.31% -- 462/590 branches in 8 files
|
|
38
|
+
- 36.73% documented
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- Extract a selected changelog release as structured JSON with `--release` or `--latest`, including matching major and minor version ranges.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- [kc] kettle-jem/prepare: updated 11 project files:
|
|
47
|
+
- dependencies (11)
|
|
48
|
+
|
|
49
|
+
- [kc] kettle-jem/template: updated 5 project files:
|
|
50
|
+
- dependencies (3)
|
|
51
|
+
- other (1)
|
|
52
|
+
- workflows (1)
|
|
53
|
+
|
|
54
|
+
## [1.0.16] - 2026-11-03
|
|
55
|
+
|
|
56
|
+
- TAG: [v1.0.16][1.0.16t]
|
|
57
|
+
- COVERAGE: 93.68% -- 1185/1265 lines in 7 files
|
|
58
|
+
- BRANCH COVERAGE: 77.96% -- 421/540 branches in 7 files
|
|
59
|
+
- 36.36% documented
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
|
|
63
|
+
- `kettle-changelog --release-stats [--file PATH] [--json]` reads the latest released section's coverage, branch coverage and documentation stats back out of a changelog (read-only: no project root, git or network; reads stdin when `--file` is omitted). Only the exact generated line shapes count, `[Unreleased]` and older releases are ignored, and it exits 1 when line coverage is not recorded. Backed by `Kettle::Changelog::ReleaseStats.parse`.
|
|
64
|
+
|
|
33
65
|
## [1.0.15] - 2026-10-28
|
|
34
66
|
|
|
35
67
|
- TAG: [v1.0.15][1.0.15t]
|
|
@@ -357,7 +389,11 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
357
389
|
|
|
358
390
|
- Initial release
|
|
359
391
|
|
|
360
|
-
[Unreleased]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.
|
|
392
|
+
[Unreleased]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.17...HEAD
|
|
393
|
+
[1.0.17]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.16...v1.0.17
|
|
394
|
+
[1.0.17t]: https://github.com/kettle-dev/kettle-changelog/releases/tag/v1.0.17
|
|
395
|
+
[1.0.16]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.15...v1.0.16
|
|
396
|
+
[1.0.16t]: https://github.com/kettle-dev/kettle-changelog/releases/tag/v1.0.16
|
|
361
397
|
[1.0.15]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.14...v1.0.15
|
|
362
398
|
[1.0.15t]: https://github.com/kettle-dev/kettle-changelog/releases/tag/v1.0.15
|
|
363
399
|
[1.0.14]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.13...v1.0.14
|
data/README.md
CHANGED
|
@@ -132,7 +132,21 @@ Use `--yes` for non-interactive release automation. Add a note without preparing
|
|
|
132
132
|
bundle exec kettle-changelog --add-unreleased-entry --section Fixed --entry "Describe the fix."
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
Extract a specific release without modifying the changelog:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
bundle exec kettle-changelog --release v1.2.3 --file CHANGELOG.md
|
|
139
|
+
# Or pipe Markdown to stdin:
|
|
140
|
+
cat CHANGELOG.md | bundle exec kettle-changelog --release 1.2.3
|
|
141
|
+
# Select every release in a major or minor version:
|
|
142
|
+
bundle exec kettle-changelog --release v3.2 --file CHANGELOG.md
|
|
143
|
+
# Select the first published release instead:
|
|
144
|
+
bundle exec kettle-changelog --latest --file CHANGELOG.md
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`--latest` and `--release` are mutually exclusive. A one- or two-segment version (such as `3` or `v3.2`) returns an array of matching releases in changelog order; full versions and `--latest` return one object. Both forms accept an optional `v` prefix. No matches exit nonzero. The command prints JSON with `version`, `date`, `tag`, `markdown`, `coverage`, `branch_coverage`, and `documented`. Missing metadata is `null`. The Markdown body excludes the release heading and contains its referenced link definitions, found anywhere in the changelog. Shared definitions are included independently in each matching release. Release headings must be level two and contain a three-part version, optionally prefixed with `v` and followed by a date and tag link. A subsequent level-two heading or a level-three community, sponsorship, funding, contributing, acknowledgments, or license heading ends the release. Missing or ambiguous releases and invalid input exit nonzero. The Ruby API is `Kettle::Changelog::Release.extract(content: markdown, version: "1.2.3")` and raises `Kettle::Changelog::Error` on failure.
|
|
148
|
+
|
|
149
|
+
Useful queries and maintenance commands include `--pending-release`, `--release-state`, `--release-stats`, `--reformat`, `--update-prep`, `--json`, and `--events=changelog`. Run `bundle exec kettle-changelog --help` for the complete option list.
|
|
136
150
|
|
|
137
151
|
## 🔐 Security
|
|
138
152
|
|
|
@@ -383,7 +397,7 @@ Thanks for RTFM. ☺️
|
|
|
383
397
|
[📌gitmoji]: https://gitmoji.dev
|
|
384
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
|
|
385
399
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
386
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-1.
|
|
400
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-1.349-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
387
401
|
[🔐security]: https://github.com/kettle-dev/kettle-changelog/blob/main/SECURITY.md
|
|
388
402
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
389
403
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
data/exe/kettle-changelog
CHANGED
|
@@ -53,7 +53,7 @@ begin
|
|
|
53
53
|
require "kettle/ndjson"
|
|
54
54
|
require "kettle/dev/executable_version"
|
|
55
55
|
Kettle::Dev::ExecutableVersion.print_and_exit!(script_basename, ARGV, value_option: true)
|
|
56
|
-
machine_output = ARGV.any? { |arg| arg == "--json" || arg.start_with?("--events") }
|
|
56
|
+
machine_output = ARGV.any? { |arg| arg == "--json" || arg == "--latest" || arg == "--release" || arg.start_with?("--release=") || arg.start_with?("--events") }
|
|
57
57
|
Kettle::Dev::ExecutableVersion.print_header(script_basename) unless machine_output
|
|
58
58
|
rescue LoadError => e
|
|
59
59
|
warn("#{script_basename}: could not load dependency: #{e.class}: #{e.message}")
|
|
@@ -63,7 +63,7 @@ end
|
|
|
63
63
|
|
|
64
64
|
if ARGV.include?("-h") || ARGV.include?("--help")
|
|
65
65
|
puts <<~USAGE
|
|
66
|
-
Usage: kettle-changelog [--version VERSION] [--yes] [--coverage-gemfile PATH] [--update-prep|--reformat|--backfill-released-version VERSION] [--pending-release] [--release-state] [--refresh-cache] [--add-unreleased-entry --section SECTION --entry TEXT] [--upsert-unreleased-entry --section SECTION --key KEY --entry TEXT] [--json|--events[=TYPES]] [--no-strict] [--no-coverage-threshold]
|
|
66
|
+
Usage: kettle-changelog [--version VERSION] [--yes] [--coverage-gemfile PATH] [--update-prep|--reformat|--backfill-released-version VERSION] [--pending-release] [--release-state] [--release-stats [--file PATH]] [--refresh-cache] [--add-unreleased-entry --section SECTION --entry TEXT] [--upsert-unreleased-entry --section SECTION --key KEY --entry TEXT] [--json|--events[=TYPES]] [--no-strict] [--no-coverage-threshold]
|
|
67
67
|
|
|
68
68
|
Detects the current version from lib/**/version.rb, the latest live release, and
|
|
69
69
|
the most recent CHANGELOG.md release section, then prompts to confirm the selected plan:
|
|
@@ -82,6 +82,10 @@ if ARGV.include?("-h") || ARGV.include?("--help")
|
|
|
82
82
|
--pending-release Query whether the changelog has release work pending; exits 0 for yes, 1 for no
|
|
83
83
|
--release-state,
|
|
84
84
|
--release-status Print changelog release state, including latest published release and pending sources
|
|
85
|
+
--release VERSION Extract matching release(s) as JSON (full, major, or major.minor; --file or stdin)
|
|
86
|
+
--latest Extract the latest release as JSON (read-only; --file PATH or stdin)
|
|
87
|
+
--release-stats Print the latest released section's coverage/doc stats from a changelog (read-only;
|
|
88
|
+
--file PATH or stdin; add --json; exits 1 when line coverage is not recorded)
|
|
85
89
|
--refresh-cache Bypass cached gem.coop version data for this invocation
|
|
86
90
|
--add-unreleased-entry Add one entry to an existing section under ## [Unreleased]
|
|
87
91
|
--upsert-unreleased-entry Insert or replace one [kc]-keyed entry under ## [Unreleased]
|
|
@@ -209,6 +213,33 @@ begin
|
|
|
209
213
|
|
|
210
214
|
historical_backfill_version = extract_option_arg!(ARGV, "--backfill-released-version")
|
|
211
215
|
coverage_gemfile = extract_option_arg!(ARGV, "--coverage-gemfile")
|
|
216
|
+
release_version = extract_option_arg!(ARGV, "--release")
|
|
217
|
+
latest_release = ARGV.delete("--latest")
|
|
218
|
+
release_stats_query = ARGV.delete("--release-stats")
|
|
219
|
+
release_stats_file = extract_option_arg!(ARGV, "--file")
|
|
220
|
+
|
|
221
|
+
if release_version || latest_release
|
|
222
|
+
raise Kettle::Changelog::Error, "--release cannot be combined with other options" unless ARGV.empty? && !release_stats_query && !version_override && !events_output
|
|
223
|
+
text = (release_stats_file.nil? || release_stats_file == "-") ? $stdin.read : File.read(release_stats_file)
|
|
224
|
+
puts JSON.pretty_generate(Kettle::Changelog::Release.extract(content: text, version: release_version, latest: !!latest_release))
|
|
225
|
+
exit 0
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
if release_stats_query
|
|
229
|
+
# Read-only: no project root, git, network or version detection. Reads --file PATH, or stdin when absent/"-".
|
|
230
|
+
text = (release_stats_file.nil? || release_stats_file == "-") ? $stdin.read : File.read(release_stats_file)
|
|
231
|
+
stats = Kettle::Changelog::ReleaseStats.parse(text)
|
|
232
|
+
if json_output
|
|
233
|
+
puts(JSON.pretty_generate(stats))
|
|
234
|
+
elsif stats
|
|
235
|
+
cov = stats[:coverage]
|
|
236
|
+
released = [stats[:version], stats[:date] && "(#{stats[:date]})"].compact.join(" ")
|
|
237
|
+
puts("#{released}: " + (cov ? "#{format("%.2f", cov[:percent])}% line coverage (#{cov[:covered]}/#{cov[:total]} lines in #{cov[:files]} files)" : "no line coverage recorded"))
|
|
238
|
+
else
|
|
239
|
+
puts("No released section found.")
|
|
240
|
+
end
|
|
241
|
+
exit((stats && stats[:coverage]) ? 0 : 1)
|
|
242
|
+
end
|
|
212
243
|
|
|
213
244
|
if upsert_unreleased_entry
|
|
214
245
|
section = extract_option_arg!(ARGV, "--section")
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kettle
|
|
4
|
+
module Changelog
|
|
5
|
+
# Extracts releases without changing the input document.
|
|
6
|
+
module Release
|
|
7
|
+
HEADING = /\A(?:\[)?(v?\d+\.\d+\.\d+[0-9A-Za-z.+-]*)(?:\])?(?:\s+(?:-\s+)?(\d{4}-\d{2}-\d{2}))?(?:\s+\([^\n]*\))?\s*\z/
|
|
8
|
+
DEFINITION = /\A {0,3}\[([^\]]+)\]:[ \t]*(.*)$/
|
|
9
|
+
FOOTER = /\A(?:community|sponsors?|sponsorship|support(?:ers| us)?|funding|contributing|contributors|acknowledg(?:e)?ments|license)\b/i
|
|
10
|
+
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
# @param content [String] Markdown changelog
|
|
14
|
+
# @param version [String] release version or tag (with or without v)
|
|
15
|
+
# @return [Hash, Array<Hash>] a release, or matching releases for a partial version
|
|
16
|
+
# @raise [Kettle::Changelog::Error] when extraction is ambiguous or fails
|
|
17
|
+
def extract(content:, version: nil, latest: false, **options)
|
|
18
|
+
raise Error, "changelog must be a valid nonempty UTF-8 string" unless content.is_a?(String) && content.valid_encoding? && !content.strip.empty?
|
|
19
|
+
raise Error, "specify a version or latest" unless latest != !version.nil?
|
|
20
|
+
valid_version = version.is_a?(String) && version.match?(/\Av?(?:\d+|\d+\.\d+|\d+\.\d+\.\d+[0-9A-Za-z.+-]*)\z/)
|
|
21
|
+
raise Error, "version must be a release version or tag" if !latest && !valid_version
|
|
22
|
+
|
|
23
|
+
require "ast/crispr/markdown/markly"
|
|
24
|
+
context = Ast::Crispr::Markdown::Markly.document_context(content: content, source_label: "changelog")
|
|
25
|
+
headings = context.structural_owners(owner_scope: :heading_sections).sort_by { |owner| owner.location.start_line }
|
|
26
|
+
partial = !latest && version.match?(/\Av?\d+(?:\.\d+)?\z/)
|
|
27
|
+
requested = version&.delete_prefix("v")
|
|
28
|
+
matches = headings.select do |heading|
|
|
29
|
+
match = heading.heading_text.to_s.strip.match(HEADING)
|
|
30
|
+
release_version = match && match[1].delete_prefix("v")
|
|
31
|
+
heading.level == 2 && match && (latest || (partial ? release_version.start_with?("#{requested}.") : release_version == requested))
|
|
32
|
+
end
|
|
33
|
+
matches = matches.first(1) if latest
|
|
34
|
+
raise Error, "no release found for #{latest ? "latest" : version.inspect}" if matches.empty?
|
|
35
|
+
versions = matches.map { |heading| heading.heading_text.to_s.strip.match(HEADING)[1].delete_prefix("v") }
|
|
36
|
+
raise Error, "ambiguous release for #{version.inspect}" if versions.uniq.length != versions.length || (!partial && matches.length != 1)
|
|
37
|
+
|
|
38
|
+
releases = matches.map { |selected| extract_heading(content, headings, selected) }
|
|
39
|
+
partial ? releases : releases.first
|
|
40
|
+
rescue LoadError => e
|
|
41
|
+
raise Error, "release extraction requires the Markdown parser: #{e.message}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def extract_heading(content, headings, selected)
|
|
45
|
+
heading_match = selected.heading_text.to_s.strip.match(HEADING)
|
|
46
|
+
start = selected.location.start_line
|
|
47
|
+
boundary = headings.find do |heading|
|
|
48
|
+
heading.location.start_line > start && (heading.level <= 2 || (heading.level == 3 && heading.heading_text.to_s.strip.match?(FOOTER)))
|
|
49
|
+
end
|
|
50
|
+
lines = content.lines
|
|
51
|
+
finish = boundary ? boundary.location.start_line - 1 : lines.length
|
|
52
|
+
body_lines = lines[start...finish].to_a
|
|
53
|
+
# Reference definitions are document scoped; remove them from the body and append only those used.
|
|
54
|
+
definitions = {}
|
|
55
|
+
definition_lines = []
|
|
56
|
+
fence = nil
|
|
57
|
+
lines.each_with_index do |line, index|
|
|
58
|
+
marker = line[/\A {0,3}(`{3,}|~{3,})/, 1]
|
|
59
|
+
if marker
|
|
60
|
+
if fence.nil?
|
|
61
|
+
fence = marker
|
|
62
|
+
elsif marker[0] == fence[0] && marker.length >= fence.length
|
|
63
|
+
fence = nil
|
|
64
|
+
end
|
|
65
|
+
next
|
|
66
|
+
end
|
|
67
|
+
next if fence
|
|
68
|
+
|
|
69
|
+
match = line.match(DEFINITION)
|
|
70
|
+
next unless match
|
|
71
|
+
|
|
72
|
+
definition = line.dup
|
|
73
|
+
indices = [index]
|
|
74
|
+
continuation = index + 1
|
|
75
|
+
if match[2].strip.empty?
|
|
76
|
+
destination = lines[continuation]
|
|
77
|
+
next unless destination&.match?(/\A {1,3}\S/)
|
|
78
|
+
|
|
79
|
+
definition << destination
|
|
80
|
+
indices << continuation
|
|
81
|
+
continuation += 1
|
|
82
|
+
end
|
|
83
|
+
title = lines[continuation]
|
|
84
|
+
if title&.match?(/\A {1,3}(?:"[^"\n]*"|'[^'\n]*'|\([^()\n]*\))[ \t]*\r?\n?\z/)
|
|
85
|
+
definition << title
|
|
86
|
+
indices << continuation
|
|
87
|
+
end
|
|
88
|
+
definitions[normalize_label(match[1])] ||= definition
|
|
89
|
+
definition_lines.concat(indices)
|
|
90
|
+
end
|
|
91
|
+
body_lines = body_lines.each_with_index.reject { |_line, index| definition_lines.include?(start + index) }.map(&:first)
|
|
92
|
+
body = body_lines.join.strip
|
|
93
|
+
used = definitions.select do |label, _line|
|
|
94
|
+
body.scan(/\[([^\]]+)\](?:\[([^\]]*)\])?/).any? do |first, second|
|
|
95
|
+
normalize_label((second.nil? || second.empty?) ? first : second) == label
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
body = ([body] + used.values.map(&:strip)).reject(&:empty?).join("\n\n")
|
|
99
|
+
stats_heading = "## [#{heading_match[1].delete_prefix("v")}]"
|
|
100
|
+
stats_heading += " - #{heading_match[2]}" if heading_match[2]
|
|
101
|
+
stats = ReleaseStats.parse("#{stats_heading}\n#{body}")
|
|
102
|
+
tag = body[/^\s*-\s+TAG:\s*\[([^\]]+)\]/, 1]
|
|
103
|
+
heading_tag_ref = selected.heading_source.to_s[/\[tag\]\[([^\]]+)\]/i, 1]
|
|
104
|
+
if !tag && heading_tag_ref
|
|
105
|
+
tag = definitions[normalize_label(heading_tag_ref)].to_s[%r{/releases/tag/([^\s>]+)}, 1]
|
|
106
|
+
end
|
|
107
|
+
{version: heading_match[1].delete_prefix("v"), date: heading_match[2], tag: tag, markdown: body.empty? ? "" : "#{body}\n", coverage: stats[:coverage], branch_coverage: stats[:branch_coverage], documented: stats[:documented]}
|
|
108
|
+
end
|
|
109
|
+
private_class_method :extract_heading
|
|
110
|
+
|
|
111
|
+
def normalize_label(label)
|
|
112
|
+
label.to_s.strip.gsub(/\s+/, " ").downcase
|
|
113
|
+
end
|
|
114
|
+
private_class_method :normalize_label
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kettle
|
|
4
|
+
module Changelog
|
|
5
|
+
# Reads the generated stats back out of a changelog's latest released section.
|
|
6
|
+
#
|
|
7
|
+
# The writer (CLI) puts these lines directly under each release heading:
|
|
8
|
+
#
|
|
9
|
+
# ## [2.1.0] - 2026-10-25
|
|
10
|
+
# - TAG: [v2.1.0][2.1.0t]
|
|
11
|
+
# - COVERAGE: 98.48% -- 649/659 lines in 16 files
|
|
12
|
+
# - BRANCH COVERAGE: 93.53% -- 217/232 branches in 16 files
|
|
13
|
+
# - 90.83% documented
|
|
14
|
+
#
|
|
15
|
+
# Only these exact shapes count. `[Unreleased]` is ignored, and so are older releases: a gem whose
|
|
16
|
+
# latest release lacks the lines reports nothing rather than a stale number from an earlier one.
|
|
17
|
+
module ReleaseStats
|
|
18
|
+
NUMBER = '(\d+(?:\.\d+)?)'
|
|
19
|
+
RELEASE_HEADING = /\A## \[(\d+\.\d+\.\d+[0-9A-Za-z.+-]*)\](?: - (\d{4}-\d{2}-\d{2}))?/
|
|
20
|
+
LINE_COVERAGE = /\A- COVERAGE: #{NUMBER}% -- (\d+)\/(\d+) lines in (\d+) files\s*\z/
|
|
21
|
+
BRANCH_COVERAGE = /\A- BRANCH COVERAGE: #{NUMBER}% -- (\d+)\/(\d+) branches in (\d+) files\s*\z/
|
|
22
|
+
DOCUMENTED = /\A- #{NUMBER}%\s+documented\s*\z/
|
|
23
|
+
|
|
24
|
+
module_function
|
|
25
|
+
|
|
26
|
+
# @param text [String] full CHANGELOG.md contents
|
|
27
|
+
# @return [Hash, nil] nil when the changelog has no released section; otherwise
|
|
28
|
+
# {version:, date:, coverage:, branch_coverage:, documented:} with nil for anything not found
|
|
29
|
+
def parse(text)
|
|
30
|
+
lines = text.to_s.lines
|
|
31
|
+
start = lines.index { |l| l.match?(RELEASE_HEADING) }
|
|
32
|
+
return unless start
|
|
33
|
+
|
|
34
|
+
heading = lines[start].match(RELEASE_HEADING)
|
|
35
|
+
stats = {version: heading[1], date: heading[2], coverage: nil, branch_coverage: nil, documented: nil}
|
|
36
|
+
lines[(start + 1)..].each do |line|
|
|
37
|
+
break if line.start_with?("#") # next heading, or the first ### subsection: the stats lines come before both
|
|
38
|
+
|
|
39
|
+
if (m = line.match(LINE_COVERAGE))
|
|
40
|
+
stats[:coverage] ||= counts(m)
|
|
41
|
+
elsif (m = line.match(BRANCH_COVERAGE))
|
|
42
|
+
stats[:branch_coverage] ||= counts(m)
|
|
43
|
+
elsif (m = line.match(DOCUMENTED))
|
|
44
|
+
stats[:documented] ||= m[1].to_f
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
stats
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def counts(match)
|
|
51
|
+
{percent: match[1].to_f, covered: match[2].to_i, total: match[3].to_i, files: match[4].to_i}
|
|
52
|
+
end
|
|
53
|
+
private_class_method :counts
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -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.
|
|
8
|
+
VERSION = "1.0.17"
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/kettle/changelog.rb
CHANGED
|
@@ -10,6 +10,8 @@ module Kettle
|
|
|
10
10
|
|
|
11
11
|
autoload :CLI, "kettle/changelog/cli"
|
|
12
12
|
autoload :EntryAdder, "kettle/changelog/entry_adder"
|
|
13
|
+
autoload :Release, "kettle/changelog/release"
|
|
14
|
+
autoload :ReleaseStats, "kettle/changelog/release_stats"
|
|
13
15
|
autoload :KeyedEntryUpserter, "kettle/changelog/keyed_entry_upserter"
|
|
14
16
|
autoload :TransferMerger, "kettle/changelog/transfer_merger"
|
|
15
17
|
end
|
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.
|
|
4
|
+
version: 1.0.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -66,7 +66,7 @@ dependencies:
|
|
|
66
66
|
version: '3.1'
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: 3.1.
|
|
69
|
+
version: 3.1.27
|
|
70
70
|
type: :runtime
|
|
71
71
|
prerelease: false
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -76,7 +76,7 @@ dependencies:
|
|
|
76
76
|
version: '3.1'
|
|
77
77
|
- - ">="
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: 3.1.
|
|
79
|
+
version: 3.1.27
|
|
80
80
|
- !ruby/object:Gem::Dependency
|
|
81
81
|
name: version_gem
|
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -194,7 +194,7 @@ dependencies:
|
|
|
194
194
|
version: '2.0'
|
|
195
195
|
- - ">="
|
|
196
196
|
- !ruby/object:Gem::Version
|
|
197
|
-
version: 2.0.
|
|
197
|
+
version: 2.0.29
|
|
198
198
|
type: :development
|
|
199
199
|
prerelease: false
|
|
200
200
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -204,7 +204,7 @@ dependencies:
|
|
|
204
204
|
version: '2.0'
|
|
205
205
|
- - ">="
|
|
206
206
|
- !ruby/object:Gem::Version
|
|
207
|
-
version: 2.0.
|
|
207
|
+
version: 2.0.29
|
|
208
208
|
- !ruby/object:Gem::Dependency
|
|
209
209
|
name: turbo_tests2
|
|
210
210
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -296,6 +296,8 @@ files:
|
|
|
296
296
|
- lib/kettle/changelog/cli.rb
|
|
297
297
|
- lib/kettle/changelog/entry_adder.rb
|
|
298
298
|
- lib/kettle/changelog/keyed_entry_upserter.rb
|
|
299
|
+
- lib/kettle/changelog/release.rb
|
|
300
|
+
- lib/kettle/changelog/release_stats.rb
|
|
299
301
|
- lib/kettle/changelog/transfer_merger.rb
|
|
300
302
|
- lib/kettle/changelog/version.rb
|
|
301
303
|
- sig/kettle/changelog.rbs
|
|
@@ -304,10 +306,10 @@ licenses:
|
|
|
304
306
|
- AGPL-3.0-only
|
|
305
307
|
metadata:
|
|
306
308
|
homepage_uri: https://kettle-changelog.galtzo.com
|
|
307
|
-
source_code_uri: https://github.com/kettle-dev/kettle-changelog/tree/v1.0.
|
|
308
|
-
changelog_uri: https://github.com/kettle-dev/kettle-changelog/blob/v1.0.
|
|
309
|
+
source_code_uri: https://github.com/kettle-dev/kettle-changelog/tree/v1.0.17
|
|
310
|
+
changelog_uri: https://github.com/kettle-dev/kettle-changelog/blob/v1.0.17/CHANGELOG.md
|
|
309
311
|
bug_tracker_uri: https://github.com/kettle-dev/kettle-changelog/issues
|
|
310
|
-
documentation_uri: https://www.rubydoc.info/gems/kettle-changelog/1.0.
|
|
312
|
+
documentation_uri: https://www.rubydoc.info/gems/kettle-changelog/1.0.17
|
|
311
313
|
funding_uri: https://github.com/sponsors/pboling
|
|
312
314
|
wiki_uri: https://github.com/kettle-dev/kettle-changelog/wiki
|
|
313
315
|
news_uri: https://www.railsbling.com/tags/kettle-changelog
|
|
@@ -337,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
337
339
|
- !ruby/object:Gem::Version
|
|
338
340
|
version: '0'
|
|
339
341
|
requirements: []
|
|
340
|
-
rubygems_version: 4.0.
|
|
342
|
+
rubygems_version: 4.0.24
|
|
341
343
|
specification_version: 4
|
|
342
344
|
summary: "\U0001F4DD Release and maintain structured CHANGELOG.md files."
|
|
343
345
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|