suma 0.2.5 → 0.3.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/.github/workflows/rake.yml +3 -0
- data/.github/workflows/release.yml +5 -1
- data/.gitignore +10 -1
- data/.rubocop_todo.yml +237 -28
- data/CLAUDE.md +102 -0
- data/Gemfile +3 -1
- data/README.adoc +188 -1
- data/exe/suma +1 -1
- data/lib/suma/cli/build.rb +2 -8
- data/lib/suma/cli/check_svg_quality.rb +172 -0
- data/lib/suma/cli/compare.rb +6 -158
- data/lib/suma/cli/convert_jsdai.rb +0 -2
- data/lib/suma/cli/core.rb +119 -0
- data/lib/suma/cli/export.rb +1 -10
- data/lib/suma/cli/extract_terms.rb +10 -654
- data/lib/suma/cli/generate_register.rb +34 -0
- data/lib/suma/cli/generate_schemas.rb +8 -124
- data/lib/suma/cli/reformat.rb +0 -1
- data/lib/suma/cli/validate.rb +0 -2
- data/lib/suma/cli/validate_links.rb +14 -291
- data/lib/suma/cli.rb +12 -102
- data/lib/suma/collection_config.rb +0 -2
- data/lib/suma/collection_manifest.rb +7 -111
- data/lib/suma/eengine/wrapper.rb +0 -1
- data/lib/suma/eengine.rb +8 -0
- data/lib/suma/express_schema.rb +43 -31
- data/lib/suma/jsdai/figure.rb +0 -3
- data/lib/suma/jsdai/figure_xml.rb +12 -9
- data/lib/suma/jsdai.rb +5 -8
- data/lib/suma/link_validator.rb +211 -0
- data/lib/suma/manifest_traverser.rb +92 -0
- data/lib/suma/processor.rb +76 -105
- data/lib/suma/register_manifest_generator.rb +163 -0
- data/lib/suma/schema_category.rb +83 -0
- data/lib/suma/schema_collection.rb +28 -63
- data/lib/suma/schema_comparer.rb +117 -0
- data/lib/suma/schema_compiler.rb +86 -0
- data/lib/suma/schema_discovery.rb +75 -0
- data/lib/suma/schema_exporter.rb +7 -35
- data/lib/suma/schema_index.rb +53 -0
- data/lib/suma/schema_manifest_generator.rb +113 -0
- data/lib/suma/schema_naming.rb +111 -0
- data/lib/suma/schema_template/document.rb +141 -0
- data/lib/suma/schema_template/plain.rb +46 -0
- data/lib/suma/schema_template.rb +19 -0
- data/lib/suma/svg_quality/batch_report.rb +78 -0
- data/lib/suma/svg_quality/formatters/json_formatter.rb +30 -0
- data/lib/suma/svg_quality/formatters/terminal_formatter.rb +168 -0
- data/lib/suma/svg_quality/formatters/yaml_formatter.rb +32 -0
- data/lib/suma/svg_quality/formatters.rb +12 -0
- data/lib/suma/svg_quality/report.rb +52 -0
- data/lib/suma/svg_quality.rb +30 -0
- data/lib/suma/term_extractor.rb +466 -0
- data/lib/suma/urn.rb +61 -0
- data/lib/suma/utils.rb +10 -2
- data/lib/suma/version.rb +1 -1
- data/lib/suma.rb +34 -5
- data/suma.gemspec +3 -2
- metadata +53 -9
- data/lib/suma/export_standalone_schema.rb +0 -14
- data/lib/suma/schema_attachment.rb +0 -130
- data/lib/suma/schema_document.rb +0 -132
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 041f227f2bd35c3d90138ab621e51b9abf68206f7b295523da2827d82d6b63c7
|
|
4
|
+
data.tar.gz: f64aed0f1f4aa096d66c4c299581a2437a991fe6f522b50170b26557b81a0092
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac0d654f283a393c6ae620763920decec16ce2bad44c5cc5722f123bf12ee7539069e35dbbb4909f061fdb14e240f26f033d04e357cfdaff814966cc5f185f8b
|
|
7
|
+
data.tar.gz: a2a4ca844993d87bc534c77d99e5767aa0f6f86b1f028a15c9a9387ddc761303fcef390a3fe98dce907580b8da1657bb83f96d7c4d0cdd0e03f59d690a1c688f
|
data/.github/workflows/rake.yml
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
name: release
|
|
4
4
|
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
packages: write
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
5
10
|
on:
|
|
6
11
|
workflow_dispatch:
|
|
7
12
|
inputs:
|
|
@@ -22,4 +27,3 @@ jobs:
|
|
|
22
27
|
secrets:
|
|
23
28
|
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
|
24
29
|
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
|
25
|
-
|
data/.gitignore
CHANGED
|
@@ -11,4 +11,13 @@
|
|
|
11
11
|
.rspec_status
|
|
12
12
|
.rubocop-https---*-yml
|
|
13
13
|
.ruby-version
|
|
14
|
-
Gemfile.lock
|
|
14
|
+
Gemfile.lock
|
|
15
|
+
|
|
16
|
+
# local planning scratch directories (not for commit)
|
|
17
|
+
/TODO.clean/
|
|
18
|
+
/TODO.cleanup/
|
|
19
|
+
/TODO.refactor/
|
|
20
|
+
/TODO.remaining/
|
|
21
|
+
|
|
22
|
+
# vendored gems (use Gemfile / Gemfile.lock elsewhere)
|
|
23
|
+
/*.gem
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,35 +1,168 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2026-07-02 16:27:30 UTC using RuboCop version 1.87.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
9
|
# Offense count: 3
|
|
10
|
-
# Configuration parameters: Severity.
|
|
11
10
|
Gemspec/DuplicatedAssignment:
|
|
12
11
|
Exclude:
|
|
13
12
|
- 'suma.gemspec'
|
|
14
13
|
|
|
15
14
|
# Offense count: 1
|
|
16
|
-
# Configuration parameters: Severity.
|
|
17
15
|
Gemspec/RequiredRubyVersion:
|
|
18
16
|
Exclude:
|
|
19
17
|
- 'suma.gemspec'
|
|
20
18
|
|
|
21
|
-
# Offense count:
|
|
19
|
+
# Offense count: 35
|
|
22
20
|
# This cop supports safe autocorrection (--autocorrect).
|
|
23
|
-
# Configuration parameters:
|
|
21
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
22
|
+
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
23
|
+
Layout/ArgumentAlignment:
|
|
24
|
+
Exclude:
|
|
25
|
+
- 'lib/suma/link_validator.rb'
|
|
26
|
+
- 'lib/suma/schema_comparer.rb'
|
|
27
|
+
- 'lib/suma/schema_compiler.rb'
|
|
28
|
+
- 'lib/suma/schema_manifest_generator.rb'
|
|
29
|
+
- 'lib/suma/svg_quality/formatters.rb'
|
|
30
|
+
- 'lib/suma/term_extractor.rb'
|
|
31
|
+
- 'spec/suma/link_validator_spec.rb'
|
|
32
|
+
- 'spec/suma/manifest_traverser_spec.rb'
|
|
33
|
+
- 'spec/suma/register_manifest_generator_spec.rb'
|
|
34
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
35
|
+
- 'spec/suma/schema_comparer_spec.rb'
|
|
36
|
+
- 'spec/suma/schema_discovery_spec.rb'
|
|
37
|
+
- 'spec/suma/term_extractor_spec.rb'
|
|
38
|
+
|
|
39
|
+
# Offense count: 2
|
|
40
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
41
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
42
|
+
# SupportedStyles: with_first_element, with_fixed_indentation
|
|
43
|
+
Layout/ArrayAlignment:
|
|
44
|
+
Exclude:
|
|
45
|
+
- 'lib/suma/schema_naming.rb'
|
|
46
|
+
- 'spec/suma/register_manifest_generator_spec.rb'
|
|
47
|
+
|
|
48
|
+
# Offense count: 6
|
|
49
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
50
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
51
|
+
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
52
|
+
Layout/BlockAlignment:
|
|
53
|
+
Exclude:
|
|
54
|
+
- 'lib/suma/link_validator.rb'
|
|
55
|
+
- 'lib/suma/register_manifest_generator.rb'
|
|
56
|
+
- 'spec/suma/term_extractor_spec.rb'
|
|
57
|
+
|
|
58
|
+
# Offense count: 6
|
|
59
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
60
|
+
Layout/BlockEndNewline:
|
|
61
|
+
Exclude:
|
|
62
|
+
- 'lib/suma/link_validator.rb'
|
|
63
|
+
- 'lib/suma/register_manifest_generator.rb'
|
|
64
|
+
- 'spec/suma/term_extractor_spec.rb'
|
|
65
|
+
|
|
66
|
+
# Offense count: 3
|
|
67
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
68
|
+
# Configuration parameters: IndentationWidth.
|
|
69
|
+
Layout/ClosingParenthesisIndentation:
|
|
70
|
+
Exclude:
|
|
71
|
+
- 'lib/suma/schema_template/document.rb'
|
|
72
|
+
- 'spec/suma/link_validator_spec.rb'
|
|
73
|
+
- 'spec/suma/schema_index_spec.rb'
|
|
74
|
+
|
|
75
|
+
# Offense count: 3
|
|
76
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
77
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
78
|
+
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
79
|
+
Layout/FirstArgumentIndentation:
|
|
80
|
+
Exclude:
|
|
81
|
+
- 'lib/suma/schema_template/document.rb'
|
|
82
|
+
- 'spec/suma/link_validator_spec.rb'
|
|
83
|
+
- 'spec/suma/schema_index_spec.rb'
|
|
84
|
+
|
|
85
|
+
# Offense count: 6
|
|
86
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
87
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
88
|
+
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
|
89
|
+
Layout/FirstArrayElementIndentation:
|
|
90
|
+
Exclude:
|
|
91
|
+
- 'spec/suma/manifest_traverser_spec.rb'
|
|
92
|
+
|
|
93
|
+
# Offense count: 14
|
|
94
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
95
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
96
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
97
|
+
# SupportedColonStyles: key, separator, table
|
|
98
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
99
|
+
Layout/HashAlignment:
|
|
100
|
+
Exclude:
|
|
101
|
+
- 'lib/suma/schema_compiler.rb'
|
|
102
|
+
- 'lib/suma/term_extractor.rb'
|
|
103
|
+
- 'spec/suma/manifest_traverser_spec.rb'
|
|
104
|
+
|
|
105
|
+
# Offense count: 12
|
|
106
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
107
|
+
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
108
|
+
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
109
|
+
Layout/IndentationWidth:
|
|
110
|
+
Exclude:
|
|
111
|
+
- 'lib/suma/link_validator.rb'
|
|
112
|
+
- 'lib/suma/register_manifest_generator.rb'
|
|
113
|
+
- 'spec/suma/term_extractor_spec.rb'
|
|
114
|
+
|
|
115
|
+
# Offense count: 189
|
|
116
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
117
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
24
118
|
# URISchemes: http, https
|
|
25
119
|
Layout/LineLength:
|
|
26
120
|
Enabled: false
|
|
27
121
|
|
|
28
|
-
# Offense count:
|
|
122
|
+
# Offense count: 3
|
|
123
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
124
|
+
# Configuration parameters: EnforcedStyle.
|
|
125
|
+
# SupportedStyles: symmetrical, new_line, same_line
|
|
126
|
+
Layout/MultilineArrayBraceLayout:
|
|
127
|
+
Exclude:
|
|
128
|
+
- 'spec/suma/manifest_traverser_spec.rb'
|
|
129
|
+
|
|
130
|
+
# Offense count: 3
|
|
131
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
132
|
+
# Configuration parameters: EnforcedStyle.
|
|
133
|
+
# SupportedStyles: symmetrical, new_line, same_line
|
|
134
|
+
Layout/MultilineMethodCallBraceLayout:
|
|
135
|
+
Exclude:
|
|
136
|
+
- 'lib/suma/schema_template/document.rb'
|
|
137
|
+
- 'spec/suma/link_validator_spec.rb'
|
|
138
|
+
- 'spec/suma/schema_index_spec.rb'
|
|
139
|
+
|
|
140
|
+
# Offense count: 32
|
|
141
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
142
|
+
# Configuration parameters: AllowInHeredoc.
|
|
143
|
+
Layout/TrailingWhitespace:
|
|
144
|
+
Exclude:
|
|
145
|
+
- 'lib/suma/link_validator.rb'
|
|
146
|
+
- 'lib/suma/schema_comparer.rb'
|
|
147
|
+
- 'lib/suma/schema_compiler.rb'
|
|
148
|
+
- 'lib/suma/schema_manifest_generator.rb'
|
|
149
|
+
- 'lib/suma/schema_naming.rb'
|
|
150
|
+
- 'lib/suma/svg_quality/formatters.rb'
|
|
151
|
+
- 'lib/suma/term_extractor.rb'
|
|
152
|
+
- 'spec/suma/link_validator_spec.rb'
|
|
153
|
+
- 'spec/suma/manifest_traverser_spec.rb'
|
|
154
|
+
- 'spec/suma/register_manifest_generator_spec.rb'
|
|
155
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
156
|
+
- 'spec/suma/schema_comparer_spec.rb'
|
|
157
|
+
- 'spec/suma/schema_discovery_spec.rb'
|
|
158
|
+
- 'spec/suma/term_extractor_spec.rb'
|
|
159
|
+
|
|
160
|
+
# Offense count: 4
|
|
29
161
|
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
30
162
|
Lint/DuplicateBranch:
|
|
31
163
|
Exclude:
|
|
32
164
|
- 'lib/suma/jsdai/figure.rb'
|
|
165
|
+
- 'lib/suma/term_extractor.rb'
|
|
33
166
|
|
|
34
167
|
# Offense count: 1
|
|
35
168
|
Lint/DuplicateMethods:
|
|
@@ -41,48 +174,95 @@ Lint/IneffectiveAccessModifier:
|
|
|
41
174
|
Exclude:
|
|
42
175
|
- 'lib/suma/cli/export.rb'
|
|
43
176
|
|
|
44
|
-
# Offense count:
|
|
177
|
+
# Offense count: 1
|
|
178
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
179
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
|
|
180
|
+
# NotImplementedExceptions: NotImplementedError
|
|
181
|
+
Lint/UnusedMethodArgument:
|
|
182
|
+
Exclude:
|
|
183
|
+
- 'lib/suma/svg_quality.rb'
|
|
184
|
+
|
|
185
|
+
# Offense count: 32
|
|
45
186
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
46
187
|
Metrics/AbcSize:
|
|
47
188
|
Exclude:
|
|
48
|
-
- 'lib/suma/cli/
|
|
189
|
+
- 'lib/suma/cli/check_svg_quality.rb'
|
|
190
|
+
- 'lib/suma/cli/core.rb'
|
|
49
191
|
- 'lib/suma/jsdai/figure.rb'
|
|
50
192
|
- 'lib/suma/jsdai/figure_image.rb'
|
|
51
|
-
- 'lib/suma/
|
|
52
|
-
- 'lib/suma/
|
|
193
|
+
- 'lib/suma/link_validator.rb'
|
|
194
|
+
- 'lib/suma/manifest_traverser.rb'
|
|
195
|
+
- 'lib/suma/processor.rb'
|
|
196
|
+
- 'lib/suma/schema_collection.rb'
|
|
197
|
+
- 'lib/suma/schema_comparer.rb'
|
|
198
|
+
- 'lib/suma/schema_compiler.rb'
|
|
199
|
+
- 'lib/suma/schema_manifest_generator.rb'
|
|
200
|
+
- 'lib/suma/schema_template/document.rb'
|
|
201
|
+
- 'lib/suma/svg_quality/formatters/terminal_formatter.rb'
|
|
202
|
+
- 'lib/suma/term_extractor.rb'
|
|
53
203
|
- 'lib/suma/thor_ext.rb'
|
|
54
204
|
|
|
55
|
-
# Offense count:
|
|
205
|
+
# Offense count: 3
|
|
206
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
207
|
+
# AllowedMethods: refine
|
|
208
|
+
Metrics/BlockLength:
|
|
209
|
+
Max: 58
|
|
210
|
+
|
|
211
|
+
# Offense count: 14
|
|
56
212
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
57
213
|
Metrics/CyclomaticComplexity:
|
|
58
214
|
Exclude:
|
|
59
|
-
- 'lib/suma/cli/
|
|
215
|
+
- 'lib/suma/cli/check_svg_quality.rb'
|
|
60
216
|
- 'lib/suma/eengine/wrapper.rb'
|
|
217
|
+
- 'lib/suma/express_schema.rb'
|
|
61
218
|
- 'lib/suma/jsdai/figure.rb'
|
|
62
219
|
- 'lib/suma/jsdai/figure_image.rb'
|
|
220
|
+
- 'lib/suma/link_validator.rb'
|
|
221
|
+
- 'lib/suma/schema_comparer.rb'
|
|
222
|
+
- 'lib/suma/svg_quality/formatters/terminal_formatter.rb'
|
|
223
|
+
- 'lib/suma/term_extractor.rb'
|
|
63
224
|
- 'lib/suma/thor_ext.rb'
|
|
64
225
|
|
|
65
|
-
# Offense count:
|
|
226
|
+
# Offense count: 31
|
|
66
227
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
67
228
|
Metrics/MethodLength:
|
|
68
|
-
Max:
|
|
229
|
+
Max: 63
|
|
69
230
|
|
|
70
|
-
# Offense count:
|
|
231
|
+
# Offense count: 3
|
|
232
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
233
|
+
Metrics/ParameterLists:
|
|
234
|
+
Max: 9
|
|
235
|
+
|
|
236
|
+
# Offense count: 8
|
|
71
237
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
72
238
|
Metrics/PerceivedComplexity:
|
|
73
239
|
Exclude:
|
|
74
|
-
- 'lib/suma/cli/compare.rb'
|
|
75
240
|
- 'lib/suma/eengine/wrapper.rb'
|
|
76
241
|
- 'lib/suma/jsdai/figure_image.rb'
|
|
242
|
+
- 'lib/suma/link_validator.rb'
|
|
243
|
+
- 'lib/suma/schema_comparer.rb'
|
|
244
|
+
- 'lib/suma/svg_quality/formatters/terminal_formatter.rb'
|
|
245
|
+
- 'lib/suma/term_extractor.rb'
|
|
77
246
|
|
|
78
247
|
# Offense count: 1
|
|
79
248
|
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
|
80
249
|
# AllowedMethods: call
|
|
81
|
-
# WaywardPredicates: nonzero?
|
|
250
|
+
# WaywardPredicates: infinite?, nonzero?
|
|
82
251
|
Naming/PredicateMethod:
|
|
83
252
|
Exclude:
|
|
84
253
|
- 'lib/suma/eengine/wrapper.rb'
|
|
85
254
|
|
|
255
|
+
# Offense count: 1
|
|
256
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
|
257
|
+
# NamePrefix: is_, has_, have_, does_
|
|
258
|
+
# ForbiddenPrefixes: is_, has_, have_, does_
|
|
259
|
+
# AllowedMethods: is_a?
|
|
260
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
261
|
+
Naming/PredicatePrefix:
|
|
262
|
+
Exclude:
|
|
263
|
+
- 'spec/**/*'
|
|
264
|
+
- 'lib/suma/term_extractor.rb'
|
|
265
|
+
|
|
86
266
|
# Offense count: 2
|
|
87
267
|
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
|
88
268
|
# SupportedStyles: snake_case, normalcase, non_integer
|
|
@@ -95,9 +275,9 @@ Naming/VariableNumber:
|
|
|
95
275
|
# Configuration parameters: MinSize.
|
|
96
276
|
Performance/CollectionLiteralInLoop:
|
|
97
277
|
Exclude:
|
|
98
|
-
- 'spec/suma/cli/compare_spec.rb'
|
|
99
278
|
- 'spec/suma/cli/export_spec.rb'
|
|
100
279
|
- 'spec/suma/cli_spec.rb'
|
|
280
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
101
281
|
|
|
102
282
|
# Offense count: 2
|
|
103
283
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
@@ -106,40 +286,40 @@ RSpec/ContextWording:
|
|
|
106
286
|
Exclude:
|
|
107
287
|
- 'spec/suma/cli/export_spec.rb'
|
|
108
288
|
|
|
109
|
-
# Offense count:
|
|
289
|
+
# Offense count: 111
|
|
110
290
|
# Configuration parameters: CountAsOne.
|
|
111
291
|
RSpec/ExampleLength:
|
|
112
|
-
Max:
|
|
292
|
+
Max: 60
|
|
113
293
|
|
|
114
294
|
# Offense count: 4
|
|
115
295
|
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
|
|
116
296
|
RSpec/IndexedLet:
|
|
117
297
|
Exclude:
|
|
118
|
-
- 'spec/suma/cli/compare_spec.rb'
|
|
119
298
|
- 'spec/suma/cli/export_spec.rb'
|
|
299
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
120
300
|
|
|
121
301
|
# Offense count: 22
|
|
122
302
|
# Configuration parameters: AssignmentOnly.
|
|
123
303
|
RSpec/InstanceVariable:
|
|
124
304
|
Exclude:
|
|
125
|
-
- 'spec/suma/
|
|
305
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
126
306
|
|
|
127
307
|
# Offense count: 1
|
|
128
308
|
# This cop supports safe autocorrection (--autocorrect).
|
|
129
309
|
RSpec/IteratedExpectation:
|
|
130
310
|
Exclude:
|
|
131
|
-
- 'spec/suma/
|
|
311
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
132
312
|
|
|
133
313
|
# Offense count: 1
|
|
134
314
|
# Configuration parameters: EnforcedStyle.
|
|
135
315
|
# SupportedStyles: have_received, receive
|
|
136
316
|
RSpec/MessageSpies:
|
|
137
317
|
Exclude:
|
|
138
|
-
- 'spec/suma/
|
|
318
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
139
319
|
|
|
140
|
-
# Offense count:
|
|
320
|
+
# Offense count: 87
|
|
141
321
|
RSpec/MultipleExpectations:
|
|
142
|
-
Max:
|
|
322
|
+
Max: 21
|
|
143
323
|
|
|
144
324
|
# Offense count: 3
|
|
145
325
|
# Configuration parameters: AllowedGroups.
|
|
@@ -147,7 +327,8 @@ RSpec/NestedGroups:
|
|
|
147
327
|
Max: 4
|
|
148
328
|
|
|
149
329
|
# Offense count: 1
|
|
150
|
-
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata.
|
|
330
|
+
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
|
|
331
|
+
# SupportedInflectors: default, active_support
|
|
151
332
|
RSpec/SpecFilePathFormat:
|
|
152
333
|
Exclude:
|
|
153
334
|
- '**/spec/routing/**/*'
|
|
@@ -156,4 +337,32 @@ RSpec/SpecFilePathFormat:
|
|
|
156
337
|
# Offense count: 1
|
|
157
338
|
RSpec/StubbedMock:
|
|
158
339
|
Exclude:
|
|
159
|
-
- 'spec/suma/
|
|
340
|
+
- 'spec/suma/schema_comparer_integration_spec.rb'
|
|
341
|
+
|
|
342
|
+
# Offense count: 9
|
|
343
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
344
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
345
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
346
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
347
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
348
|
+
# AllowedMethods: lambda, proc, it
|
|
349
|
+
Style/BlockDelimiters:
|
|
350
|
+
Exclude:
|
|
351
|
+
- 'lib/suma/link_validator.rb'
|
|
352
|
+
- 'lib/suma/register_manifest_generator.rb'
|
|
353
|
+
- 'spec/suma/term_extractor_spec.rb'
|
|
354
|
+
|
|
355
|
+
# Offense count: 4
|
|
356
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
357
|
+
Style/MultilineIfModifier:
|
|
358
|
+
Exclude:
|
|
359
|
+
- 'lib/suma/schema_comparer.rb'
|
|
360
|
+
- 'lib/suma/schema_manifest_generator.rb'
|
|
361
|
+
- 'lib/suma/schema_naming.rb'
|
|
362
|
+
|
|
363
|
+
# Offense count: 1
|
|
364
|
+
# Configuration parameters: AllowedMethods.
|
|
365
|
+
# AllowedMethods: respond_to_missing?
|
|
366
|
+
Style/OptionalBooleanParameter:
|
|
367
|
+
Exclude:
|
|
368
|
+
- 'lib/suma/cli/check_svg_quality.rb'
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Suma is a Ruby gem for processing EXPRESS schemas (ISO 10303 STEP standards). It reads Metanorma site manifests, discovers EXPRESS schemas, compiles them into documentation, and can export/compare schemas.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
### Development
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bundle install # Install dependencies
|
|
15
|
+
rake spec # Run RSpec tests
|
|
16
|
+
rake rubocop # Run RuboCop linter
|
|
17
|
+
rake # Run both tests and linter (default task)
|
|
18
|
+
rspec spec/path/to_spec.rb # Run a single spec file
|
|
19
|
+
rspec spec/path/to_spec.rb:42 # Run a single test at line 42
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### CLI usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
exe/suma build METANORMA_YAML # Build collection from site manifest
|
|
26
|
+
exe/suma export -o OUTPUT_DIR schema1.yml schema2.exp # Export schemas (YAML manifest or .exp files)
|
|
27
|
+
exe/suma compare TRIAL_SCHEMA REFERENCE_SCHEMA -v VER # Compare schemas, generate .changes.yaml
|
|
28
|
+
exe/suma reformat PATH # Reformat EXP files (use -r for recursive)
|
|
29
|
+
exe/suma generate-schemas METANORMA_YAML SCHEMAS_YAML # Generate schema manifest from site manifest
|
|
30
|
+
exe/suma extract-terms SCHEMA_YAML GLOSSARIST_DIR -u URN # Extract EXPRESS entity concepts to Glossarist v3 format
|
|
31
|
+
exe/suma generate-register SCHEMA_YAML OUT_DIR -u URN --id ID --ref REF # Generate hierarchical register.yaml from schema manifest
|
|
32
|
+
exe/suma validate links SCHEMAS_FILE DOCS_PATH # Validate EXPRESS cross-reference links
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
### Core pipeline (build command)
|
|
38
|
+
|
|
39
|
+
1. `Processor.new(...).run` receives a Metanorma site manifest YAML
|
|
40
|
+
2. `SiteConfig` reads the site manifest, finds collection YAML paths
|
|
41
|
+
3. `CollectionConfig` extends `Metanorma::Collection::Config` with a `CollectionManifest` that discovers `schemas.yaml` files
|
|
42
|
+
4. `ManifestTraverser` walks the manifest tree (`expand_schemas_only`, `export_schema_config`, `remove_schemas_only_sources`); `SchemaDiscovery` loads each `schemas.yaml` and builds doc sub-trees
|
|
43
|
+
5. `SchemaCollection` loads all discovered schemas via `Expressir`, exports plain `.exp` files, and compiles documentation via `SchemaCompiler` + `SchemaTemplate::Plain|Document` (Metanorma `.adoc` → XML/HTML)
|
|
44
|
+
6. `SchemaExporter` handles exporting schemas to a directory (with optional ZIP packaging)
|
|
45
|
+
|
|
46
|
+
### Key classes
|
|
47
|
+
|
|
48
|
+
- **`ExpressSchema`** — wraps a single EXPRESS schema file; parses via `Expressir::Express::Parser`, can output plain or annotated `.exp`. Includes nested `Type` module for schema classification (resource/module_arm/module_mim/business_object_model/core_model/standalone) based on ID suffixes and path segments
|
|
49
|
+
- **`SchemaCategory`** — value object mapping `ExpressSchema::Type` to a register/export category (id, label, prefix, types, directory). Single source of truth for category identity across `SchemaExporter`, `SchemaNaming`, and `RegisterManifestGenerator`
|
|
50
|
+
- **`Urn`** — value object encapsulating ISO URN semantics (wildcard stripping, base/alias split, leaf composition for `for_schema`/`for_term`/`for_entity`)
|
|
51
|
+
- **`TermExtractor`** — extracts EXPRESS entity concepts from a schema manifest into Glossarist v3 YAML format. Generates definitions with URN cross-references, processes remarks into notes, and resolves EXPRESS xrefs to URN mentions. Assigns stable UUIDv5 identifiers
|
|
52
|
+
- **`RegisterManifestGenerator`** (file: `lib/suma/register_manifest_generator.rb`) — generates a Glossarist v3 `register.yaml` with hierarchical sections from a schema manifest. Classifies schemas via `ExpressSchema::Type` (DRY), delegates naming to `SchemaNaming` (OCP), orders resources before modules. Uses the Section model's `children` field for hierarchy
|
|
53
|
+
- **`SchemaNaming`** — pure module that converts EXPRESS schema IDs to human-readable display names. Strips type suffixes (`_schema`/`_arm`/`_mim`/`_bom`), title-cases with acronym preservation (AIC, AEC, BREP, 2D, 3D…), lowercases function words, appends type labels (ARM/MIM)
|
|
54
|
+
- **`SchemaTemplate::Plain` / `SchemaTemplate::Document`** — pure renderers for the AsciiDoc body fed to Metanorma (no I/O, no schema knowledge). `Document` adds cross-reference anchors and produces XML-only output
|
|
55
|
+
- **`SchemaCompiler`** — orchestrates one schema's compilation: writes adoc + config, invokes `Metanorma::Compile`. Templates are injected via the constructor (composition over inheritance)
|
|
56
|
+
- **`SchemaCollection`** — orchestrates processing of all schemas from a config; selects `Plain` for top-level schemas and `Document` for schemas-only entries
|
|
57
|
+
- **`SchemaExporter`** — standalone export of schemas from manifest or `.exp` files to a directory, with optional ZIP
|
|
58
|
+
- **`CollectionManifest`** — pure data model (lutaml-model attributes + YAML mappings) for one node of a Metanorma collection manifest. No imperative methods
|
|
59
|
+
- **`ManifestTraverser`** — tree-walking service over a `CollectionManifest` (`find_schemas_only`, `export_schema_config`, `expand_schemas_only`, `remove_schemas_only_sources`)
|
|
60
|
+
- **`SchemaDiscovery`** — schema-config I/O service on a single manifest node (`load_config` from `schemas.yaml`, `build_doc_entries`, `build_added_manifest`)
|
|
61
|
+
- **`SchemaIndex`** — O(1) lookup index for schema and element names, used by `LinkValidator`
|
|
62
|
+
- **`LinkValidator`** — validates EXPRESS cross-reference links against a `SchemaIndex`; returns `LinkValidationResult` structs for unresolved links
|
|
63
|
+
|
|
64
|
+
### CLI structure
|
|
65
|
+
|
|
66
|
+
- `Suma::Cli::Core` (Thor subclass) — top-level CLI entrypoint
|
|
67
|
+
- Subcommands delegate to `Cli::Build`, `Cli::Export`, `Cli::Compare`, `Cli::Validate`, `Cli::Reformat`, `Cli::GenerateSchemas`, `Cli::ExtractTerms`, `Cli::GenerateRegister`, `Cli::ConvertJsdai`
|
|
68
|
+
- Thor extension (`ThorExt::Start`) adds `-h`/`--help` support and error formatting
|
|
69
|
+
|
|
70
|
+
### Terminology extraction (extract-terms / generate-register)
|
|
71
|
+
|
|
72
|
+
The `extract-terms` command reads an EXPRESS schema manifest, parses each `.exp` file via `Expressir`, and emits Glossarist v3 concept YAML with:
|
|
73
|
+
- Entity definitions using URN cross-references (`{{urn:...term,entity data type}}`, `{{urn:...term,entity}}`)
|
|
74
|
+
- Entity remarks processed into notes (first-sentence extraction, redundant note removal, invalid reference filtering)
|
|
75
|
+
- Domain classification via `ExpressSchema::Type` (resource vs application module)
|
|
76
|
+
- Section references for hierarchical grouping
|
|
77
|
+
|
|
78
|
+
The `generate-register` command reads the same schema manifest and emits `register.yaml` with hierarchical sections:
|
|
79
|
+
- Top-level groups: Resources (133) before Application Modules (1123)
|
|
80
|
+
- Child sections use human-readable names from `SchemaNaming` (e.g. "Resource: Topology", "Module: Activity (ARM)")
|
|
81
|
+
- Parent group IDs are included in concept metadata so the concept-browser can filter by group
|
|
82
|
+
|
|
83
|
+
### External dependencies
|
|
84
|
+
|
|
85
|
+
- **expressir** — EXPRESS schema parsing and manifest handling
|
|
86
|
+
- **metanorma** — document compilation (`.adoc` → XML/HTML/PDF)
|
|
87
|
+
- **lutaml-model** — YAML/XML model serialization (used in `SiteConfig`, `CollectionConfig`)
|
|
88
|
+
- **glossarist** — term extraction output format
|
|
89
|
+
- **eengine** (optional, external binary) — schema comparison via `Eengine::Wrapper`
|
|
90
|
+
|
|
91
|
+
### Schema comparison flow
|
|
92
|
+
|
|
93
|
+
The `compare` command uses an external `eengine` binary to diff two EXPRESS schemas, producing XML. `EengineConverter` then converts that XML into a `.changes.yaml` file managed by `Expressir::Changes::SchemaChange`.
|
|
94
|
+
|
|
95
|
+
## Code style
|
|
96
|
+
|
|
97
|
+
- Ruby 3.0+ with `frozen_string_literal: true` in every file
|
|
98
|
+
- RuboCop with performance, rake, and rspec plugins; inherits from riboseinc OSS guide
|
|
99
|
+
- Some CLI files are excluded from RuboCop in `.rubocop.yml`
|
|
100
|
+
- Internal library code uses Ruby `autoload` (defined in the immediate parent namespace's file); no `require_relative`
|
|
101
|
+
- No `send` to call private methods, no `instance_variable_set`/`get`, no `respond_to?` for type checking
|
|
102
|
+
- Use `Utils.log` for user-facing output (writes to `$stderr`, prefix `[suma]`; `level: :debug` gated by `SUMA_DEBUG`)
|
data/Gemfile
CHANGED
|
@@ -6,7 +6,9 @@ source "https://rubygems.org"
|
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
8
|
gem "canon"
|
|
9
|
-
gem "metanorma
|
|
9
|
+
# gem "metanorma", github: "metanorma/metanorma", branch: "main"
|
|
10
|
+
# gem "metanorma-plugin-lutaml", github: "metanorma/metanorma-plugin-lutaml", branch: "main"
|
|
11
|
+
# gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
|
|
10
12
|
gem "nokogiri"
|
|
11
13
|
gem "openssl", "~> 3.0"
|
|
12
14
|
gem "rake"
|