commenter 0.5.0 → 0.6.0
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/CONTEXT.md +2 -0
- data/README.adoc +13 -0
- data/lib/commenter/cli.rb +21 -0
- data/lib/commenter/version.rb +1 -1
- data/spec/commenter/cli_spec.rb +27 -0
- 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: e569c1e1d181c27078d97e4bcaa8a63c54b055aa7aff5dff88646be1237c6a65
|
|
4
|
+
data.tar.gz: 5d156b1e49c82c9b8002e47f7ab870d98e133622b4830768e02b9bf32c2db993
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66daebbb66df3c881828bccd0a36c8cb0e1c524d74c19efef579770f707a366c2f48a51b2871041dd3519db0b26ad4431f0065395b02d85685f08eed9862e39e
|
|
7
|
+
data.tar.gz: 6ea9b41315c94d87c8356350be9b55235d1dfd07e341bbbc133a6feea27b807f36ac9df05bc32430ed314c73c5b5c8a25d9e1ff5066beb0f36f90032c3b9330a
|
data/CONTEXT.md
CHANGED
|
@@ -31,3 +31,5 @@ keep this current when concepts sharpen.
|
|
|
31
31
|
policy, close dispositioned issues. `GitHubSync`.
|
|
32
32
|
- **Unique ID** — stage-aware identity of a comment's GitHub issue
|
|
33
33
|
(`[DIS] GB-001` by default), used for duplicate detection.
|
|
34
|
+
- **Out of scope** — CEN/CENELEC comment exports (decided 2026-08-29: we
|
|
35
|
+
don't have CEN; do not propose a CEN adapter again).
|
data/README.adoc
CHANGED
|
@@ -248,6 +248,19 @@ Comments are matched by ID and classified as new, withdrawn, repeated
|
|
|
248
248
|
(unchanged text), or revised; a comment whose later version carries a
|
|
249
249
|
disposition counts as resolved. Markdown (default) or `--format yaml`.
|
|
250
250
|
|
|
251
|
+
=== Exporting the final disposition document
|
|
252
|
+
|
|
253
|
+
One command for the ballot's last step — pull the observations recorded in
|
|
254
|
+
GitHub issues and write the completed comment sheet:
|
|
255
|
+
|
|
256
|
+
[source,shell]
|
|
257
|
+
----
|
|
258
|
+
commenter export comments.yaml --config github_config.yaml -o disposition.docx --shading
|
|
259
|
+
----
|
|
260
|
+
|
|
261
|
+
Retrieves observations from closed issues (updating the YAML), then fills the
|
|
262
|
+
template with sheet metadata, comments, observations, and status shading.
|
|
263
|
+
|
|
251
264
|
=== Filling DOCX templates from YAML
|
|
252
265
|
|
|
253
266
|
This gem contains a command-line utility to fill a DOCX template with comments
|
data/lib/commenter/cli.rb
CHANGED
|
@@ -110,6 +110,27 @@ module Commenter
|
|
|
110
110
|
puts "Filled template to #{output_docx}"
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
+
desc "export INPUT.yaml", "Retrieve observations from GitHub issues and write the final disposition DOCX"
|
|
114
|
+
option :config, type: :string, aliases: :c, required: true, desc: "GitHub configuration YAML file"
|
|
115
|
+
option :output, type: :string, aliases: :o, default: "disposition_comments.docx", desc: "Output DOCX file"
|
|
116
|
+
option :template, type: :string, aliases: :t, desc: "Custom template file"
|
|
117
|
+
option :shading, type: :boolean, aliases: :s, desc: "Apply status-based shading"
|
|
118
|
+
option :include_open, type: :boolean, desc: "Include observations from open issues (not recommended)"
|
|
119
|
+
def export(input_yaml)
|
|
120
|
+
retriever = GitHubIssueRetriever.new(options[:config])
|
|
121
|
+
retriever.retrieve_observations_from_yaml(input_yaml, include_open: options[:include_open])
|
|
122
|
+
|
|
123
|
+
comment_sheet = CommentSheet.from_yaml(File.read(input_yaml))
|
|
124
|
+
raise "No comments found in YAML file" if comment_sheet.comments.empty?
|
|
125
|
+
|
|
126
|
+
template_path = options[:template] || File.join(__dir__, "../../data/iso_comment_template_2012-03.docx")
|
|
127
|
+
fill_options = options.merge(
|
|
128
|
+
date: comment_sheet.date, document: comment_sheet.document, project: comment_sheet.project
|
|
129
|
+
).compact
|
|
130
|
+
Filler.new.fill(template_path, options[:output], comment_sheet.comments, fill_options)
|
|
131
|
+
puts "Retrieved observations and wrote disposition sheet to #{options[:output]}"
|
|
132
|
+
end
|
|
133
|
+
|
|
113
134
|
desc "github-create INPUT.yaml", "Create GitHub issues from comments"
|
|
114
135
|
option :config, type: :string, aliases: :c, required: true, desc: "GitHub configuration YAML file"
|
|
115
136
|
option :output, type: :string, aliases: :o, desc: "Output YAML file (default: update original)"
|
data/lib/commenter/version.rb
CHANGED
data/spec/commenter/cli_spec.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "spec_helper"
|
|
4
|
+
require "zip"
|
|
4
5
|
require "commenter/cli"
|
|
5
6
|
require_relative "../support/osd_fixtures"
|
|
6
7
|
require_relative "../support/xlsx_builder"
|
|
@@ -74,3 +75,29 @@ RSpec.describe Commenter::Cli do
|
|
|
74
75
|
end
|
|
75
76
|
end
|
|
76
77
|
end
|
|
78
|
+
|
|
79
|
+
RSpec.describe Commenter::Cli do
|
|
80
|
+
describe "#export" do
|
|
81
|
+
it "retrieves observations and writes the disposition DOCX" do
|
|
82
|
+
Dir.mktmpdir do |dir|
|
|
83
|
+
config = File.join(dir, "config.yaml")
|
|
84
|
+
File.write(config, { "github" => { "repository" => "t/t", "token" => "dummy" } }.to_yaml)
|
|
85
|
+
input = File.join(dir, "comments.yaml")
|
|
86
|
+
File.write(input, {
|
|
87
|
+
"version" => "2012-03", "date" => "2026-08-29", "document" => "ISO 2533:2026",
|
|
88
|
+
"comments" => [{ "id" => "DE-001", "body" => "DE", "comments" => "Remark",
|
|
89
|
+
"observations" => "Accepted." }]
|
|
90
|
+
}.to_yaml)
|
|
91
|
+
output = File.join(dir, "disposition.docx")
|
|
92
|
+
|
|
93
|
+
described_class.start(["export", input, "--config", config, "--output", output])
|
|
94
|
+
|
|
95
|
+
expect(File).to exist(output)
|
|
96
|
+
header = Zip::File.open(output) do |zip|
|
|
97
|
+
zip.entries.find { |e| e.name == "word/header2.xml" }.get_input_stream(&:read)
|
|
98
|
+
end
|
|
99
|
+
expect(header).to include("Date: 2026-08-29")
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|