relaton-index 0.2.4 → 0.2.6
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: 5c6f43554b0c62821e94d987ba3d9f9fab5be724206b33bb076062bc95ac2784
|
4
|
+
data.tar.gz: a0173e701a42f1ddb9851817471454598f9b60106c238fb6fc65100190ebb6b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51016e19a53b7a161112ad5a041af0d80d01b06cda5a304fad3786a024136ab77ddf66de95cdbcba6f69f6ba9bd9dc4b1cf5df020fbd93a59ab34163d6d0a566
|
7
|
+
data.tar.gz: 6a47dd6e50f542aea778755cbfb7dbdfb40364cdf7ef95fbea862ec058914d216dc3e3566dd100f75e3cae6f59444edab4517fd0b59fb3acd7cb436156021f86
|
@@ -76,10 +76,12 @@ module Relaton
|
|
76
76
|
# @return [Boolean] <description>
|
77
77
|
#
|
78
78
|
def check_format(index)
|
79
|
-
|
79
|
+
check_basic_format(index) && check_id_format(index)
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
82
|
+
def check_basic_format(index)
|
83
|
+
return false unless index.is_a? Array
|
84
|
+
|
83
85
|
keys = %i[file id]
|
84
86
|
index.all? { |item| item.respond_to?(:keys) && item.keys.sort == keys }
|
85
87
|
end
|
@@ -104,7 +106,20 @@ module Relaton
|
|
104
106
|
|
105
107
|
index = YAML.safe_load yaml, permitted_classes: [Symbol]
|
106
108
|
return index if check_format index
|
109
|
+
|
110
|
+
warn_local_index_error "Wrong structure of the"
|
107
111
|
rescue Psych::SyntaxError
|
112
|
+
warn_local_index_error "YAML parsing error when reading"
|
113
|
+
end
|
114
|
+
|
115
|
+
def warn_local_index_error(reason)
|
116
|
+
warn "[relaton] #{reason} file #{file}"
|
117
|
+
if url.is_a? String
|
118
|
+
warn "[relaton] Considering #{file} file corrupt, re-downloading from #{url}"
|
119
|
+
else
|
120
|
+
warn "[relaton] Considering #{file} file corrupt, removing it."
|
121
|
+
remove
|
122
|
+
end
|
108
123
|
end
|
109
124
|
|
110
125
|
#
|
@@ -118,7 +133,18 @@ module Relaton
|
|
118
133
|
entry = zip.get_next_entry
|
119
134
|
index = YAML.safe_load(entry.get_input_stream.read, permitted_classes: [Symbol])
|
120
135
|
save index
|
121
|
-
index
|
136
|
+
warn "[relaton] Downloaded index from #{url}"
|
137
|
+
return index if check_format index
|
138
|
+
|
139
|
+
warn_remote_index_error "Wrong structure of"
|
140
|
+
rescue Psych::SyntaxError
|
141
|
+
warn_remote_index_error "YAML parsing error when reading"
|
142
|
+
end
|
143
|
+
|
144
|
+
def warn_remote_index_error(reason)
|
145
|
+
warn "[relaton] #{reason} newly downloaded file " \
|
146
|
+
"at #{file} #{url}, the remote index seems to be invalid." \
|
147
|
+
"Please report this issue at https://github.com/relaton/relaton-cli."
|
122
148
|
end
|
123
149
|
|
124
150
|
#
|
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.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-
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|