stepmod-utils 0.1.5 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +51 -0
- data/.github/workflows/release.yml +20 -22
- data/Gemfile +2 -0
- data/Makefile +2 -0
- data/README.adoc +136 -2
- data/exe/stepmod-annotate +44 -0
- data/exe/stepmod-annotate-all +39 -0
- data/exe/stepmod-build-resource-docs-cache +19 -0
- data/exe/stepmod-convert-express-description +33 -0
- data/exe/stepmod-convert-express-resource +33 -0
- data/exe/stepmod-extract-terms +62 -13
- data/exe/stepmod-find-express-files +23 -0
- data/lib/stepmod/utils/cleaner.rb +11 -0
- data/lib/stepmod/utils/concept.rb +16 -3
- data/lib/stepmod/utils/converters/a.rb +47 -0
- data/lib/stepmod/utils/converters/blockquote.rb +22 -0
- data/lib/stepmod/utils/converters/br.rb +15 -0
- data/lib/stepmod/utils/converters/bypass.rb +81 -0
- data/lib/stepmod/utils/converters/clause_ref.rb +2 -2
- data/lib/stepmod/utils/converters/code.rb +19 -0
- data/lib/stepmod/utils/converters/comment.rb +16 -0
- data/lib/stepmod/utils/converters/dd.rb +15 -0
- data/lib/stepmod/utils/converters/def.rb +13 -6
- data/lib/stepmod/utils/converters/definition.rb +2 -2
- data/lib/stepmod/utils/converters/dl.rb +31 -0
- data/lib/stepmod/utils/converters/drop.rb +22 -0
- data/lib/stepmod/utils/converters/dt.rb +17 -0
- data/lib/stepmod/utils/converters/em.rb +3 -3
- data/lib/stepmod/utils/converters/em_express_description.rb +22 -0
- data/lib/stepmod/utils/converters/eqn.rb +96 -0
- data/lib/stepmod/utils/converters/example.rb +3 -8
- data/lib/stepmod/utils/converters/express_g.rb +46 -0
- data/lib/stepmod/utils/converters/express_ref.rb +2 -2
- data/lib/stepmod/utils/converters/express_ref_express_description.rb +13 -0
- data/lib/stepmod/utils/converters/ext_description.rb +16 -0
- data/lib/stepmod/utils/converters/ext_descriptions.rb +14 -0
- data/lib/stepmod/utils/converters/fund_cons.rb +15 -0
- data/lib/stepmod/utils/converters/head.rb +22 -0
- data/lib/stepmod/utils/converters/hr.rb +15 -0
- data/lib/stepmod/utils/converters/ignore.rb +16 -0
- data/lib/stepmod/utils/converters/introduction.rb +15 -0
- data/lib/stepmod/utils/converters/module_ref.rb +2 -2
- data/lib/stepmod/utils/converters/note.rb +3 -8
- data/lib/stepmod/utils/converters/ol.rb +7 -6
- data/lib/stepmod/utils/converters/p.rb +21 -0
- data/lib/stepmod/utils/converters/pass_through.rb +13 -0
- data/lib/stepmod/utils/converters/q.rb +16 -0
- data/lib/stepmod/utils/converters/resource.rb +14 -0
- data/lib/stepmod/utils/converters/schema.rb +18 -0
- data/lib/stepmod/utils/converters/schema_diag.rb +14 -0
- data/lib/stepmod/utils/converters/stem.rb +2 -2
- data/lib/stepmod/utils/converters/strong.rb +21 -0
- data/lib/stepmod/utils/converters/sub.rb +16 -0
- data/lib/stepmod/utils/converters/sup.rb +16 -0
- data/lib/stepmod/utils/converters/synonym.rb +2 -2
- data/lib/stepmod/utils/converters/term.rb +2 -2
- data/lib/stepmod/utils/converters/text.rb +68 -0
- data/lib/stepmod/utils/html_to_asciimath.rb +157 -0
- data/lib/stepmod/utils/smrl_description_converter.rb +49 -0
- data/lib/stepmod/utils/smrl_resource_converter.rb +67 -0
- data/lib/stepmod/utils/stepmod_definition_converter.rb +21 -21
- data/lib/stepmod/utils/stepmod_file_annotator.rb +54 -0
- data/lib/stepmod/utils/version.rb +1 -1
- data/migrating_from_cvs.adoc +190 -0
- data/stepmod-utils.gemspec +2 -1
- metadata +70 -8
- data/.github/workflows/macos.yml +0 -39
- data/.github/workflows/ubuntu.yml +0 -53
- data/.github/workflows/windows.yml +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30293492d1d3224173ac5070db26552c4cb1df8d6d56059e8180a461e85b6fed
|
4
|
+
data.tar.gz: b784155408f9c0cef9ad0c3665bfe5defa35a3458ad5b9ffda75ca0aa612476a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adb0dd04f01590a002552dedb5975d07bcb0897c1c2fe443e5d3ff865ab7c7c1ebc774e1414febabd2305c24abef5560ad4f1b24034aeba05fe0f89f956a9c36
|
7
|
+
data.tar.gz: 48dca001c264cc71a3c415ad255f7c7161cebfb4f3cb91990a2b4e538cb72b404d8e12fa3f1f046c65b8538a32cbca0004846ac0f517c3756f47bfaee9a127fa
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
continue-on-error: ${{ matrix.experimental }}
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
+
experimental: [ false ]
|
22
|
+
include:
|
23
|
+
- ruby: '3.0'
|
24
|
+
os: 'ubuntu-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: '3.0'
|
27
|
+
os: 'windows-latest'
|
28
|
+
experimental: true
|
29
|
+
- ruby: '3.0'
|
30
|
+
os: 'macos-latest'
|
31
|
+
experimental: true
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@master
|
34
|
+
|
35
|
+
- uses: ruby/setup-ruby@v1
|
36
|
+
with:
|
37
|
+
ruby-version: ${{ matrix.ruby }}
|
38
|
+
bundler-cache: true
|
39
|
+
|
40
|
+
- run: bundle exec rake
|
41
|
+
|
42
|
+
tests-passed:
|
43
|
+
needs: rake
|
44
|
+
runs-on: ubuntu-latest
|
45
|
+
steps:
|
46
|
+
- uses: peter-evans/repository-dispatch@v1
|
47
|
+
with:
|
48
|
+
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
49
|
+
repository: ${{ github.repository }}
|
50
|
+
event-type: notify
|
51
|
+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
@@ -1,41 +1,39 @@
|
|
1
1
|
name: release
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
next_version:
|
7
|
+
description: |
|
8
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
9
|
+
required: true
|
10
|
+
default: 'patch'
|
7
11
|
|
8
12
|
jobs:
|
9
13
|
release:
|
10
|
-
runs-on: ubuntu-
|
14
|
+
runs-on: ubuntu-latest
|
11
15
|
steps:
|
12
|
-
- uses: actions/checkout@
|
13
|
-
|
14
|
-
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
|
18
|
+
- uses: ruby/setup-ruby@v1
|
15
19
|
with:
|
16
20
|
ruby-version: '2.6'
|
17
|
-
|
18
|
-
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- name: Run specs
|
27
|
-
run: |
|
28
|
-
bundle exec rake
|
29
|
-
- name: Publish to rubygems.org
|
21
|
+
|
22
|
+
- run: gem install gem-release
|
23
|
+
|
24
|
+
- run: |
|
25
|
+
git config user.name github-actions
|
26
|
+
git config user.email github-actions@github.com
|
27
|
+
gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
28
|
+
|
29
|
+
- name: publish to rubygems.org
|
30
30
|
env:
|
31
31
|
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
32
32
|
run: |
|
33
33
|
gem install gem-release
|
34
|
-
touch ~/.gem/credentials
|
35
34
|
cat > ~/.gem/credentials << EOF
|
36
35
|
---
|
37
36
|
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
38
37
|
EOF
|
39
38
|
chmod 0600 ~/.gem/credentials
|
40
|
-
git status
|
41
39
|
gem release
|
data/Gemfile
CHANGED
data/Makefile
ADDED
data/README.adoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= STEPmod utilities
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/metanorma.svg["Gem Version", link="https://rubygems.org/gems/metanorma"]
|
4
4
|
image:https://github.com/metanorma/stepmod-utils/workflows/ubuntu/badge.svg["Ubuntu Build Status", link="https://github.com/metanorma/stepmod-utils/actions?query=workflow%3Aubuntu"]
|
@@ -10,7 +10,13 @@ image:https://img.shields.io/github/commits-since/metanorma/stepmod-utils/latest
|
|
10
10
|
|
11
11
|
== Purpose
|
12
12
|
|
13
|
-
The stepmod-utils Ruby gem provides a number of tools to work with the STEPmod repository
|
13
|
+
The `stepmod-utils` Ruby gem provides a number of tools to work with the STEPmod repository.
|
14
|
+
|
15
|
+
|
16
|
+
== CVS to Git migration procedures
|
17
|
+
|
18
|
+
include::migrating_from_cvs.adoc[]
|
19
|
+
|
14
20
|
|
15
21
|
== Installation
|
16
22
|
|
@@ -37,4 +43,132 @@ Then these files will be created:
|
|
37
43
|
* `031-generated-terms.adoc` all terms extracted
|
38
44
|
* `991-generated-bibliography.adoc` all bibliographic sources where the terms come from
|
39
45
|
|
46
|
+
== Conversion of STEPmod descriptions.xml into adoc
|
47
|
+
|
48
|
+
[source,sh]
|
49
|
+
----
|
50
|
+
$ stepmod-convert-express-description /path/to/the/stepmod/descriptions.xml
|
51
|
+
----
|
52
|
+
|
53
|
+
Example output:
|
54
|
+
[source,adoc]
|
55
|
+
-----
|
56
|
+
(*"application_context_schema"
|
57
|
+
|
58
|
+
*)
|
59
|
+
(*"application_context_schema.exchange_identification_context_select"
|
60
|
+
The *exchange\_identification\_context\_select* type allows for the designation of the data types express_ref:[management_resources_schema:ir_express:management_resources_schema.identification_assignment] and express_ref:[person_organization_schema:ir_express:person_organization_schema.organization] .
|
61
|
+
*)
|
62
|
+
(*"application_context_schema.application_context"
|
63
|
+
An *application\_context*, as defined in ISO 10303-1, is a context in which product data is defined and has meaning. An *application\_context* represents various types of information that relate to product data and may affect the meaning and usage of that data.
|
64
|
+
*)
|
65
|
+
(*"application_context_schema.application_context.application"
|
66
|
+
|
67
|
+
the express_ref:[support_resource_schema:ir_express:support_resource_schema.label] by which the *application\_context* is known.
|
68
|
+
|
69
|
+
[NOTE]
|
70
|
+
--
|
71
|
+
The meaning of this attribute can be defined in the annotated EXPRESS schemas that use or specialize this entity, or in an agreement of common understanding between the partners sharing this information.
|
72
|
+
--
|
73
|
+
|
74
|
+
*)
|
75
|
+
-----
|
76
|
+
|
77
|
+
|
78
|
+
== Conversion of STEPmod resource.xml into adoc
|
79
|
+
|
80
|
+
Given resource.xml file contents:
|
81
|
+
|
82
|
+
[source,xml]
|
83
|
+
----
|
84
|
+
<schema name="contract_schema" number="8369" version="3">
|
85
|
+
<introduction>
|
86
|
+
The subject of the <b>contract_schema</b> is the description of contract agreements.
|
87
|
+
</introduction>
|
88
|
+
<fund_cons>
|
89
|
+
Contract information may be attached to any aspect of a product data.
|
90
|
+
</fund_cons>
|
91
|
+
<express-g>
|
92
|
+
<imgfile file="contract_schemaexpg1.xml"/>
|
93
|
+
<imgfile file="contract_schemaexpg2.xml"/>
|
94
|
+
</express-g>
|
95
|
+
</schema>
|
96
|
+
----
|
97
|
+
|
98
|
+
Command:
|
99
|
+
|
100
|
+
[source,sh]
|
101
|
+
----
|
102
|
+
$ stepmod-convert-express-resource resource.xml
|
103
|
+
----
|
104
|
+
|
105
|
+
Will give output:
|
106
|
+
|
107
|
+
[source,adoc]
|
108
|
+
----
|
109
|
+
== Introduction
|
110
|
+
|
111
|
+
The subject of the *contract_schema* is the description of contract agreements.
|
112
|
+
|
113
|
+
== Fundamental concerns
|
114
|
+
|
115
|
+
Contract information may be attached to any aspect of a product data.
|
116
|
+
|
117
|
+
expg_image:contract_schemaexpg1.xml[]
|
118
|
+
expg_image:contract_schemaexpg2.xml[]
|
119
|
+
----
|
120
|
+
|
121
|
+
|
122
|
+
== CVS revision detection
|
123
|
+
|
124
|
+
If the STEPmod repository is a CVS repository, it will display the
|
125
|
+
working and repository revisions as comments.
|
126
|
+
|
127
|
+
WARNING: CVS revision detection can be *slow*! Be patient.
|
128
|
+
|
129
|
+
Sample output:
|
130
|
+
|
131
|
+
[source,sh]
|
132
|
+
----
|
133
|
+
[stepmod-utils] INFO: STEPmod directory set to ../x/stepmod/.
|
134
|
+
[stepmod-utils] INFO: STEPmod directory is a CVS repository and will detect revisions.
|
135
|
+
[stepmod-utils] INFO: [CVS] Detecting file revisions can be slow, please be patient!
|
136
|
+
[stepmod-utils] INFO: Detecting paths...
|
137
|
+
[stepmod-utils] INFO: Processing XML file data/business_object_models/managed_model_based_3d_engineering/business_object_model.xml
|
138
|
+
[stepmod-utils] INFO: Detecting CVS revision...
|
139
|
+
[stepmod-utils] INFO: CVS working rev (1.148), repo rev (1.148)
|
140
|
+
[stepmod-utils] INFO: Completed processing XML file data/business_object_models/managed_model_based_3d_engineering/business_object_model.xml
|
141
|
+
[stepmod-utils] INFO: Processing XML file data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
142
|
+
[stepmod-utils] INFO: Detecting CVS revision...
|
143
|
+
[stepmod-utils] INFO: CVS working rev (1.31), repo rev (1.31)
|
144
|
+
[stepmod-utils] INFO: Completed processing XML file data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
145
|
+
...
|
146
|
+
stepmod/data/business_object_models/managed_model_based_3d_engineering_domain/business_object_model.xml
|
147
|
+
[stepmod-utils] INFO: written to: 031-generated-terms.adoc
|
148
|
+
[stepmod-utils] INFO: written to: 991-generated-bibliography.adoc
|
149
|
+
----
|
150
|
+
|
151
|
+
|
152
|
+
== Non-CVS repository
|
153
|
+
|
154
|
+
If the STEPmod repository is not a CVS repository, or if the `cvs` executable
|
155
|
+
cannot be found, term extract will still work.
|
156
|
+
|
157
|
+
Sample output:
|
158
|
+
|
159
|
+
[source,sh]
|
160
|
+
----
|
161
|
+
[stepmod-utils] INFO: STEPmod directory set to ../iso-10303-stepmod.
|
162
|
+
[stepmod-utils] INFO: STEPmod directory is not a CVS repository, skipping revision detection.
|
163
|
+
[stepmod-utils] INFO: Detecting paths...
|
164
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/boundary_representation_for_iso_14306_open_jt/application_protocol.xml
|
165
|
+
[stepmod-utils] INFO: skipped ISO/CD 10303-243 as it is not IS, DIS or TS
|
166
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
167
|
+
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/configuration_control_3d_design_ed2/application_protocol.xml
|
168
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/electronic_assembly_interconnect_and_packaging_design/application_protocol.xml
|
169
|
+
[stepmod-utils] INFO: skipped ISO/CD 10303-210:2019 as it is not IS, DIS or TS
|
170
|
+
[stepmod-utils] INFO: Processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
171
|
+
[stepmod-utils] INFO: Completed processing XML file data/application_protocols/functional_data_and_their_schematic_representation_for_process_plant/application_protocol.xml
|
172
|
+
...
|
173
|
+
----
|
40
174
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'stepmod/utils/smrl_description_converter'
|
5
|
+
require 'stepmod/utils/smrl_resource_converter'
|
6
|
+
|
7
|
+
express_file = ARGV.shift
|
8
|
+
resource_docs_cache_file = ARGV.shift # output of ./stepmod-build-resource-docs-cache
|
9
|
+
stepmod_dir = ARGV.first || Dir.pwd
|
10
|
+
|
11
|
+
match = File.basename(express_file).match('^(arm|mim|bom)\.exp$')
|
12
|
+
descriptions_base = match ? "#{match.captures[0]}_descriptions.xml" : 'descriptions.xml'
|
13
|
+
descriptions_file = File.join(File.dirname(express_file), descriptions_base)
|
14
|
+
|
15
|
+
output_express = File.read(express_file)
|
16
|
+
|
17
|
+
resource_docs_cache = JSON.parse(File.read(resource_docs_cache_file))
|
18
|
+
|
19
|
+
if File.exists?(descriptions_file)
|
20
|
+
descriptions = Nokogiri::XML(File.read(descriptions_file)).root
|
21
|
+
descriptions.xpath('ext_description').each do |description|
|
22
|
+
unless description.text.strip.empty? then
|
23
|
+
Dir.chdir(File.dirname(descriptions_file)) do
|
24
|
+
wrapper = "<ext_descriptions>#{description.to_s}</ext_descriptions>"
|
25
|
+
output_express << "\n" + Stepmod::Utils::SmrlDescriptionConverter.convert(wrapper)
|
26
|
+
end
|
27
|
+
else
|
28
|
+
# remark is empty, fallback to resource_docs_cache
|
29
|
+
resource_docs_dir = resource_docs_cache[description['linkend']]
|
30
|
+
if resource_docs_dir
|
31
|
+
resource_docs_file = File.join(stepmod_dir, 'data/resource_docs', resource_docs_dir, 'resource.xml')
|
32
|
+
resource_docs = Nokogiri::XML(File.read(resource_docs_file)).root
|
33
|
+
schema = resource_docs.xpath("schema[@name='#{description['linkend']}']")
|
34
|
+
|
35
|
+
Dir.chdir(File.dirname(descriptions_file)) do
|
36
|
+
wrapper = "<resource>#{schema.to_s}</resource>"
|
37
|
+
output_express << "\n" + Stepmod::Utils::SmrlResourceConverter.convert(wrapper)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
puts output_express
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'concurrent'
|
4
|
+
require 'stepmod/utils/stepmod_file_annotator'
|
5
|
+
|
6
|
+
stepmod_dir = ARGV.first || Dir.pwd
|
7
|
+
|
8
|
+
# build resource_docs cache
|
9
|
+
resource_docs_cache_file = `mktemp`
|
10
|
+
`"#{File.join(__dir__, 'stepmod-build-resource-docs-cache')}" "#{stepmod_dir}" > "#{resource_docs_cache_file}"`
|
11
|
+
|
12
|
+
# annotate each file
|
13
|
+
files = `"#{File.join(__dir__, 'stepmod-find-express-files')}" "#{stepmod_dir}"`.strip.split("\n")
|
14
|
+
MAX_THREADS = [2, Concurrent.processor_count].max * 2
|
15
|
+
MAX_QUEUE_SIZE = MAX_THREADS * 4
|
16
|
+
# https://github.com/ruby-concurrency/concurrent-ruby/blob/master/docs-source/thread_pools.md
|
17
|
+
pool = Concurrent::ThreadPoolExecutor.new(
|
18
|
+
:min_threads => MAX_THREADS,
|
19
|
+
:max_threads => MAX_THREADS,
|
20
|
+
:max_queue => MAX_QUEUE_SIZE,
|
21
|
+
:fallback_policy => :caller_runs
|
22
|
+
)
|
23
|
+
files.each_slice(MAX_QUEUE_SIZE) do |batch|
|
24
|
+
puts("Queueing next batch")
|
25
|
+
batch.each do |file|
|
26
|
+
pool.post do
|
27
|
+
puts("Queued processing #{file}")
|
28
|
+
annotated = Stepmod::Utils::StepmodFileAnnotator.new(express_file: file, resource_docs_cache_file: resource_docs_cache_file, stepmod_dir: stepmod_dir).call
|
29
|
+
File.open(File.join(File.dirname(file), "#{File.basename(file, '.exp')}_annotated.exp"), 'w') do |file|
|
30
|
+
file.puts(annotated)
|
31
|
+
end
|
32
|
+
puts("Done processing #{file}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
pool.shutdown
|
36
|
+
end
|
37
|
+
|
38
|
+
# cleanup
|
39
|
+
`rm "#{resource_docs_cache_file}"`
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
stepmod_dir = ARGV.first || Dir.pwd
|
7
|
+
|
8
|
+
schemas = {}
|
9
|
+
Dir.glob(File.join(stepmod_dir, 'data/resource_docs/*/resource.xml')).each do |resource_docs_file|
|
10
|
+
match = resource_docs_file.match('data/resource_docs/([^/]+)/resource.xml')
|
11
|
+
resource_docs_dir = match.captures[0]
|
12
|
+
|
13
|
+
resource_docs = Nokogiri::XML(File.read(resource_docs_file)).root
|
14
|
+
resource_docs.xpath('schema').each do |schema|
|
15
|
+
schemas[schema['name']] = resource_docs_dir
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
puts JSON.pretty_generate(schemas)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add self to libpath
|
9
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
10
|
+
|
11
|
+
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
+
require "rubygems/specification"
|
13
|
+
|
14
|
+
class Gem::Specification
|
15
|
+
def this; self; end
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'bundler/setup'
|
19
|
+
require 'stepmod/utils/smrl_description_converter'
|
20
|
+
|
21
|
+
ReverseAdoc.config.unknown_tags = :bypass
|
22
|
+
|
23
|
+
input_content = ARGF.read
|
24
|
+
|
25
|
+
result = Stepmod::Utils::SmrlDescriptionConverter.convert(input_content, {})
|
26
|
+
result.split("\n").each do |line|
|
27
|
+
begin
|
28
|
+
$stdout.puts(line)
|
29
|
+
$stdout.flush
|
30
|
+
rescue Errno::EPIPE
|
31
|
+
exit(74)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add self to libpath
|
9
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
10
|
+
|
11
|
+
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
+
require "rubygems/specification"
|
13
|
+
|
14
|
+
class Gem::Specification
|
15
|
+
def this; self; end
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'bundler/setup'
|
19
|
+
require 'stepmod/utils/smrl_resource_converter'
|
20
|
+
|
21
|
+
ReverseAdoc.config.unknown_tags = :bypass
|
22
|
+
|
23
|
+
input_content = ARGF.read
|
24
|
+
|
25
|
+
result = Stepmod::Utils::SmrlResourceConverter.convert(input_content, {})
|
26
|
+
result.split("\n").each do |line|
|
27
|
+
begin
|
28
|
+
$stdout.puts(line)
|
29
|
+
$stdout.flush
|
30
|
+
rescue Errno::EPIPE
|
31
|
+
exit(74)
|
32
|
+
end
|
33
|
+
end
|