stepmod-utils 0.3.32 → 0.3.34
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 +4 -4
- data/exe/stepmod-annotate-all +31 -2
- 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: 5d4cd3a24127e1903a040a5edaa734ccef3adb17b65cce4c213fdcbf3d13ea5a
|
4
|
+
data.tar.gz: fe17db00fa97f748853ed5c0de867222a5d5ba16b3c2256a498abe20814d7694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dab877d377c83d22a08dffceb223c3a7c502b353bd89756829c7fc39341c57758276731623e3e013879c0a329f9bb00de19eb5daa869a8653cd2d48f3987115
|
7
|
+
data.tar.gz: ea50ab5f75131fc5474fb21adb8aaf7692dd48da61e453c754ac762fb76dde78948c0bbe9588f5f9750347d370189c56683481daa0c94fe57c77f10838c548a4
|
data/exe/stepmod-annotate-all
CHANGED
@@ -31,6 +31,31 @@ def all_express_files(stepmod_dir)
|
|
31
31
|
files.filter { |file| File.exist?(file) }
|
32
32
|
end
|
33
33
|
|
34
|
+
# On MacOS File.exist? was behaving case sensitive while on
|
35
|
+
# Github Actions it was behaving as case in-sensitive, e.g
|
36
|
+
# File.exist?(`../resource_docs/geometric_and_topological_representation/RationalLRsurf.gif`)
|
37
|
+
# was returning true on MacOS and false on Github Action runner. Because
|
38
|
+
# the original filepath was `geometric_and_topological_representation/RationalLRSurf.gif` (notice the capital `S` for Surf.gif)
|
39
|
+
# So this method is to find the actual path of the file based on
|
40
|
+
# downcased name of the file,
|
41
|
+
#
|
42
|
+
# Example:
|
43
|
+
#
|
44
|
+
# Given `../resource_docs/geometric_and_topological_representation/RationalLRsurf.gif`
|
45
|
+
# return `../resource_docs/geometric_and_topological_representation/RationalLRSurf.gif`
|
46
|
+
# It will return nil if the file does not exist
|
47
|
+
def file_system_path(filepath, filename_cache)
|
48
|
+
dir = File.dirname(filepath)
|
49
|
+
filename = File.basename(filepath)
|
50
|
+
|
51
|
+
return filename_cache[dir][filepath.downcase] if filename_cache[dir]
|
52
|
+
|
53
|
+
files = Dir.glob(File.join(dir, "*")).map { |f| [f.downcase, f] }.to_h
|
54
|
+
filename_cache[dir] = files
|
55
|
+
|
56
|
+
filename_cache[dir][filepath.downcase]
|
57
|
+
end
|
58
|
+
|
34
59
|
MAX_THREADS = 1 #[2, Concurrent.processor_count].max * 2
|
35
60
|
MAX_QUEUE_SIZE = MAX_THREADS * 4
|
36
61
|
# https://github.com/ruby-concurrency/concurrent-ruby/blob/master/docs-source/thread_pools.md
|
@@ -42,6 +67,7 @@ MAX_QUEUE_SIZE = MAX_THREADS * 4
|
|
42
67
|
# )
|
43
68
|
|
44
69
|
files = all_express_files(stepmod_dir)
|
70
|
+
filename_cache = {}
|
45
71
|
|
46
72
|
files.each do |file|
|
47
73
|
puts "#{Thread.current.object_id}: Processing #{file}"
|
@@ -60,11 +86,14 @@ files.each do |file|
|
|
60
86
|
|
61
87
|
result[:images_references].each do |source, destination|
|
62
88
|
source_path = File.join(stepmod_dir, "data", source)
|
89
|
+
system_source_path = file_system_path(source_path, filename_cache)
|
63
90
|
destination_path = File.join(File.dirname(file), destination)
|
64
91
|
|
65
|
-
|
92
|
+
puts "#{Thread.current.object_id}: Starting to copy file from #{source_path} to #{destination_path}"
|
93
|
+
next if !system_source_path
|
66
94
|
|
67
|
-
FileUtils.cp(
|
95
|
+
FileUtils.cp(system_source_path, destination_path)
|
96
|
+
puts "#{Thread.current.object_id}: Done copying #{system_source_path} to #{destination_path}"
|
68
97
|
end
|
69
98
|
|
70
99
|
puts "#{Thread.current.object_id}: Done processing #{File.basename(file)} => #{annotated_file_path}."
|
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.3.
|
4
|
+
version: 0.3.34
|
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-11-
|
11
|
+
date: 2023-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|