stepmod-utils 0.4.5 → 0.4.6

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: 5b2f0b9f05434375d9b8fe91885488cc3efc712b2188aac852e02fd58d5a5809
4
- data.tar.gz: d7a9244861b65696173a61cc46bfd70739b50beefd184612b07f10e24ab2207a
3
+ metadata.gz: 452e61db6853badb9ad2d292020fe4e2209b8929b350aa1e72eb2861774fad18
4
+ data.tar.gz: 585b3f1442e98f0416c061410dd0308d34912d065bc6eb347f05fe1a4d09ae3f
5
5
  SHA512:
6
- metadata.gz: 64610bbd1d253e7d3dab575d4bb4a16059633a0526009bde73e867aed7fa873281a0256ed188f917737167d32362dbca80448169067c3f0634533323afeb8156
7
- data.tar.gz: a4e39cdac5b8fea94d28ca2683cd662efc5eb9273e12371ca74e524bf6d65f4c45ea9aac38a59ea233665c6ff79fb19448639adbf93ed7ea8313767cdd0bd403
6
+ metadata.gz: d94e1ee3ff438a2982c464b7e0c478f0b1fade7c7472d01bfeabccab76892834bec5e5bc0f62739a6ab37062be3cc3ececdbf7d8f7f1fe8aa7a6fc6b7564e2d6
7
+ data.tar.gz: 92c857ca6f410d1f00a3498a908a5255cbab78cec9cac603b54c0e40ecf38c3de442827176df4cd3ac81aac4b7fa22f17b4a667b859153f89c7169b2293fdb48
@@ -25,13 +25,21 @@ OptionParser.new do |opts|
25
25
  end
26
26
 
27
27
  opts.on(
28
- "--output SRL_SCHEMAS_DIR",
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("--output directory for SRL schemas not set") unless srl_output_schemas_dir
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,7 +144,6 @@ 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
- srl_output_schemas_path = Pathname.new(srl_output_schemas_dir)
129
147
  destination_path = srl_output_schemas_path.join(destination_rel_path)
130
148
  FileUtils.mkdir_p(destination_path)
131
149
 
@@ -151,7 +169,7 @@ files.each do |file|
151
169
 
152
170
  puts "#{Thread.current.object_id}: Copy image NOT FOUND at schema path: `#{source_file}`, trying glob..."
153
171
 
154
- source_path = srl_output_schemas_path.glob("**/#{source_file}").first
172
+ source_path = (srl_output_schemas_path.glob("**/#{source_file}") + srl_output_docs_path.glob("**/#{source_file}")).first
155
173
  if source_path
156
174
  puts "EXISTS" if source_path.exist?
157
175
  system_source_path = file_system_path(source_path.to_s, filename_cache)
@@ -1,5 +1,5 @@
1
1
  module Stepmod
2
2
  module Utils
3
- VERSION = "0.4.5".freeze
3
+ VERSION = "0.4.6".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.5
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-09 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby