kataba 1.1.1 → 1.1.2
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/lib/kataba.rb +12 -2
- 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: 3e2048c2adaac9976b8feb4fcea1da32d937a7d39955152a579f18d81e9fe3f2
|
|
4
|
+
data.tar.gz: 806c80fff00c2a8dd637b42e1df485787e041a514ecc6372df5cb4902db8889e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15b1a25d1ed46d7510f829f4a6b51ca6516ed29edfa011b4a8395cee0bc36092e37d4ecb925e24791da6d4790435896059cabd8fb375b17278c724dff61540c9
|
|
7
|
+
data.tar.gz: 64fa54356f4d0c0387a9c52898795462524363b6fccf6632259b635adb7d2c19544760c2e0b91256cf1e22b50a3e3836868ce5581c73499bda3184f32838b086
|
data/lib/kataba.rb
CHANGED
|
@@ -61,6 +61,14 @@ module Kataba
|
|
|
61
61
|
# Arguments:
|
|
62
62
|
# xsd_uri: (String)
|
|
63
63
|
|
|
64
|
+
# Dir.chdir is process-wide state, not thread-local: if two threads each
|
|
65
|
+
# have a chdir block open at once, Ruby raises "conflicting chdir during
|
|
66
|
+
# another chdir block" rather than let one thread's cwd stomp on the
|
|
67
|
+
# other's. A shared Mutex serializes just that step across threads in one
|
|
68
|
+
# process — cheap, since by this point it's a local file read + a Nokogiri
|
|
69
|
+
# parse, not the network fetch (which stays outside the lock).
|
|
70
|
+
CHDIR_MUTEX = Mutex.new
|
|
71
|
+
|
|
64
72
|
def self.fetch_schema(xsd_uri)
|
|
65
73
|
uri_md5 = Digest::MD5.hexdigest(xsd_uri)
|
|
66
74
|
dir_path = "#{self.configuration.offline_storage}"
|
|
@@ -77,8 +85,10 @@ module Kataba
|
|
|
77
85
|
end
|
|
78
86
|
|
|
79
87
|
# Validate and return Nokogiri schema
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
CHDIR_MUTEX.synchronize do
|
|
89
|
+
Dir.chdir(dir_path) do
|
|
90
|
+
return Nokogiri::XML::Schema(IO.read(xsd_path))
|
|
91
|
+
end
|
|
82
92
|
end
|
|
83
93
|
rescue Nokogiri::XML::SyntaxError
|
|
84
94
|
# Poisoned cache (e.g. a pre-fix install that stored a bad fetch).
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kataba
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cliff
|
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
95
|
version: '0'
|
|
96
96
|
requirements: []
|
|
97
|
-
rubygems_version: 3.
|
|
97
|
+
rubygems_version: 3.2.33
|
|
98
98
|
signing_key:
|
|
99
99
|
specification_version: 4
|
|
100
100
|
summary: XML Schema Definition (XSD) mirroring and offline validation for Nokogiri
|