relaton-index 0.2.3 → 0.2.5
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 +29 -3
- data/lib/relaton/index/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: 505b5d0118ee9844e1486dff3fbd57c1ceec35d609ca022dcb5ba4f121e3c7db
|
4
|
+
data.tar.gz: d9c7dd287a036fd2d939cf5d9a5ec6193408fc2c1de24aaa465aa38e2d8ed876
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb4cd48d2db8361dbcd8414ce8512e3dc1fe618d16e1d82ac1da53b05b3a505980d691a5a0f0f8cc09856ab38029256bd5e0ca413f7d26f7a8897ca89b9aba17
|
7
|
+
data.tar.gz: 9155e1925e674e35a7ee889bb8467c5cb21dcbf7394ba87650ed70f856725431784b6ad90e2433b8250cc61362c742acae9d5523b40d99865a7a3af5f771ed76
|
@@ -81,13 +81,15 @@ module Relaton
|
|
81
81
|
|
82
82
|
def cehck_basic_format(index)
|
83
83
|
keys = %i[file id]
|
84
|
-
index.
|
84
|
+
index.all? { |item| item.respond_to?(:keys) && item.keys.sort == keys }
|
85
85
|
end
|
86
86
|
|
87
87
|
def check_id_format(index)
|
88
88
|
return true if @id_keys.empty?
|
89
89
|
|
90
|
-
keys = index.
|
90
|
+
keys = index.each_with_object(Set.new) do |item, acc|
|
91
|
+
acc.merge item[:id].keys if item[:id].is_a?(Hash)
|
92
|
+
end
|
91
93
|
keys == @id_keys.to_set
|
92
94
|
end
|
93
95
|
|
@@ -102,7 +104,20 @@ module Relaton
|
|
102
104
|
|
103
105
|
index = YAML.safe_load yaml, permitted_classes: [Symbol]
|
104
106
|
return index if check_format index
|
107
|
+
|
108
|
+
warn_local_index_error "Wrong structure of the"
|
105
109
|
rescue Psych::SyntaxError
|
110
|
+
warn_local_index_error "YAML parsing error when reading"
|
111
|
+
end
|
112
|
+
|
113
|
+
def warn_local_index_error(reason)
|
114
|
+
warn "[relaton] #{reason} file #{file}"
|
115
|
+
if url.is_a? String
|
116
|
+
warn "[relaton] Considering #{file} file corrupt, re-downloading from #{url}"
|
117
|
+
else
|
118
|
+
warn "[relaton] Considering #{file} file corrupt, removing it."
|
119
|
+
remove
|
120
|
+
end
|
106
121
|
end
|
107
122
|
|
108
123
|
#
|
@@ -116,7 +131,18 @@ module Relaton
|
|
116
131
|
entry = zip.get_next_entry
|
117
132
|
index = YAML.safe_load(entry.get_input_stream.read, permitted_classes: [Symbol])
|
118
133
|
save index
|
119
|
-
index
|
134
|
+
warn "[relaton] Downloaded index from #{url}"
|
135
|
+
return index if check_format index
|
136
|
+
|
137
|
+
warn_remote_index_error "Wrong structure of"
|
138
|
+
rescue Psych::SyntaxError
|
139
|
+
warn_remote_index_error "YAML parsing error when reading"
|
140
|
+
end
|
141
|
+
|
142
|
+
def warn_remote_index_error(reason)
|
143
|
+
warn "[relaton] #{reason} newly downloaded file " \
|
144
|
+
"at #{file} #{url}, the remote index seems to be invalid." \
|
145
|
+
"Please report this issue at https://github.com/relaton/relaton-cli."
|
120
146
|
end
|
121
147
|
|
122
148
|
#
|
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.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-06-
|
11
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|