stepmod-utils 0.4.2 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/stepmod-annotate-all +40 -11
- data/exe/stepmod-srl-migrate +17 -6
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 452e61db6853badb9ad2d292020fe4e2209b8929b350aa1e72eb2861774fad18
|
4
|
+
data.tar.gz: 585b3f1442e98f0416c061410dd0308d34912d065bc6eb347f05fe1a4d09ae3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94e1ee3ff438a2982c464b7e0c478f0b1fade7c7472d01bfeabccab76892834bec5e5bc0f62739a6ab37062be3cc3ececdbf7d8f7f1fe8aa7a6fc6b7564e2d6
|
7
|
+
data.tar.gz: 92c857ca6f410d1f00a3498a908a5255cbab78cec9cac603b54c0e40ecf38c3de442827176df4cd3ac81aac4b7fa22f17b4a667b859153f89c7169b2293fdb48
|
data/exe/stepmod-annotate-all
CHANGED
@@ -25,13 +25,21 @@ OptionParser.new do |opts|
|
|
25
25
|
end
|
26
26
|
|
27
27
|
opts.on(
|
28
|
-
"--
|
28
|
+
"--schemas SRL_SCHEMAS_DIR",
|
29
29
|
String,
|
30
30
|
"Path to output SRL schemas",
|
31
31
|
) do |path|
|
32
32
|
options[:srl_output_schemas_dir] = path
|
33
33
|
end
|
34
34
|
|
35
|
+
opts.on(
|
36
|
+
"--documents SRL_DOCS_DIR",
|
37
|
+
String,
|
38
|
+
"Path to SRL documents (generated by stepmod2mn)",
|
39
|
+
) do |path|
|
40
|
+
options[:srl_output_docs_dir] = path
|
41
|
+
end
|
42
|
+
|
35
43
|
opts.on_tail("-h", "--help", "Show this message") do
|
36
44
|
puts opts
|
37
45
|
exit
|
@@ -48,9 +56,17 @@ end
|
|
48
56
|
log "STEPmod data path: `#{stepmod_dir}`"
|
49
57
|
|
50
58
|
srl_output_schemas_dir = options[:srl_output_schemas_dir]
|
51
|
-
raise StandardError.new("--
|
59
|
+
raise StandardError.new("--schemas directory for SRL schemas not set") unless srl_output_schemas_dir
|
52
60
|
log "SRL schemas output path: `#{srl_output_schemas_dir}`"
|
53
61
|
|
62
|
+
srl_output_docs_dir = options[:srl_output_docs_dir]
|
63
|
+
raise StandardError.new("--documents directory for SRL documents (generated by stepmod2mn) not set") unless srl_output_docs_dir
|
64
|
+
log "SRL documents path: `#{srl_output_docs_dir}`"
|
65
|
+
|
66
|
+
unless File.exist?(srl_output_docs_dir) && File.directory?(srl_output_docs_dir)
|
67
|
+
raise StandardError.new("--documents directory for SRL documents (generated by stepmod2mn) does not exist yet, please run stepmod2mn")
|
68
|
+
end
|
69
|
+
|
54
70
|
def all_express_files(stepmod_dir)
|
55
71
|
index_file = File.read(File.join(stepmod_dir, "repository_index.xml"))
|
56
72
|
index = Nokogiri::XML(index_file).root
|
@@ -113,6 +129,9 @@ files = all_express_files(stepmod_dir)
|
|
113
129
|
filename_cache = {}
|
114
130
|
|
115
131
|
FileUtils.mkdir_p(srl_output_schemas_dir)
|
132
|
+
srl_output_schemas_path = Pathname.new(srl_output_schemas_dir)
|
133
|
+
srl_output_docs_path = Pathname.new(srl_output_docs_dir)
|
134
|
+
|
116
135
|
|
117
136
|
files.each do |file|
|
118
137
|
puts "#{Thread.current.object_id}: `#{file}` processing..."
|
@@ -125,11 +144,7 @@ files.each do |file|
|
|
125
144
|
destination_rel_path = Pathname.new(file).dirname.relative_path_from(stepmod_path.join("data"))
|
126
145
|
directory_type = destination_rel_path.each_filename.to_a.first
|
127
146
|
|
128
|
-
|
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)
|
147
|
+
destination_path = srl_output_schemas_path.join(destination_rel_path)
|
133
148
|
FileUtils.mkdir_p(destination_path)
|
134
149
|
|
135
150
|
annotated_file_path = destination_path.join(File.basename(file))
|
@@ -144,12 +159,26 @@ files.each do |file|
|
|
144
159
|
system_source_path = file_system_path(source_path.to_s, filename_cache)
|
145
160
|
image_dest_path = destination_path.join(destination)
|
146
161
|
|
162
|
+
if image_dest_path.exist?
|
163
|
+
puts "#{Thread.current.object_id}: Copy image SKIPPED for `#{image_dest_path}` as destination exists."
|
164
|
+
next
|
165
|
+
end
|
166
|
+
|
147
167
|
unless system_source_path
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
168
|
+
source_file = Pathname.new(source).basename.to_s
|
169
|
+
|
170
|
+
puts "#{Thread.current.object_id}: Copy image NOT FOUND at schema path: `#{source_file}`, trying glob..."
|
171
|
+
|
172
|
+
source_path = (srl_output_schemas_path.glob("**/#{source_file}") + srl_output_docs_path.glob("**/#{source_file}")).first
|
173
|
+
if source_path
|
174
|
+
puts "EXISTS" if source_path.exist?
|
175
|
+
system_source_path = file_system_path(source_path.to_s, filename_cache)
|
176
|
+
puts "#{Thread.current.object_id}: Copy image FOUND at different path: `#{system_source_path}`"
|
152
177
|
end
|
178
|
+
end
|
179
|
+
|
180
|
+
unless system_source_path
|
181
|
+
puts "#{Thread.current.object_id}: Copy image MISSING from `#{source_path}` to `#{image_dest_path}`"
|
153
182
|
next
|
154
183
|
end
|
155
184
|
|
data/exe/stepmod-srl-migrate
CHANGED
@@ -17,11 +17,11 @@ def log(message, indent = 0)
|
|
17
17
|
puts "[stepmod-utils] #{message}"
|
18
18
|
end
|
19
19
|
|
20
|
-
def copy_files_to_schemas(path, srl_output_docs_dir)
|
21
|
-
|
20
|
+
def copy_files_to_schemas(path, stepmod_path, srl_output_docs_dir)
|
21
|
+
base_path = path.dirname.relative_path_from(File.join(stepmod_path, "data"))
|
22
22
|
file_name = path.basename
|
23
23
|
|
24
|
-
new_dir = File.join(srl_output_docs_dir,
|
24
|
+
new_dir = File.join(srl_output_docs_dir, base_path.to_s)
|
25
25
|
new_file_path = File.join(new_dir, file_name)
|
26
26
|
|
27
27
|
unless Dir.exist?(new_dir)
|
@@ -75,7 +75,12 @@ OptionParser.new do |opts|
|
|
75
75
|
end.parse!
|
76
76
|
|
77
77
|
def download_stepmod2mn(path)
|
78
|
-
|
78
|
+
if path && path.exist?
|
79
|
+
puts "Specified `stepmod2mn.jar` found, skipping download."
|
80
|
+
return path
|
81
|
+
end
|
82
|
+
|
83
|
+
puts "Specified `stepmod2mn.jar` not found, downloading from GitHub."
|
79
84
|
|
80
85
|
require 'octokit'
|
81
86
|
require "down"
|
@@ -104,7 +109,6 @@ if !stepmod2mn_path.nil?
|
|
104
109
|
else
|
105
110
|
stepmod2mn_path = download_stepmod2mn(Pathname.new(stepmod2mn_path))
|
106
111
|
end
|
107
|
-
puts "Specified `stepmod2mn.jar` not found, downloading from GitHub."
|
108
112
|
else
|
109
113
|
stepmod2mn_path = download_stepmod2mn(nil)
|
110
114
|
end
|
@@ -142,6 +146,13 @@ log "SRL output documents directory path: `#{srl_output_docs_dir}`"
|
|
142
146
|
log("*"*30)
|
143
147
|
log("[SRL MIGRATION] Migration starts!")
|
144
148
|
|
149
|
+
log("*"*30)
|
150
|
+
log("[SRL MIGRATION: stepmod2mn.jar] START SVG generation.")
|
151
|
+
log("*"*30)
|
152
|
+
system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir} --svg"
|
153
|
+
log("*"*30)
|
154
|
+
log("[SRL MIGRATION: stepmod2mn.jar] COMPLETE SVG generation.")
|
155
|
+
|
145
156
|
log("*"*30)
|
146
157
|
log("[SRL MIGRATION: stepmod2mn.jar] START document migration and SVG generation.")
|
147
158
|
log("*"*30)
|
@@ -161,7 +172,7 @@ log("[SRL MIGRATION: stepmod-utils] START EXPRESS change YAML extraction.")
|
|
161
172
|
system "stepmod-extract-changes -p #{stepmod_dir}"
|
162
173
|
Dir.glob("#{stepmod_dir}/data/**/*.changes.yaml").each do |filepath|
|
163
174
|
path = Pathname.new(filepath)
|
164
|
-
copy_files_to_schemas(path, srl_output_schemas_dir)
|
175
|
+
copy_files_to_schemas(path, stepmod_dir, srl_output_schemas_dir)
|
165
176
|
end
|
166
177
|
log("*"*30)
|
167
178
|
log("[SRL MIGRATION: stepmod-utils] COMPLETE EXPRESS change YAML extraction.")
|
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.
|
4
|
+
version: 0.4.6
|
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-12-
|
11
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|