relaton-index 0.2.14 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton/index/file_io.rb +19 -13
- data/lib/relaton/index/pool.rb +1 -1
- data/lib/relaton/index/type.rb +1 -1
- data/lib/relaton/index/version.rb +1 -1
- data/lib/relaton/index.rb +3 -10
- 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: 4108f8054c21d68ee61c745be7a61c9d35f1dfdc054b1bf3a98b0d3d4bbe7ce1
|
4
|
+
data.tar.gz: 765718355ee7cb6182ef08513a2235be8efc45b4e2b086585c9ba6d7c7ff2006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33a29690bd1296f6c44358a513d016ab433a34f89de508466d919b22a76f834d077a6fb5fb69579b694fcfd440458e53dd5931943c3bd8cb12d4f725509fe265
|
7
|
+
data.tar.gz: 1f23d97956f434d7ceb76688da5086e7ee545c7685455f9964ece8db783f326f591a5d4ef984694ce09ee0cd6786fb63d8f24eff06875fc51157985bf8cfef63
|
@@ -106,12 +106,7 @@ module Relaton
|
|
106
106
|
yaml = Index.config.storage.read(file)
|
107
107
|
return unless yaml
|
108
108
|
|
109
|
-
|
110
|
-
return deserialize_pubid(index) if check_format index
|
111
|
-
|
112
|
-
warn_local_index_error "Wrong structure of the"
|
113
|
-
rescue Psych::SyntaxError
|
114
|
-
warn_local_index_error "YAML parsing error when reading"
|
109
|
+
load_index(yaml) || []
|
115
110
|
end
|
116
111
|
|
117
112
|
def deserialize_pubid(index)
|
@@ -134,6 +129,23 @@ module Relaton
|
|
134
129
|
@progname ||= "relaton-#{@dir}"
|
135
130
|
end
|
136
131
|
|
132
|
+
def load_index(yaml, save = false)
|
133
|
+
index = YAML.safe_load(yaml, permitted_classes: [Symbol])
|
134
|
+
save index if save
|
135
|
+
return deserialize_pubid(index) if check_format index
|
136
|
+
|
137
|
+
if save
|
138
|
+
warn_remote_index_error "Wrong structure of"
|
139
|
+
else
|
140
|
+
warn_local_index_error "Wrong structure of"
|
141
|
+
end
|
142
|
+
rescue Psych::SyntaxError
|
143
|
+
if save
|
144
|
+
warn_remote_index_error "YAML parsing error when reading"
|
145
|
+
else
|
146
|
+
warn_local_index_error "YAML parsing error when reading"
|
147
|
+
end
|
148
|
+
end
|
137
149
|
#
|
138
150
|
# Fetch index from external repository and save it to storage
|
139
151
|
#
|
@@ -144,14 +156,8 @@ module Relaton
|
|
144
156
|
zip = Zip::InputStream.new resp
|
145
157
|
entry = zip.get_next_entry
|
146
158
|
yaml = entry.get_input_stream.read
|
147
|
-
index = YAML.safe_load(yaml, permitted_classes: [Symbol])
|
148
|
-
save index
|
149
159
|
Util.info "Downloaded index from `#{url}`", progname
|
150
|
-
|
151
|
-
|
152
|
-
warn_remote_index_error "Wrong structure of"
|
153
|
-
rescue Psych::SyntaxError
|
154
|
-
warn_remote_index_error "YAML parsing error when reading"
|
160
|
+
load_index(yaml, save = true)
|
155
161
|
end
|
156
162
|
|
157
163
|
def warn_remote_index_error(reason)
|
data/lib/relaton/index/pool.rb
CHANGED
@@ -22,7 +22,7 @@ module Relaton
|
|
22
22
|
if @pool[type.upcase.to_sym]&.actual?(**args)
|
23
23
|
@pool[type.upcase.to_sym]
|
24
24
|
else
|
25
|
-
@pool[type.upcase.to_sym] = Type.new(type, args[:url], args[:file], args[:id_keys])
|
25
|
+
@pool[type.upcase.to_sym] = Type.new(type, args[:url], args[:file], args[:id_keys], args[:pubid_class])
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
data/lib/relaton/index/type.rb
CHANGED
data/lib/relaton/index.rb
CHANGED
@@ -19,17 +19,10 @@ module Relaton
|
|
19
19
|
|
20
20
|
class << self
|
21
21
|
#
|
22
|
-
#
|
22
|
+
# Proxy for Pool#type
|
23
23
|
#
|
24
|
-
|
25
|
-
|
26
|
-
# @param [String, nil] file output file name, default is config.filename
|
27
|
-
# @param [Array<Symbol>, nil] id_keys keys to check if index is correct
|
28
|
-
#
|
29
|
-
# @return [Relaton::Index::Type] typed index
|
30
|
-
#
|
31
|
-
def find_or_create(type, url: nil, file: nil, id_keys: nil)
|
32
|
-
pool.type(type, url: url, file: file, id_keys: id_keys)
|
24
|
+
def find_or_create(type, **args)
|
25
|
+
pool.type(type, **args)
|
33
26
|
end
|
34
27
|
|
35
28
|
def close(type)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-index
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pubid-core
|