stepmod-utils 0.4.1 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb309548a8dd492982004515c2d11e45b72e4043452e72e809355dc9a8ffa7fd
4
- data.tar.gz: 27510963bd60fb68b0a63286bc7dd11efbaf3a780c3fcb0227c8934a550f830d
3
+ metadata.gz: 5b2f0b9f05434375d9b8fe91885488cc3efc712b2188aac852e02fd58d5a5809
4
+ data.tar.gz: d7a9244861b65696173a61cc46bfd70739b50beefd184612b07f10e24ab2207a
5
5
  SHA512:
6
- metadata.gz: efc594b7dab3677aa2ada861d787abd7078b222de4b6e7c5463549a4ce8c7e511bac6266e8973e3904e0dbbd4be2eb864f15cd817a172811cee5ec866783f143
7
- data.tar.gz: b3d08ac1688b6a0e0a6aafd64b7f19339fef0414f43848a84fa6a3503300c457ea52a5d585ffdd7d77a85798725a3817d54c9d032767de26c48cdfac30089870
6
+ metadata.gz: 64610bbd1d253e7d3dab575d4bb4a16059633a0526009bde73e867aed7fa873281a0256ed188f917737167d32362dbca80448169067c3f0634533323afeb8156
7
+ data.tar.gz: a4e39cdac5b8fea94d28ca2683cd662efc5eb9273e12371ca74e524bf6d65f4c45ea9aac38a59ea233665c6ff79fb19448639adbf93ed7ea8313767cdd0bd403
@@ -125,11 +125,8 @@ files.each do |file|
125
125
  destination_rel_path = Pathname.new(file).dirname.relative_path_from(stepmod_path.join("data"))
126
126
  directory_type = destination_rel_path.each_filename.to_a.first
127
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)
128
+ srl_output_schemas_path = Pathname.new(srl_output_schemas_dir)
129
+ destination_path = srl_output_schemas_path.join(destination_rel_path)
133
130
  FileUtils.mkdir_p(destination_path)
134
131
 
135
132
  annotated_file_path = destination_path.join(File.basename(file))
@@ -144,12 +141,26 @@ files.each do |file|
144
141
  system_source_path = file_system_path(source_path.to_s, filename_cache)
145
142
  image_dest_path = destination_path.join(destination)
146
143
 
144
+ if image_dest_path.exist?
145
+ puts "#{Thread.current.object_id}: Copy image SKIPPED for `#{image_dest_path}` as destination exists."
146
+ next
147
+ end
148
+
147
149
  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}`"
150
+ source_file = Pathname.new(source).basename.to_s
151
+
152
+ puts "#{Thread.current.object_id}: Copy image NOT FOUND at schema path: `#{source_file}`, trying glob..."
153
+
154
+ source_path = srl_output_schemas_path.glob("**/#{source_file}").first
155
+ if source_path
156
+ puts "EXISTS" if source_path.exist?
157
+ system_source_path = file_system_path(source_path.to_s, filename_cache)
158
+ puts "#{Thread.current.object_id}: Copy image FOUND at different path: `#{system_source_path}`"
152
159
  end
160
+ end
161
+
162
+ unless system_source_path
163
+ puts "#{Thread.current.object_id}: Copy image MISSING from `#{source_path}` to `#{image_dest_path}`"
153
164
  next
154
165
  end
155
166
 
@@ -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
- schema_name = path.dirname.basename
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, schema_name)
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
- return path if path && path.exist?
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
@@ -143,10 +147,17 @@ log("*"*30)
143
147
  log("[SRL MIGRATION] Migration starts!")
144
148
 
145
149
  log("*"*30)
146
- log("[SRL MIGRATION: stepmod2mn.jar] START document migration and SVG generation.")
150
+ log("[SRL MIGRATION: stepmod2mn.jar] START SVG generation.")
147
151
  log("*"*30)
148
152
  system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir} --svg"
149
153
  log("*"*30)
154
+ log("[SRL MIGRATION: stepmod2mn.jar] COMPLETE SVG generation.")
155
+
156
+ log("*"*30)
157
+ log("[SRL MIGRATION: stepmod2mn.jar] START document migration and SVG generation.")
158
+ log("*"*30)
159
+ system "java -Xss5m -jar #{stepmod2mn_path} #{stepmod_dir} --output #{srl_output_docs_dir}"
160
+ log("*"*30)
150
161
  log("[SRL MIGRATION: stepmod2mn.jar] COMPLETE document migration and SVG generation.")
151
162
 
152
163
  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.")
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.4.1".freeze
3
+ VERSION = "0.4.5".freeze
4
4
  end
5
5
  end
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.1
4
+ version: 0.4.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: 2023-12-02 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby