stepmod-utils 0.3.37 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-concept-generation.yml +4 -1
- data/README.adoc +234 -25
- data/exe/stepmod-annotate-all +77 -16
- data/exe/stepmod-convert-express-description +0 -9
- data/exe/stepmod-convert-express-resource +0 -9
- data/exe/stepmod-extract-changes +0 -9
- data/exe/stepmod-extract-concepts +0 -9
- data/exe/stepmod-srl-migrate +109 -33
- data/exe/stepmod-validate-express +104 -0
- data/lib/stepmod/utils/stepmod_file_annotator.rb +5 -1
- data/lib/stepmod/utils/version.rb +1 -1
- data/stepmod-utils.gemspec +6 -4
- metadata +39 -13
- data/exe/stepmod-srl-migrate-docs +0 -82
- data/exe/stepmod-srl-migrate-schemas +0 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb309548a8dd492982004515c2d11e45b72e4043452e72e809355dc9a8ffa7fd
|
4
|
+
data.tar.gz: 27510963bd60fb68b0a63286bc7dd11efbaf3a780c3fcb0227c8934a550f830d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efc594b7dab3677aa2ada861d787abd7078b222de4b6e7c5463549a4ce8c7e511bac6266e8973e3904e0dbbd4be2eb864f15cd817a172811cee5ec866783f143
|
7
|
+
data.tar.gz: b3d08ac1688b6a0e0a6aafd64b7f19339fef0414f43848a84fa6a3503300c457ea52a5d585ffdd7d77a85798725a3817d54c9d032767de26c48cdfac30089870
|
@@ -27,7 +27,10 @@ jobs:
|
|
27
27
|
path: iso-10303-stepmod-wg12
|
28
28
|
|
29
29
|
- name: Generate Annotated EXPRESS files
|
30
|
-
run:
|
30
|
+
run: |
|
31
|
+
bundle exec stepmod-annotate-all \
|
32
|
+
--stepmod-dir ./iso-10303-stepmod-wg12 \
|
33
|
+
--output schemas
|
31
34
|
|
32
35
|
- name: Generate Concept YAML files
|
33
36
|
working-directory: iso-10303-stepmod-wg12
|
data/README.adoc
CHANGED
@@ -25,10 +25,106 @@ Or include it in your gemspec.
|
|
25
25
|
|
26
26
|
== Usage
|
27
27
|
|
28
|
+
=== EXPRESS schema validation
|
29
|
+
|
30
|
+
This command uses Expressir to validate all EXPRESS schemas listed in the
|
31
|
+
`{stepmod}/repository_index.xml` file.
|
32
|
+
|
33
|
+
There is a `SHOULD_REWRITE` constant that can be switched in the code which
|
34
|
+
allows overwriting of the EXPRESS schemas into a pretty-printed format.
|
35
|
+
|
36
|
+
WARNING: The `SHOULD_REWRITE` function is turned off because Expressir currently
|
37
|
+
does not support outputting remarks, and some of the pretty-printed schemas will
|
38
|
+
fail validation.
|
39
|
+
|
40
|
+
[source,sh]
|
41
|
+
----
|
42
|
+
$ stepmod-validate-express {stepmod-directory}
|
43
|
+
----
|
44
|
+
|
45
|
+
Output:
|
46
|
+
|
47
|
+
[source]
|
48
|
+
----
|
49
|
+
Validating all EXPRESS schema files listed in:
|
50
|
+
repository_index.xml
|
51
|
+
|
52
|
+
NOTE: SHOULD_REWRITE mode is turned OFF
|
53
|
+
validating: ./data/modules/activity/arm.exp
|
54
|
+
validated : ./data/modules/activity/arm.exp
|
55
|
+
validating: ./data/modules/activity/mim.exp
|
56
|
+
validated : ./data/modules/activity/mim.exp
|
57
|
+
validating: ./data/modules/activity_as_realized/arm.exp
|
58
|
+
validated : ./data/modules/activity_as_realized/arm.exp
|
59
|
+
validating: ./data/modules/activity_as_realized/mim.exp
|
60
|
+
validated : ./data/modules/activity_as_realized/mim.exp
|
61
|
+
...
|
62
|
+
The following schemas failed validation:
|
63
|
+
SCHEMA: data/resources/geometric_model_schema/geometric_model_schema.exp
|
64
|
+
----
|
65
|
+
|
66
|
+
=== Generating Annotated EXPRESS
|
67
|
+
|
68
|
+
This command takes the STEPmod directory and parses its XML to synthesize
|
69
|
+
with the target EXPRESS schemas to migrate into Annotated EXPRESS schemas.
|
70
|
+
|
71
|
+
Given the following schemas:
|
72
|
+
|
73
|
+
* Simple EXPRESS schema: `{stepmod-root-dir}/data/resources/action_schema/action_schema.exp`
|
74
|
+
* Output of Annotated EXPRESS schema: `{schemas-output-dir}/action_schema/action_schema.exp`
|
75
|
+
|
76
|
+
Command:
|
77
|
+
|
78
|
+
[source,sh]
|
79
|
+
----
|
80
|
+
$ bundle exec stepmod-annotate-all \
|
81
|
+
--stepmod-dir {stepmod-root-dir} \
|
82
|
+
--output {schemas-output-dir}
|
83
|
+
----
|
84
|
+
|
85
|
+
e.g.
|
86
|
+
|
87
|
+
[source,sh]
|
88
|
+
----
|
89
|
+
$ bundle exec stepmod-annotate-all \
|
90
|
+
--stepmod-dir ./iso-10303-stepmod-wg12 \
|
91
|
+
--output schemas
|
92
|
+
----
|
93
|
+
|
94
|
+
|
95
|
+
Output:
|
96
|
+
|
28
97
|
[source,sh]
|
29
98
|
----
|
30
|
-
|
31
|
-
|
99
|
+
$ bundle exec stepmod-annotate-all --stepmod-dir iso-10303-stepmod-wg12 --output schemas
|
100
|
+
[stepmod-utils] STEPmod data path: `iso-10303-stepmod-wg12`
|
101
|
+
[stepmod-utils] SRL schemas output path: `schemas`
|
102
|
+
5760: `iso-10303-stepmod-wg12/data/modules/activity/arm.exp` processing...
|
103
|
+
5760: Written to: `schemas/activity/arm.exp`
|
104
|
+
5760: Done processing `arm.exp` => `schemas/activity/arm.exp`
|
105
|
+
5760: `iso-10303-stepmod-wg12/data/modules/activity/mim.exp` processing...
|
106
|
+
5760: Written to: `schemas/activity/mim.exp`
|
107
|
+
5760: Done processing `mim.exp` => `schemas/activity/mim.exp`
|
108
|
+
5760: `iso-10303-stepmod-wg12/data/modules/activity_as_realized/arm.exp` processing...
|
109
|
+
5760: Written to: `schemas/activity_as_realized/arm.exp`
|
110
|
+
5760: Done processing `arm.exp` => `schemas/activity_as_realized/arm.exp`
|
111
|
+
5760: `iso-10303-stepmod-wg12/data/modules/activity_as_realized/mim.exp` processing...
|
112
|
+
5760: Written to: `schemas/activity_as_realized/mim.exp`
|
113
|
+
5760: Done processing `mim.exp` => `schemas/activity_as_realized/mim.exp`
|
114
|
+
5760: `iso-10303-stepmod-wg12/data/modules/activity_characterized/arm.exp` processing...
|
115
|
+
5760: Written to: `schemas/activity_characterized/arm.exp`
|
116
|
+
...
|
117
|
+
----
|
118
|
+
|
119
|
+
|
120
|
+
=== ISO 10303-2 concepts extraction
|
121
|
+
|
122
|
+
[source,sh]
|
123
|
+
----
|
124
|
+
$ bundle exec stepmod-extract-concepts \
|
125
|
+
-p ./data \
|
126
|
+
-i ./repository_index.xml \
|
127
|
+
-o ./output-yaml
|
32
128
|
----
|
33
129
|
|
34
130
|
Then these files will be created:
|
@@ -36,6 +132,130 @@ Then these files will be created:
|
|
36
132
|
* `031-generated-terms.adoc` all terms extracted
|
37
133
|
* `991-generated-bibliography.adoc` all bibliographic sources where the terms come from
|
38
134
|
|
135
|
+
If the STEPmod repository is a Git repository, term extract will work.
|
136
|
+
|
137
|
+
Sample output:
|
138
|
+
|
139
|
+
[source,sh]
|
140
|
+
----
|
141
|
+
[stepmod-utils] INFO: STEPmod directory set to ../iso-10303-stepmod.
|
142
|
+
[stepmod-utils] INFO: Detecting paths...
|
143
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/boundary_representation_for_iso_14306_open_jt/application_protocol.xml
|
144
|
+
[stepmod-utils] INFO: skipped ISO/CD 10303-243 as it is not IS, DIS or TS
|
145
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
146
|
+
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
147
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/electronic_assembly_interconnect_and_packaging_design/application_protocol.xml
|
148
|
+
[stepmod-utils] INFO: skipped ISO/CD 10303-210:2019 as it is not IS, DIS or TS
|
149
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
150
|
+
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
151
|
+
...
|
152
|
+
----
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
=== Creating the SRL
|
157
|
+
|
158
|
+
The single command to create the SRL from the STEPmod repository is as follows.
|
159
|
+
|
160
|
+
The command also takes the `--stepmod2mn-path {path}` option to specify the
|
161
|
+
location of the `stepmod2mn.jar` file. If it is not specified, or the path
|
162
|
+
doesn't exist, the command will automatically download the latest release of it
|
163
|
+
to use.
|
164
|
+
|
165
|
+
[source,sh]
|
166
|
+
----
|
167
|
+
$ bundle exec stepmod-srl-migrate \
|
168
|
+
--srl-schemas-dir {path-to-new-srl-schemas} \
|
169
|
+
--srl-docs-dir {path-to-new-srl-documents} \
|
170
|
+
--stepmod-dir {stepmod-root-path}
|
171
|
+
----
|
172
|
+
|
173
|
+
e.g.
|
174
|
+
|
175
|
+
[source,sh]
|
176
|
+
----
|
177
|
+
$ bundle exec stepmod-srl-migrate \
|
178
|
+
--srl-schemas-dir schemas \
|
179
|
+
--srl-docs-dir documents \
|
180
|
+
--stepmod-dir iso-10303-stepmod-wg12
|
181
|
+
----
|
182
|
+
|
183
|
+
Output:
|
184
|
+
|
185
|
+
[source,sh]
|
186
|
+
----
|
187
|
+
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
|
188
|
+
[stepmod-utils] `stepmod2mn.jar` path: `/Users/mulgogi/src/mn/iso-10303-srl/stepmod2mn-1.25.jar`
|
189
|
+
[stepmod-utils] STEPmod path: `iso-10303-stepmod-wg12`
|
190
|
+
[stepmod-utils] SRL output schemas directory path: `schemas`
|
191
|
+
[stepmod-utils] SRL output documents directory path: `documents`
|
192
|
+
[stepmod-utils] ******************************
|
193
|
+
[stepmod-utils] [SRL MIGRATION] Migration starts!
|
194
|
+
[stepmod-utils] ******************************
|
195
|
+
[stepmod-utils] [SRL MIGRATION: stepmod2mn.jar] START document migration and SVG generation.
|
196
|
+
[stepmod-utils] ******************************
|
197
|
+
stepmod2mn Generate SVG file for iso-10303-stepmod-wg12/data/resource_docs/systems_engineering_representation/schema_diagexpg1.xml...
|
198
|
+
SVG saved in documents/systems_engineering_representation/schema_diagexpg1.svg.
|
199
|
+
Generate SVG file for iso-10303-stepmod-wg12/data/resource_docs/fundamentals_of_product_description_and_support/schema_diagexpg1.xml...
|
200
|
+
SVG saved in documents/fundamentals_of_product_description_and_support/schema_diagexpg1.svg.
|
201
|
+
Generate SVG file for iso-10303-stepmod-wg12/data/resource_docs/mathematical_representation/schema_diagexpg1.xml...
|
202
|
+
...
|
203
|
+
Generate SVG file for iso-10303-stepmod-wg12/data/modules/assembly_module_with_subassembly/mimexpg2.xml...
|
204
|
+
SVG saved in documents/assembly_module_with_subassembly/mimexpg2.svg.
|
205
|
+
End!
|
206
|
+
[stepmod-utils] ******************************
|
207
|
+
[stepmod-utils] [SRL MIGRATION: stepmod2mn.jar] COMPLETE document migration and SVG generation.
|
208
|
+
[stepmod-utils] ******************************
|
209
|
+
[stepmod-utils] [SRL MIGRATION: stepmod-utils] START Annotated EXPRESS generation.
|
210
|
+
[stepmod-utils] ******************************
|
211
|
+
[stepmod-utils] STEPmod data path: `iso-10303-stepmod-wg12`
|
212
|
+
[stepmod-utils] SRL schemas output path: `schemas`
|
213
|
+
5720: `iso-10303-stepmod-wg12/data/modules/activity/arm.exp` processing...
|
214
|
+
5720: Written to: `schemas/activity/arm.exp`
|
215
|
+
5720: Done processing `arm.exp` => `schemas/activity/arm.exp`
|
216
|
+
5720: `iso-10303-stepmod-wg12/data/modules/activity/mim.exp` processing...
|
217
|
+
5720: Written to: `schemas/activity/mim.exp`
|
218
|
+
5720: Done processing `mim.exp` => `schemas/activity/mim.exp`
|
219
|
+
5720: `iso-10303-stepmod-wg12/data/modules/activity_as_realized/arm.exp` processing...
|
220
|
+
...
|
221
|
+
5720: Done processing `mim.exp` => `schemas/zonal_breakdown/mim.exp`
|
222
|
+
5720: `iso-10303-stepmod-wg12/data/resources/action_and_model_relationships_schema/action_and_model_relationships_schema.exp` processing...
|
223
|
+
5720: Written to: `schemas/action_and_model_relationships_schema/action_and_model_relationships_schema.exp`
|
224
|
+
5720: Copy image SKIPPED for `schemas/action_and_model_relationships_schema/action_and_model_relationships_schemaexpg1.svg` as it exists.
|
225
|
+
5720: Copy image SKIPPED for `schemas/action_and_model_relationships_schema/action_and_model_relationships_schemaexpg2.svg` as it exists.
|
226
|
+
5720: Done processing `action_and_model_relationships_schema.exp` => `schemas/action_and_model_relationships_schema/action_and_model_relationships_schema.exp`
|
227
|
+
5720: `iso-10303-stepmod-wg12/data/resources/action_schema/action_schema.exp` processing...
|
228
|
+
5720: Written to: `schemas/action_schema/action_schema.exp`
|
229
|
+
5720: Copy image SKIPPED for `schemas/action_schema/action_schemaexpg1.svg` as it exists.
|
230
|
+
5720: Copy image SKIPPED for `schemas/action_schema/action_schemaexpg2.svg` as it exists.
|
231
|
+
5720: Done processing `action_schema.exp` => `schemas/action_schema/action_schema.exp`
|
232
|
+
5720: `iso-10303-stepmod-wg12/data/resources/aic_advanced_brep/aic_advanced_brep.exp` processing...
|
233
|
+
5720: Written to: `schemas/aic_advanced_brep/aic_advanced_brep.exp`
|
234
|
+
5720: Done processing `aic_advanced_brep.exp` => `schemas/aic_advanced_brep/aic_advanced_brep.exp`
|
235
|
+
5720: `iso-10303-stepmod-wg12/data/resources/aic_associative_draughting_elements/aic_associative_draughting_elements.exp` processing...
|
236
|
+
5720: Written to: `schemas/aic_associative_draughting_elements/aic_associative_draughting_elements.exp`
|
237
|
+
...
|
238
|
+
5720: Written to: `schemas/business_object_models/managed_model_based_3d_engineering_domain/DomainModel.exp`
|
239
|
+
5720: Done processing `DomainModel.exp` => `schemas/business_object_models/managed_model_based_3d_engineering_domain/DomainModel.exp`
|
240
|
+
[stepmod-utils] ******************************
|
241
|
+
[stepmod-utils] [SRL MIGRATION: stepmod-utils] COMPLETE Annotated EXPRESS generation.
|
242
|
+
[stepmod-utils] ******************************
|
243
|
+
[stepmod-utils] [SRL MIGRATION: stepmod-utils] START EXPRESS change YAML extraction.
|
244
|
+
[stepmod-utils] STEPmod data path: `iso-10303-stepmod-wg12`
|
245
|
+
[stepmod-utils] Copied arm.changes.yaml to schemas/activity/arm.changes.yaml
|
246
|
+
[stepmod-utils] Copied arm_lf.changes.yaml to schemas/activity/arm_lf.changes.yaml
|
247
|
+
[stepmod-utils] Copied mim.changes.yaml to schemas/activity/mim.changes.yaml
|
248
|
+
[stepmod-utils] Copied mim_lf.changes.yaml to schemas/activity/mim_lf.changes.yaml
|
249
|
+
[stepmod-utils] Copied arm.changes.yaml to schemas/activity_as_realized/arm.changes.yaml
|
250
|
+
...
|
251
|
+
[stepmod-utils] Copied topology_schema.changes.yaml to schemas/topology_schema/topology_schema.changes.yaml
|
252
|
+
[stepmod-utils] ******************************
|
253
|
+
[stepmod-utils] [SRL MIGRATION: stepmod-utils] COMPLETE EXPRESS change YAML extraction.
|
254
|
+
[stepmod-utils] ******************************
|
255
|
+
[stepmod-utils] [SRL MIGRATION] Migration complete!
|
256
|
+
[stepmod-utils] ******************************
|
257
|
+
----
|
258
|
+
|
39
259
|
== Conversion of STEPmod descriptions.xml into adoc
|
40
260
|
|
41
261
|
[source,sh]
|
@@ -111,7 +331,18 @@ expg_image:contract_schemaexpg1.xml[]
|
|
111
331
|
expg_image:contract_schemaexpg2.xml[]
|
112
332
|
----
|
113
333
|
|
114
|
-
==
|
334
|
+
== Generate EXPRESS Change YAML files
|
335
|
+
|
336
|
+
EXPRESS Change YAML files are YAML files that contain schema history
|
337
|
+
information.
|
338
|
+
|
339
|
+
This command migrates existing schema change information (in XML) into
|
340
|
+
independent per-schema YAML files.
|
341
|
+
|
342
|
+
The files will be created in the same directory as the schema:
|
343
|
+
|
344
|
+
* Schema: `shape_dimension_schema/shape_dimension_schema.exp`
|
345
|
+
* Output: `shape_dimension_schema/shape_dimension_schema.changes.yaml`
|
115
346
|
|
116
347
|
Command:
|
117
348
|
|
@@ -277,25 +508,3 @@ change_edition:
|
|
277
508
|
name: connected_edge_with_length_set_items
|
278
509
|
----
|
279
510
|
|
280
|
-
|
281
|
-
== Git repository
|
282
|
-
|
283
|
-
If the STEPmod repository is a Git repository, term extract will work.
|
284
|
-
|
285
|
-
Sample output:
|
286
|
-
|
287
|
-
[source,sh]
|
288
|
-
----
|
289
|
-
[stepmod-utils] INFO: STEPmod directory set to ../iso-10303-stepmod.
|
290
|
-
[stepmod-utils] INFO: Detecting paths...
|
291
|
-
[stepmod-utils] INFO: Processing XML file data/application_protocols/boundary_representation_for_iso_14306_open_jt/application_protocol.xml
|
292
|
-
[stepmod-utils] INFO: skipped ISO/CD 10303-243 as it is not IS, DIS or TS
|
293
|
-
[stepmod-utils] INFO: Processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
294
|
-
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
295
|
-
[stepmod-utils] INFO: Processing XML file data/application_protocols/electronic_assembly_interconnect_and_packaging_design/application_protocol.xml
|
296
|
-
[stepmod-utils] INFO: skipped ISO/CD 10303-210:2019 as it is not IS, DIS or TS
|
297
|
-
[stepmod-utils] INFO: Processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
298
|
-
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
299
|
-
...
|
300
|
-
----
|
301
|
-
|
data/exe/stepmod-annotate-all
CHANGED
@@ -4,8 +4,52 @@ require "concurrent"
|
|
4
4
|
require "stepmod/utils/stepmod_file_annotator"
|
5
5
|
require "fileutils"
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
require "bundler/setup"
|
8
|
+
require "optparse"
|
9
|
+
|
10
|
+
def log(message, indent = 0)
|
11
|
+
indent_spaces = " " * (indent * 2)
|
12
|
+
puts "[stepmod-utils] #{indent_spaces}#{message}"
|
13
|
+
end
|
14
|
+
|
15
|
+
options = {}
|
16
|
+
OptionParser.new do |opts|
|
17
|
+
opts.banner = "Usage: #{$0} [options]"
|
18
|
+
|
19
|
+
opts.on(
|
20
|
+
"--stepmod-dir STEPMOD_DIR",
|
21
|
+
String,
|
22
|
+
"Path to STEPmod directory",
|
23
|
+
) do |path|
|
24
|
+
options[:stepmod_dir] = path
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on(
|
28
|
+
"--output SRL_SCHEMAS_DIR",
|
29
|
+
String,
|
30
|
+
"Path to output SRL schemas",
|
31
|
+
) do |path|
|
32
|
+
options[:srl_output_schemas_dir] = path
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
36
|
+
puts opts
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
end.parse!
|
40
|
+
|
41
|
+
stepmod_dir = options[:stepmod_dir]
|
42
|
+
raise StandardError.new("--stepmod-dir not set") unless stepmod_dir
|
43
|
+
|
44
|
+
stepmod_path = Pathname.new(stepmod_dir)
|
45
|
+
unless (stepmod_path.join("data").exist? && stepmod_path.join("data").directory?)
|
46
|
+
raise StandardError.new("--stepmod-dir should be the root STEPmod directory and contains data/")
|
47
|
+
end
|
48
|
+
log "STEPmod data path: `#{stepmod_dir}`"
|
49
|
+
|
50
|
+
srl_output_schemas_dir = options[:srl_output_schemas_dir]
|
51
|
+
raise StandardError.new("--output directory for SRL schemas not set") unless srl_output_schemas_dir
|
52
|
+
log "SRL schemas output path: `#{srl_output_schemas_dir}`"
|
9
53
|
|
10
54
|
def all_express_files(stepmod_dir)
|
11
55
|
index_file = File.read(File.join(stepmod_dir, "repository_index.xml"))
|
@@ -46,7 +90,6 @@ end
|
|
46
90
|
# It will return nil if the file does not exist
|
47
91
|
def file_system_path(filepath, filename_cache)
|
48
92
|
dir = File.dirname(filepath)
|
49
|
-
filename = File.basename(filepath)
|
50
93
|
|
51
94
|
return filename_cache[dir][filepath.downcase] if filename_cache[dir]
|
52
95
|
|
@@ -69,32 +112,50 @@ MAX_QUEUE_SIZE = MAX_THREADS * 4
|
|
69
112
|
files = all_express_files(stepmod_dir)
|
70
113
|
filename_cache = {}
|
71
114
|
|
115
|
+
FileUtils.mkdir_p(srl_output_schemas_dir)
|
116
|
+
|
72
117
|
files.each do |file|
|
73
|
-
puts "#{Thread.current.object_id}:
|
118
|
+
puts "#{Thread.current.object_id}: `#{file}` processing..."
|
74
119
|
|
75
120
|
result = Stepmod::Utils::StepmodFileAnnotator.new(
|
76
121
|
express_file: file,
|
77
122
|
stepmod_dir: stepmod_dir,
|
78
123
|
).call
|
79
124
|
|
80
|
-
|
81
|
-
|
125
|
+
destination_rel_path = Pathname.new(file).dirname.relative_path_from(stepmod_path.join("data"))
|
126
|
+
directory_type = destination_rel_path.each_filename.to_a.first
|
127
|
+
|
128
|
+
if %w(resources modules).include?(directory_type)
|
129
|
+
destination_rel_path = Pathname.new(file).dirname.relative_path_from(stepmod_path.join("data").join(directory_type))
|
130
|
+
end
|
131
|
+
|
132
|
+
destination_path = Pathname.new(srl_output_schemas_dir).join(destination_rel_path)
|
133
|
+
FileUtils.mkdir_p(destination_path)
|
134
|
+
|
135
|
+
annotated_file_path = destination_path.join(File.basename(file))
|
82
136
|
|
83
137
|
File.open(annotated_file_path, "w") do |annotated_file|
|
84
138
|
annotated_file.puts(result[:annotated_text])
|
85
139
|
end
|
140
|
+
puts "#{Thread.current.object_id}: Written to: `#{annotated_file_path}`"
|
86
141
|
|
87
142
|
result[:images_references].each do |source, destination|
|
88
|
-
source_path =
|
89
|
-
system_source_path = file_system_path(source_path, filename_cache)
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
143
|
+
source_path = stepmod_path.join("data", source)
|
144
|
+
system_source_path = file_system_path(source_path.to_s, filename_cache)
|
145
|
+
image_dest_path = destination_path.join(destination)
|
146
|
+
|
147
|
+
unless system_source_path
|
148
|
+
if image_dest_path.exist?
|
149
|
+
puts "#{Thread.current.object_id}: Copy image SKIPPED for `#{image_dest_path}` as it exists."
|
150
|
+
else
|
151
|
+
puts "#{Thread.current.object_id}: Copy image FAILED from `#{source_path}` to `#{image_dest_path}`"
|
152
|
+
end
|
153
|
+
next
|
154
|
+
end
|
155
|
+
|
156
|
+
FileUtils.cp(system_source_path, image_dest_path)
|
157
|
+
puts "#{Thread.current.object_id}: Copy image SUCCESS: `#{system_source_path}` to `#{image_dest_path}`"
|
97
158
|
end
|
98
159
|
|
99
|
-
puts "#{Thread.current.object_id}: Done processing
|
160
|
+
puts "#{Thread.current.object_id}: Done processing `#{File.basename(file)}` => `#{annotated_file_path}`"
|
100
161
|
end
|
@@ -8,15 +8,6 @@ bin_file = Pathname.new(__FILE__).realpath
|
|
8
8
|
# add self to libpath
|
9
9
|
$:.unshift File.expand_path("../../lib", bin_file)
|
10
10
|
|
11
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
-
require "rubygems/specification"
|
13
|
-
|
14
|
-
module Gem
|
15
|
-
class Specification
|
16
|
-
def this; self; end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
11
|
require "bundler/setup"
|
21
12
|
require "stepmod/utils/smrl_description_converter"
|
22
13
|
|
@@ -8,15 +8,6 @@ bin_file = Pathname.new(__FILE__).realpath
|
|
8
8
|
# add self to libpath
|
9
9
|
$:.unshift File.expand_path("../../lib", bin_file)
|
10
10
|
|
11
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
-
require "rubygems/specification"
|
13
|
-
|
14
|
-
module Gem
|
15
|
-
class Specification
|
16
|
-
def this; self; end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
11
|
require "bundler/setup"
|
21
12
|
require "stepmod/utils/smrl_resource_converter"
|
22
13
|
|
data/exe/stepmod-extract-changes
CHANGED
@@ -7,15 +7,6 @@ bin_file = Pathname.new(__FILE__).realpath
|
|
7
7
|
# add self to libpath
|
8
8
|
$:.unshift File.expand_path("../../lib", bin_file)
|
9
9
|
|
10
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
11
|
-
require "rubygems/specification"
|
12
|
-
|
13
|
-
module Gem
|
14
|
-
class Specification
|
15
|
-
def this; self; end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
10
|
require "bundler/setup"
|
20
11
|
require "stepmod/utils/changes_extractor"
|
21
12
|
require "optparse"
|
@@ -9,15 +9,6 @@ bin_file = Pathname.new(__FILE__).realpath
|
|
9
9
|
# add self to libpath
|
10
10
|
$:.unshift File.expand_path("../../lib", bin_file)
|
11
11
|
|
12
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
13
|
-
require "rubygems/specification"
|
14
|
-
|
15
|
-
module Gem
|
16
|
-
class Specification
|
17
|
-
def this; self; end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
12
|
require "bundler/setup"
|
22
13
|
require_relative "../lib/stepmod/utils/terms_extractor"
|
23
14
|
require "optparse"
|
data/exe/stepmod-srl-migrate
CHANGED
@@ -3,35 +3,43 @@
|
|
3
3
|
# encoding: UTF-8
|
4
4
|
|
5
5
|
require "pathname"
|
6
|
+
require "fileutils"
|
6
7
|
bin_file = Pathname.new(__FILE__).realpath
|
7
8
|
|
8
9
|
# add self to libpath
|
9
10
|
$:.unshift File.expand_path("../../lib", bin_file)
|
10
11
|
|
11
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
-
require "rubygems/specification"
|
13
|
-
|
14
|
-
module Gem
|
15
|
-
class Specification
|
16
|
-
def this; self; end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
12
|
require "bundler/setup"
|
21
13
|
require "optparse"
|
22
14
|
|
23
|
-
def log(message)
|
15
|
+
def log(message, indent = 0)
|
16
|
+
indent_spaces = " " * (indent * 2)
|
24
17
|
puts "[stepmod-utils] #{message}"
|
25
18
|
end
|
26
19
|
|
20
|
+
def copy_files_to_schemas(path, srl_output_docs_dir)
|
21
|
+
schema_name = path.dirname.basename
|
22
|
+
file_name = path.basename
|
23
|
+
|
24
|
+
new_dir = File.join(srl_output_docs_dir, schema_name)
|
25
|
+
new_file_path = File.join(new_dir, file_name)
|
26
|
+
|
27
|
+
unless Dir.exist?(new_dir)
|
28
|
+
FileUtils.mkdir_p(new_dir)
|
29
|
+
end
|
30
|
+
|
31
|
+
FileUtils.copy_file(path, new_file_path)
|
32
|
+
log("Copied #{path.basename} to #{new_file_path}", 1)
|
33
|
+
end
|
34
|
+
|
27
35
|
options = {}
|
28
36
|
OptionParser.new do |opts|
|
29
37
|
opts.banner = "Usage: #{$0} [options]"
|
30
38
|
|
31
39
|
opts.on(
|
32
|
-
"--stepmod-
|
40
|
+
"--stepmod-dir STEPMOD_DIR",
|
33
41
|
String,
|
34
|
-
"Path to STEPmod
|
42
|
+
"Path to the STEPmod root directory",
|
35
43
|
) do |path|
|
36
44
|
options[:stepmod_dir] = path
|
37
45
|
end
|
@@ -39,7 +47,7 @@ OptionParser.new do |opts|
|
|
39
47
|
opts.on(
|
40
48
|
"--srl-docs-dir SRL_DOCS_DIR",
|
41
49
|
String,
|
42
|
-
"Path to output
|
50
|
+
"Path to output SRL docs",
|
43
51
|
) do |path|
|
44
52
|
options[:srl_output_docs_dir] = path
|
45
53
|
end
|
@@ -47,50 +55,118 @@ OptionParser.new do |opts|
|
|
47
55
|
opts.on(
|
48
56
|
"--srl-schemas-dir SRL_SCHEMAS_DIR",
|
49
57
|
String,
|
50
|
-
"Path to output
|
58
|
+
"Path to output SRL schemas",
|
51
59
|
) do |path|
|
52
60
|
options[:srl_output_schemas_dir] = path
|
53
61
|
end
|
54
62
|
|
55
63
|
opts.on(
|
56
|
-
"-
|
57
|
-
"--stepmod2mn-executeable STEPMOD2MN_EXECUTEABLE",
|
64
|
+
"--stepmod2mn-path STEPMOD2MN_JAR_PATH",
|
58
65
|
String,
|
59
|
-
"Path to
|
66
|
+
"Path to stepmod2mn-vx.y.jar",
|
60
67
|
) do |path|
|
61
68
|
options[:stepmod2mn_path] = path
|
62
69
|
end
|
63
70
|
|
64
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
71
|
+
opts.on_tail("-h", "--help", "Show this help message") do
|
65
72
|
puts opts
|
66
73
|
exit
|
67
74
|
end
|
68
75
|
end.parse!
|
69
76
|
|
77
|
+
def download_stepmod2mn(path)
|
78
|
+
return path if path && path.exist?
|
79
|
+
|
80
|
+
require 'octokit'
|
81
|
+
require "down"
|
82
|
+
require "fileutils"
|
83
|
+
|
84
|
+
client = Octokit::Client.new
|
85
|
+
download_url = client.latest_release('metanorma/stepmod2mn').assets.first.browser_download_url
|
86
|
+
|
87
|
+
filename = Pathname.new(download_url).basename.to_s
|
88
|
+
|
89
|
+
destination_path = path || Pathname.pwd.join(filename)
|
90
|
+
return destination_path if !destination_path.nil? && destination_path.exist?
|
91
|
+
|
92
|
+
puts "Downloading `stepmod2mn.jar` to `#{destination_path}`."
|
93
|
+
tempfile = Down.download(download_url)
|
94
|
+
FileUtils.mkdir_p(Pathname.new(destination_path).dirname)
|
95
|
+
FileUtils.mv(tempfile.path, destination_path)
|
96
|
+
|
97
|
+
destination_path
|
98
|
+
end
|
99
|
+
|
70
100
|
stepmod2mn_path = options[:stepmod2mn_path]
|
71
|
-
if stepmod2mn_path.nil?
|
72
|
-
|
73
|
-
"stepmod2mn
|
74
|
-
|
101
|
+
if !stepmod2mn_path.nil?
|
102
|
+
if Pathname.new(stepmod2mn_path).exist?
|
103
|
+
puts "Specified `stepmod2mn.jar` found, using existing file."
|
104
|
+
else
|
105
|
+
stepmod2mn_path = download_stepmod2mn(Pathname.new(stepmod2mn_path))
|
106
|
+
end
|
107
|
+
puts "Specified `stepmod2mn.jar` not found, downloading from GitHub."
|
108
|
+
else
|
109
|
+
stepmod2mn_path = download_stepmod2mn(nil)
|
75
110
|
end
|
111
|
+
log "`stepmod2mn.jar` path: `#{stepmod2mn_path}`"
|
76
112
|
|
77
113
|
stepmod_dir = options[:stepmod_dir] || "stepmod"
|
78
114
|
if stepmod_dir.nil?
|
79
115
|
raise StandardError.new(
|
80
|
-
"
|
116
|
+
"Please provide path to the STEPmod root directory with `--stepmod_dir`.",
|
81
117
|
)
|
82
118
|
end
|
83
119
|
|
84
|
-
|
85
|
-
|
120
|
+
stepmod_path = Pathname.new(stepmod_dir)
|
121
|
+
unless stepmod_path.exist? && stepmod_path.directory? &&
|
122
|
+
stepmod_path.join("data").exist? && stepmod_path.join("data").directory?
|
123
|
+
puts "Specified STEPmod directory not found, not a directory, or does not contain `data/`. Aborting."
|
124
|
+
exit 1
|
125
|
+
end
|
126
|
+
|
127
|
+
stepmod_dir = options[:stepmod_dir] || "stepmod"
|
128
|
+
log "STEPmod path: `#{stepmod_dir}`"
|
86
129
|
|
87
|
-
|
88
|
-
|
130
|
+
srl_output_schemas_dir = options[:srl_output_schemas_dir] || "schemas"
|
131
|
+
unless File.directory?(srl_output_schemas_dir)
|
132
|
+
FileUtils.mkdir_p(srl_output_schemas_dir)
|
133
|
+
end
|
134
|
+
log "SRL output schemas directory path: `#{srl_output_schemas_dir}`"
|
135
|
+
|
136
|
+
srl_output_docs_dir = options[:srl_output_docs_dir] || "documents"
|
137
|
+
unless File.directory?(srl_output_docs_dir)
|
138
|
+
FileUtils.mkdir_p(srl_output_docs_dir)
|
139
|
+
end
|
140
|
+
log "SRL output documents directory path: `#{srl_output_docs_dir}`"
|
141
|
+
|
142
|
+
log("*"*30)
|
143
|
+
log("[SRL MIGRATION] Migration starts!")
|
144
|
+
|
145
|
+
log("*"*30)
|
146
|
+
log("[SRL MIGRATION: stepmod2mn.jar] START document migration and SVG generation.")
|
147
|
+
log("*"*30)
|
148
|
+
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir} --svg"
|
149
|
+
log("*"*30)
|
150
|
+
log("[SRL MIGRATION: stepmod2mn.jar] COMPLETE document migration and SVG generation.")
|
151
|
+
|
152
|
+
log("*"*30)
|
153
|
+
log("[SRL MIGRATION: stepmod-utils] START Annotated EXPRESS generation.")
|
154
|
+
log("*"*30)
|
155
|
+
system "stepmod-annotate-all --stepmod-dir #{stepmod_dir} --output #{srl_output_schemas_dir}"
|
156
|
+
log("*"*30)
|
157
|
+
log("[SRL MIGRATION: stepmod-utils] COMPLETE Annotated EXPRESS generation.")
|
158
|
+
|
159
|
+
log("*"*30)
|
160
|
+
log("[SRL MIGRATION: stepmod-utils] START EXPRESS change YAML extraction.")
|
161
|
+
system "stepmod-extract-changes -p #{stepmod_dir}"
|
162
|
+
Dir.glob("#{stepmod_dir}/data/**/*.changes.yaml").each do |filepath|
|
163
|
+
path = Pathname.new(filepath)
|
164
|
+
copy_files_to_schemas(path, srl_output_schemas_dir)
|
165
|
+
end
|
166
|
+
log("*"*30)
|
167
|
+
log("[SRL MIGRATION: stepmod-utils] COMPLETE EXPRESS change YAML extraction.")
|
89
168
|
|
90
|
-
log("
|
91
|
-
|
92
|
-
log("--- END Migrate Docs ---")
|
169
|
+
log("*"*30)
|
170
|
+
log("[SRL MIGRATION] Migration complete!")
|
93
171
|
|
94
|
-
log("
|
95
|
-
system migrate_schemas_command
|
96
|
-
log("--- END Migrate Schemas ---")
|
172
|
+
log("*"*30)
|
@@ -0,0 +1,104 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'expressir'
|
5
|
+
require 'expressir/express/parser'
|
6
|
+
require 'expressir/express/formatter'
|
7
|
+
|
8
|
+
stepmod_dir = ARGV.pop || "iso-10303-stepmod-wg12"
|
9
|
+
stepmod_path = Pathname.new(stepmod_dir)
|
10
|
+
|
11
|
+
SHOULD_REWRITE = false
|
12
|
+
|
13
|
+
REPO_INDEX_XML = stepmod_path.join("repository_index.xml")
|
14
|
+
|
15
|
+
def all_express_files(stepmod_dir)
|
16
|
+
index_file = File.read(REPO_INDEX_XML)
|
17
|
+
index = Nokogiri::XML(index_file).root
|
18
|
+
|
19
|
+
files = []
|
20
|
+
index.xpath("modules/module").each do |item|
|
21
|
+
files << "#{stepmod_dir}/data/modules/#{item['name']}/arm.exp"
|
22
|
+
files << "#{stepmod_dir}/data/modules/#{item['name']}/mim.exp"
|
23
|
+
end
|
24
|
+
|
25
|
+
index.xpath("resources/resource").each do |item|
|
26
|
+
next if item["name"] == "iso13584_expressions_schema"
|
27
|
+
|
28
|
+
files << "#{stepmod_dir}/data/resources/#{item['name']}/#{item['name']}.exp"
|
29
|
+
end
|
30
|
+
|
31
|
+
index.xpath("business_object_models/business_object_model").each do |item|
|
32
|
+
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/bom.exp"
|
33
|
+
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/DomainModel.exp"
|
34
|
+
end
|
35
|
+
|
36
|
+
files.filter { |file| File.exist?(file) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def parse_express_schema(path)
|
40
|
+
Expressir::Express::Parser.from_file(path)
|
41
|
+
rescue
|
42
|
+
puts "ERROR: Broken schema detected in #{path}!"
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def format_express_schema(repo)
|
47
|
+
Expressir::Express::Formatter.format(repo)
|
48
|
+
end
|
49
|
+
|
50
|
+
schemas_status = {}
|
51
|
+
|
52
|
+
puts "Validating all EXPRESS schema files listed in:"
|
53
|
+
puts REPO_INDEX_XML
|
54
|
+
puts
|
55
|
+
puts "NOTE: SHOULD_REWRITE mode is turned #{SHOULD_REWRITE ? 'ON' : 'OFF'}"
|
56
|
+
|
57
|
+
all_express_files(stepmod_dir).each_with_index do |exp_file, i|
|
58
|
+
# puts "i #{i}"
|
59
|
+
# next if i > 10
|
60
|
+
|
61
|
+
puts "validating: #{exp_file}"
|
62
|
+
exp_path = Pathname.new(exp_file)
|
63
|
+
repo = parse_express_schema(exp_file)
|
64
|
+
|
65
|
+
|
66
|
+
schemas_status[exp_path.to_s] = repo ? true : false
|
67
|
+
|
68
|
+
if repo.nil?
|
69
|
+
puts "FAILED : #{exp_file}"
|
70
|
+
next
|
71
|
+
end
|
72
|
+
|
73
|
+
puts "validated : #{exp_file}"
|
74
|
+
|
75
|
+
# Commented out pretty formatting as some formatted schemas will fail validation...
|
76
|
+
if SHOULD_REWRITE
|
77
|
+
formatted_schema = format_express_schema(repo)
|
78
|
+
# experimental_path = exp_path.dirname.join(exp_path.basename('.exp').to_s+".x.exp")
|
79
|
+
|
80
|
+
puts "rewriting : #{exp_path.to_s}"
|
81
|
+
exp_path.truncate(0)
|
82
|
+
exp_path.write(formatted_schema)
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
puts "*"*30
|
88
|
+
|
89
|
+
if schemas_status.values.include?(false)
|
90
|
+
puts "The following schemas failed validation:"
|
91
|
+
schemas_status.select do |path, status|
|
92
|
+
status == false
|
93
|
+
end.each_pair do |path, status|
|
94
|
+
puts "SCHEMA: #{path}"
|
95
|
+
end
|
96
|
+
puts "*"*30
|
97
|
+
|
98
|
+
exit 1
|
99
|
+
end
|
100
|
+
|
101
|
+
puts "All schemas passed validation."
|
102
|
+
puts "*"*30
|
103
|
+
|
104
|
+
exit 0
|
@@ -130,7 +130,9 @@ module Stepmod
|
|
130
130
|
private
|
131
131
|
|
132
132
|
def sanitize(file_content)
|
133
|
-
file_content
|
133
|
+
file_content
|
134
|
+
.gsub("(*)", "(`*`)")
|
135
|
+
.gsub(";;", ";")
|
134
136
|
end
|
135
137
|
|
136
138
|
def add_images_references(description, schema_base_dir, processed_images_cache)
|
@@ -150,6 +152,8 @@ module Stepmod
|
|
150
152
|
processed_images_cache[new_image_file_path] = true
|
151
153
|
@images_references[image_file_path] = new_image_file_path
|
152
154
|
end
|
155
|
+
|
156
|
+
@images_references
|
153
157
|
end
|
154
158
|
|
155
159
|
def convert_from_description_text(descriptions_file, description)
|
data/stepmod-utils.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
spec.files = `git ls-files`.split("\n")
|
20
20
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
21
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
21
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -33,12 +33,14 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.add_runtime_dependency "concurrent-ruby"
|
35
35
|
spec.add_runtime_dependency "expressir"
|
36
|
-
spec.add_runtime_dependency "glossarist", "~>
|
36
|
+
spec.add_runtime_dependency "glossarist", "~> 2.0"
|
37
37
|
spec.add_runtime_dependency "indefinite_article"
|
38
38
|
spec.add_runtime_dependency "ptools"
|
39
39
|
spec.add_runtime_dependency "pubid-iso"
|
40
|
-
spec.add_runtime_dependency "
|
41
|
-
spec.add_runtime_dependency "
|
40
|
+
spec.add_runtime_dependency "octokit"
|
41
|
+
spec.add_runtime_dependency "down"
|
42
|
+
spec.add_runtime_dependency "reverse_adoc", ">= 0.3"
|
43
|
+
spec.add_runtime_dependency "thor", ">= 0.20"
|
42
44
|
spec.add_development_dependency "rubocop"
|
43
45
|
spec.add_development_dependency "rubocop-performance"
|
44
46
|
spec.add_development_dependency "rubocop-rails"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: indefinite_article
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,34 +94,62 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: octokit
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: down
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: reverse_adoc
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
100
128
|
requirements:
|
101
129
|
- - ">="
|
102
130
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.3
|
131
|
+
version: '0.3'
|
104
132
|
type: :runtime
|
105
133
|
prerelease: false
|
106
134
|
version_requirements: !ruby/object:Gem::Requirement
|
107
135
|
requirements:
|
108
136
|
- - ">="
|
109
137
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.3
|
138
|
+
version: '0.3'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: thor
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
143
|
- - ">="
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.20
|
145
|
+
version: '0.20'
|
118
146
|
type: :runtime
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
150
|
- - ">="
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.20
|
152
|
+
version: '0.20'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: rubocop
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,8 +204,7 @@ executables:
|
|
176
204
|
- stepmod-extract-changes
|
177
205
|
- stepmod-extract-concepts
|
178
206
|
- stepmod-srl-migrate
|
179
|
-
- stepmod-
|
180
|
-
- stepmod-srl-migrate-schemas
|
207
|
+
- stepmod-validate-express
|
181
208
|
extensions: []
|
182
209
|
extra_rdoc_files: []
|
183
210
|
files:
|
@@ -201,8 +228,7 @@ files:
|
|
201
228
|
- exe/stepmod-extract-changes
|
202
229
|
- exe/stepmod-extract-concepts
|
203
230
|
- exe/stepmod-srl-migrate
|
204
|
-
- exe/stepmod-
|
205
|
-
- exe/stepmod-srl-migrate-schemas
|
231
|
+
- exe/stepmod-validate-express
|
206
232
|
- lib/stepmod/utils.rb
|
207
233
|
- lib/stepmod/utils/bibdata.rb
|
208
234
|
- lib/stepmod/utils/change.rb
|
@@ -289,7 +315,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
289
315
|
requirements:
|
290
316
|
- - ">="
|
291
317
|
- !ruby/object:Gem::Version
|
292
|
-
version: 2.
|
318
|
+
version: 2.6.0
|
293
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
320
|
requirements:
|
295
321
|
- - ">="
|
@@ -1,82 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# encoding: UTF-8
|
4
|
-
|
5
|
-
require "fileutils"
|
6
|
-
# resolve bin path, ignoring symlinks
|
7
|
-
require "pathname"
|
8
|
-
bin_file = Pathname.new(__FILE__).realpath
|
9
|
-
|
10
|
-
# add self to libpath
|
11
|
-
$:.unshift File.expand_path("../../lib", bin_file)
|
12
|
-
|
13
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
14
|
-
require "rubygems/specification"
|
15
|
-
|
16
|
-
module Gem
|
17
|
-
class Specification
|
18
|
-
def this; self; end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
require "bundler/setup"
|
23
|
-
require "optparse"
|
24
|
-
|
25
|
-
def log(message)
|
26
|
-
puts "[stepmod-utils] #{message}"
|
27
|
-
end
|
28
|
-
|
29
|
-
options = {}
|
30
|
-
OptionParser.new do |opts|
|
31
|
-
opts.banner = "Usage: #{$0} [options]"
|
32
|
-
|
33
|
-
opts.on(
|
34
|
-
"--stepmod-data-dir STEPMOD_DATA_DIR",
|
35
|
-
String,
|
36
|
-
"Path to STEPmod data directory",
|
37
|
-
) do |path|
|
38
|
-
options[:stepmod_dir] = path
|
39
|
-
end
|
40
|
-
|
41
|
-
opts.on(
|
42
|
-
"--srl-docs-dir SRL_DOCS_DIR",
|
43
|
-
String,
|
44
|
-
"Path to output srl docs",
|
45
|
-
) do |path|
|
46
|
-
options[:srl_output_docs_dir] = path
|
47
|
-
end
|
48
|
-
|
49
|
-
opts.on(
|
50
|
-
"-s",
|
51
|
-
"--stepmod2mn-executeable STEPMOD2MN_EXECUTEABLE",
|
52
|
-
String,
|
53
|
-
"Path to STEPMOD2MN_EXECUTEABLE",
|
54
|
-
) do |path|
|
55
|
-
options[:stepmod2mn_path] = path
|
56
|
-
end
|
57
|
-
|
58
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
59
|
-
puts opts
|
60
|
-
exit
|
61
|
-
end
|
62
|
-
end.parse!
|
63
|
-
|
64
|
-
stepmod2mn_path = options[:stepmod2mn_path]
|
65
|
-
if stepmod2mn_path.nil?
|
66
|
-
raise StandardError.new(
|
67
|
-
"stepmod2mn executeable is required, set with the `-s` option.",
|
68
|
-
)
|
69
|
-
else
|
70
|
-
log "stepmod2mn executeable path: `#{stepmod2mn_path}`"
|
71
|
-
end
|
72
|
-
|
73
|
-
stepmod_dir = options[:stepmod_dir] || "stepmod/data"
|
74
|
-
log "STEPmod data path: `#{stepmod_dir}`"
|
75
|
-
|
76
|
-
srl_output_docs_dir = options[:srl_output_docs_dir] || "documents"
|
77
|
-
unless File.directory?(srl_output_docs_dir)
|
78
|
-
FileUtils.mkdir_p(srl_output_docs_dir)
|
79
|
-
end
|
80
|
-
log "SRL output docs directory path: `#{srl_output_docs_dir}`"
|
81
|
-
|
82
|
-
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir}"
|
@@ -1,114 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# encoding: UTF-8
|
4
|
-
|
5
|
-
require "fileutils"
|
6
|
-
# resolve bin path, ignoring symlinks
|
7
|
-
require "pathname"
|
8
|
-
bin_file = Pathname.new(__FILE__).realpath
|
9
|
-
|
10
|
-
# add self to libpath
|
11
|
-
$:.unshift File.expand_path("../../lib", bin_file)
|
12
|
-
|
13
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
14
|
-
require "rubygems/specification"
|
15
|
-
|
16
|
-
module Gem
|
17
|
-
class Specification
|
18
|
-
def this; self; end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
require "bundler/setup"
|
23
|
-
require "optparse"
|
24
|
-
|
25
|
-
def log(message, indent = 0)
|
26
|
-
indent_spaces = " " * (indent * 2)
|
27
|
-
puts "[stepmod-utils] #{indent_spaces}#{message}"
|
28
|
-
end
|
29
|
-
|
30
|
-
def copy_files_to_schemas(path, output_dir)
|
31
|
-
schema_name = path.dirname.basename
|
32
|
-
file_name = path.basename
|
33
|
-
|
34
|
-
new_dir = File.join(output_dir, schema_name)
|
35
|
-
new_file_path = File.join(new_dir, file_name.to_s.gsub("_annotated.exp", ".exp"))
|
36
|
-
|
37
|
-
unless Dir.exist?(new_dir)
|
38
|
-
FileUtils.mkdir_p(new_dir)
|
39
|
-
end
|
40
|
-
|
41
|
-
FileUtils.copy_file(path, new_file_path)
|
42
|
-
log("Copied #{path.basename} to #{new_file_path}", 1)
|
43
|
-
end
|
44
|
-
|
45
|
-
options = {}
|
46
|
-
OptionParser.new do |opts|
|
47
|
-
opts.banner = "Usage: #{$0} [options]"
|
48
|
-
|
49
|
-
opts.on(
|
50
|
-
"--stepmod-data-dir STEPMOD_DATA_DIR",
|
51
|
-
String,
|
52
|
-
"Path to STEPmod data directory",
|
53
|
-
) do |path|
|
54
|
-
options[:stepmod_dir] = path
|
55
|
-
end
|
56
|
-
|
57
|
-
opts.on(
|
58
|
-
"--srl-schemas-dir SRL_SCHEMAS_DIR",
|
59
|
-
String,
|
60
|
-
"Path to output srl schemas",
|
61
|
-
) do |path|
|
62
|
-
options[:srl_output_schemas_dir] = path
|
63
|
-
end
|
64
|
-
|
65
|
-
opts.on(
|
66
|
-
"-s",
|
67
|
-
"--stepmod2mn-executeable STEPMOD2MN_EXECUTEABLE",
|
68
|
-
String,
|
69
|
-
"Path to STEPMOD2MN_EXECUTEABLE",
|
70
|
-
) do |path|
|
71
|
-
options[:stepmod2mn_path] = path
|
72
|
-
end
|
73
|
-
|
74
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
75
|
-
puts opts
|
76
|
-
exit
|
77
|
-
end
|
78
|
-
end.parse!
|
79
|
-
|
80
|
-
stepmod2mn_path = options[:stepmod2mn_path]
|
81
|
-
if stepmod2mn_path.nil?
|
82
|
-
raise StandardError.new(
|
83
|
-
"stepmod2mn executeable is required, set with the `-s` option.",
|
84
|
-
)
|
85
|
-
else
|
86
|
-
log "stepmod2mn executeable path: `#{stepmod2mn_path}`"
|
87
|
-
end
|
88
|
-
|
89
|
-
stepmod_dir = options[:stepmod_dir] || "stepmod/data"
|
90
|
-
log "STEPmod data path: `#{stepmod_dir}`"
|
91
|
-
|
92
|
-
srl_output_schemas_dir = options[:srl_output_schemas_dir] || "schemas"
|
93
|
-
unless File.directory?(srl_output_schemas_dir)
|
94
|
-
FileUtils.mkdir_p(srl_output_schemas_dir)
|
95
|
-
end
|
96
|
-
log "SRL output schemas directory path: `#{srl_output_schemas_dir}`"
|
97
|
-
|
98
|
-
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_schemas_dir} --svg"
|
99
|
-
|
100
|
-
system "stepmod-annotate-all #{stepmod_dir}"
|
101
|
-
|
102
|
-
Dir.glob("#{stepmod_dir}/data/**/*_annotated.exp").each do |filepath|
|
103
|
-
path = Pathname.new(filepath)
|
104
|
-
copy_files_to_schemas(path, srl_output_schemas_dir)
|
105
|
-
end
|
106
|
-
|
107
|
-
system "stepmod-extract-changes -p #{stepmod_dir}"
|
108
|
-
|
109
|
-
Dir.glob("#{stepmod_dir}/data/**/*.changes.yaml").each do |filepath|
|
110
|
-
path = Pathname.new(filepath)
|
111
|
-
copy_files_to_schemas(path, srl_output_schemas_dir)
|
112
|
-
end
|
113
|
-
|
114
|
-
log("Done")
|