stepmod-utils 0.6.3 → 0.6.5
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17f10378d866d0d9f21341181a3c49fd9fc20c791acc86043bed786df886d9c7
|
4
|
+
data.tar.gz: 10bc583e2f40b9331cf6eb2f17d762ed1e4c99286f03764c8678b5160d35a00d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40e340a93b7f95d56c3c1754ee1725dc0267c6a62d9a1f5838c39fd22ddc9e834e1d4a6c41c1598f791aaf50cbb03c265f1031650f61a1ba21b01ae6a728d3b5
|
7
|
+
data.tar.gz: f3f564dea2531731ebeea9c1dbe23e9b8597fe6400efa70b17888ff771edea063c35d5de94c4eedf8fe6968b8ed1f52d564b15b4f0b1e1900d270695ed8e43bb
|
data/exe/stepmod-srl-migrate
CHANGED
@@ -37,6 +37,10 @@ def copy_files_to_document(path, stepmod_path, srl_output_docs_dir)
|
|
37
37
|
file_name = path.basename
|
38
38
|
module_xml_path = path.dirname.join("module.xml")
|
39
39
|
# puts "module_xml_path #{module_xml_path}"
|
40
|
+
unless File.exist?(module_xml_path)
|
41
|
+
puts "[ERROR] Attempting to copy but does not exist: #{module_xml_path}"
|
42
|
+
return
|
43
|
+
end
|
40
44
|
module_xml = Nokogiri::XML(IO.read(module_xml_path)).root
|
41
45
|
|
42
46
|
part_number = module_xml.xpath("//module").first.attr("part")
|
@@ -175,11 +175,11 @@ collection)
|
|
175
175
|
deletion_nodes = schema_changes&.xpath("#{node_type}.deletions") || []
|
176
176
|
|
177
177
|
{
|
178
|
-
version
|
179
|
-
description
|
180
|
-
additions
|
181
|
-
modifications
|
182
|
-
deletions
|
178
|
+
"version" => options[:version],
|
179
|
+
"description" => options[:description] || converted_description(schema_changes.xpath("description").first),
|
180
|
+
"additions" => extract_modified_objects(addition_nodes),
|
181
|
+
"modifications" => extract_modified_objects(modification_nodes),
|
182
|
+
"deletions" => extract_modified_objects(deletion_nodes),
|
183
183
|
}
|
184
184
|
end
|
185
185
|
# rubocop:enable Metrics/MethodLength
|
@@ -188,10 +188,10 @@ collection)
|
|
188
188
|
nodes.map do |node|
|
189
189
|
node.xpath("modified.object").map do |object|
|
190
190
|
{
|
191
|
-
type
|
192
|
-
name
|
193
|
-
description
|
194
|
-
interfaced_items
|
191
|
+
"type" => object.attr("type"),
|
192
|
+
"name" => object.attr("name"),
|
193
|
+
"description" => converted_description(object.at("description")),
|
194
|
+
"interfaced_items" => object.attr("interfaced.items"),
|
195
195
|
}.compact
|
196
196
|
end
|
197
197
|
end.flatten
|
@@ -29,17 +29,21 @@ module Stepmod
|
|
29
29
|
====
|
30
30
|
image::#{svg_filename}.svg[]
|
31
31
|
|
32
|
-
#{image_document.xpath(
|
32
|
+
#{image_document.xpath("//img.area").map.with_index(1) { |n, i| schema_reference(n["href"], i) }.join("\n")}
|
33
33
|
====
|
34
34
|
SVGMAP
|
35
35
|
end
|
36
36
|
|
37
37
|
def schema_reference(xml_path, index)
|
38
|
-
if
|
38
|
+
if xml_path.include?("#")
|
39
39
|
_, express_path_part = xml_path.split("#")
|
40
|
-
"* <<express:#{express_path_part.strip}>>; #{index}"
|
40
|
+
return "* <<express:#{express_path_part.strip}>>; #{index}"
|
41
|
+
end
|
42
|
+
|
43
|
+
schema_name = File.basename(xml_path, ".*")
|
44
|
+
if schema_name.include?("expg")
|
45
|
+
"* <<#{schema_name.strip}>>; #{index}"
|
41
46
|
else
|
42
|
-
schema_name = File.basename(xml_path, ".*")
|
43
47
|
"* <<express:#{schema_name.strip}>>; #{index}"
|
44
48
|
end
|
45
49
|
end
|
@@ -43,7 +43,7 @@ module Stepmod
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
SCHEMA_VERSION_MATCH_REGEX = /^SCHEMA [0-9a-zA-Z_]
|
46
|
+
SCHEMA_VERSION_MATCH_REGEX = /^[[:space:]]*?SCHEMA [0-9a-zA-Z_]+;(?<trailing>.*)[[:space:]]*$/
|
47
47
|
def is_missing_version(schema_content)
|
48
48
|
m = schema_content.match(SCHEMA_VERSION_MATCH_REGEX)
|
49
49
|
if m.nil?
|
@@ -55,6 +55,16 @@ module Stepmod
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
def replace_schema_string_with_version(content)
|
59
|
+
m = content.match(SCHEMA_VERSION_MATCH_REGEX)
|
60
|
+
result = build_schema_string_with_version
|
61
|
+
unless m['trailing'].nil?
|
62
|
+
result = "#{result}#{m['trailing']}"
|
63
|
+
end
|
64
|
+
|
65
|
+
content.gsub!(SCHEMA_VERSION_MATCH_REGEX, result)
|
66
|
+
end
|
67
|
+
|
58
68
|
def build_schema_string_with_version
|
59
69
|
# Geometric_tolerance_arm => geometric-tolarance-arm
|
60
70
|
name_in_asn1 = @schema_name.downcase.gsub("_", "-")
|
@@ -80,7 +90,7 @@ module Stepmod
|
|
80
90
|
edition = @identifier.edition
|
81
91
|
schema_or_object = (schema_type == :module) ? "schema" : "object"
|
82
92
|
|
83
|
-
"
|
93
|
+
"\nSCHEMA #{@schema_name} '{ " \
|
84
94
|
"iso standard 10303 part(#{part}) " \
|
85
95
|
"version(#{edition}) " \
|
86
96
|
"#{schema_or_object}(1) " \
|
@@ -186,10 +196,7 @@ module Stepmod
|
|
186
196
|
puts "[annotator-WARNING] schema (#{@schema_name}) missing version string. "\
|
187
197
|
"Adding: `#{build_schema_string_with_version}` to schema."
|
188
198
|
|
189
|
-
output_express
|
190
|
-
SCHEMA_VERSION_MATCH_REGEX,
|
191
|
-
build_schema_string_with_version
|
192
|
-
)
|
199
|
+
output_express = replace_schema_string_with_version(output_express)
|
193
200
|
end
|
194
201
|
|
195
202
|
{
|
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.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|