obf 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/obf/utils.rb +4 -0
- data/lib/obf/validator.rb +43 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8454639e83fc8b2def96962a5ba2e31791a362e5
|
4
|
+
data.tar.gz: 7e1abb111236636a50c09a0304810513ab4d30f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 288c13639fdf253583cc2c826c0d52cc9e57a21937207883c70618ca4f7837d23920169806811b3f6fcfd827335336a395290393810160648f91e079fe859411
|
7
|
+
data.tar.gz: 14418e8801345139b24dee027718e2a4ad6a9b11ab0112a8485b17f8e206dba3f5d75913a0a551f93de38018e0967aaa654685911081390b3ee1933617d7b3be
|
data/lib/obf/utils.rb
CHANGED
data/lib/obf/validator.rb
CHANGED
@@ -193,17 +193,54 @@ module OBF
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
end
|
196
|
-
add_check('manifest_boards', 'manifest.json referenced boards') do
|
197
|
-
end
|
198
196
|
|
199
|
-
|
197
|
+
found_paths = ['manifest.json']
|
198
|
+
if json['paths'] && json['paths']['boards'] && json['paths']['boards'].is_a?(Hash)
|
199
|
+
json['paths']['boards'].each do |id, path|
|
200
|
+
add_check("manifest_boards[#{id}]", "manifest.json path.boards.#{id}") do
|
201
|
+
found_paths << path
|
202
|
+
if !zipper.glob(path)
|
203
|
+
err "board path (#{path}) not found in the zip package"
|
204
|
+
end
|
205
|
+
board_json = JSON.parse(zipper.read(path)) rescue nil
|
206
|
+
if !board_json || board_json['id'] != id
|
207
|
+
err "board at path (#{path}) defined in manifest with id \"#{id}\" but actually has id \"#{board_json['id']}\""
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
200
211
|
end
|
201
212
|
|
202
|
-
|
213
|
+
if json['paths'] && json['paths']['images'] && json['paths']['images'].id_a?(Hash)
|
214
|
+
json['paths']['images'].each do |id, path|
|
215
|
+
add_check("manifest_images[#{id}]", "manifest.json path.images.#{id}") do
|
216
|
+
found_paths << path
|
217
|
+
if !zipper.glob(path)
|
218
|
+
err "image path (#{path}) not found in the zip package"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
if json['paths'] && json['paths']['sounds'] && json['paths']['sounds'].id_a?(Hash)
|
225
|
+
json['paths']['sounds'].each do |id, path|
|
226
|
+
add_check("manifest_sounds[#{id}]", "manifest.json path.sounds.#{id}") do
|
227
|
+
found_paths << path
|
228
|
+
if !zipper.glob(path)
|
229
|
+
err "sound path (#{path}) not found in the zip package"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
actual_paths = zipper.all_files
|
236
|
+
add_check('extra_paths', 'manifest.json extra paths') do
|
237
|
+
(actual_paths - found_paths).each do |path|
|
238
|
+
warn "the file \"#{path}\" isn't listed in manifest.json"
|
239
|
+
end
|
203
240
|
end
|
204
241
|
|
205
242
|
sub_results = []
|
206
|
-
if json['paths']['boards'] && json['paths']['boards'].is_a?(Hash)
|
243
|
+
if json['paths'] && json['paths']['boards'] && json['paths']['boards'].is_a?(Hash)
|
207
244
|
json['paths']['boards'].each do |key, path|
|
208
245
|
sub = Validator.validate_obf(path, {'zipper' => zipper})
|
209
246
|
sub_results << sub
|
@@ -211,6 +248,7 @@ module OBF
|
|
211
248
|
end
|
212
249
|
@sub_checks = sub_results
|
213
250
|
end
|
251
|
+
|
214
252
|
if zipper.glob('manifest.json').length > 0
|
215
253
|
json = JSON.parse(zipper.read('manifest.json')) rescue nil
|
216
254
|
if json['root'] && json['format'] && json['format'].match(/^open-board-/)
|