relaton-index 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f5ff0818b55748f6a7f41bc1d905055a2226a54f1fdf8e7bdee8f00abda5db1
4
- data.tar.gz: 76e77fe86f641f9f8f97a7e972562f576583766940d5fd763e784caf4143ef80
3
+ metadata.gz: 505b5d0118ee9844e1486dff3fbd57c1ceec35d609ca022dcb5ba4f121e3c7db
4
+ data.tar.gz: d9c7dd287a036fd2d939cf5d9a5ec6193408fc2c1de24aaa465aa38e2d8ed876
5
5
  SHA512:
6
- metadata.gz: 7a6b728ad113d6e994a04ad5058224dfd9084bc8345272f5c71882629cce416f56993e01c909012a8a79e281b44f6f4683b687c1aa2db3744c64d0108bb95820
7
- data.tar.gz: 28371d4298c344861d2934aa20b7d82f434abecc24913cc284e8231a86d0b9d48a6669336a1a9fb7ffb2c6d769b445dc014ace31efe97bac1ec0524746e2b2bd
6
+ metadata.gz: fb4cd48d2db8361dbcd8414ce8512e3dc1fe618d16e1d82ac1da53b05b3a505980d691a5a0f0f8cc09856ab38029256bd5e0ca413f7d26f7a8897ca89b9aba17
7
+ data.tar.gz: 9155e1925e674e35a7ee889bb8467c5cb21dcbf7394ba87650ed70f856725431784b6ad90e2433b8250cc61362c742acae9d5523b40d99865a7a3af5f771ed76
@@ -104,7 +104,20 @@ module Relaton
104
104
 
105
105
  index = YAML.safe_load yaml, permitted_classes: [Symbol]
106
106
  return index if check_format index
107
+
108
+ warn_local_index_error "Wrong structure of the"
107
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
108
121
  end
109
122
 
110
123
  #
@@ -118,7 +131,18 @@ module Relaton
118
131
  entry = zip.get_next_entry
119
132
  index = YAML.safe_load(entry.get_input_stream.read, permitted_classes: [Symbol])
120
133
  save index
121
- 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."
122
146
  end
123
147
 
124
148
  #
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Relaton
4
4
  module Index
5
- VERSION = "0.2.4"
5
+ VERSION = "0.2.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-index
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.