stepmod-utils 0.4.2 → 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: eeeb38f76c7cf7cdab0b754625328b5415039bcbd55a72c0b242c9d0c65ab56d
4
- data.tar.gz: 8cc243ca6ac8ac28e42a0459fb297623de8a49679afe325ba3e8efc13f5b42eb
3
+ metadata.gz: 5b2f0b9f05434375d9b8fe91885488cc3efc712b2188aac852e02fd58d5a5809
4
+ data.tar.gz: d7a9244861b65696173a61cc46bfd70739b50beefd184612b07f10e24ab2207a
5
5
  SHA512:
6
- metadata.gz: 816f5e4870e736ef10890e04ff5d5652cf25d4bc3bda12618a356ae8fb0b48d936fc05861173b2a793e14eee69541d3572251f11233637971642dcd45e9499ae
7
- data.tar.gz: f30e85a6cb731da00cf61e84314cbdc2faafc071380f6827706816cd419673b5c8c0725dd6d0de3f6a668f823fb986639bff3fb35961b6293027d6e32f259fd2
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
@@ -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.")
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.4.2".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.2
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-04 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