zerofetcher 0.0.50 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/zerofetcher.rb +35 -30
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81a2792ed24af1a74026a094347ad88fed70f821
|
4
|
+
data.tar.gz: 6f1404e8960b9d5dfc432b011261a03b267e17e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e919d47dabdbde86ad90f5e0294a5dbc7a09abe5c7cc68c5d4bb8022c0fdcb4f241198c9f96e98ae83c44e277f98b8b4a06f22b4c1e8dd03901d40e9985c9569
|
7
|
+
data.tar.gz: 5c3fd501d7228f0a8050eb79e6d759eaa50ab2d7f8198a8a2a2f7ea1aed5a8ff7507d07c5fd2a960fe50d47304ef4b57fd5eafe272c1cb8a047f1ab4f6a645a8
|
data/lib/zerofetcher.rb
CHANGED
@@ -16,6 +16,7 @@ class ZeroFetcher
|
|
16
16
|
@@jekyll_path
|
17
17
|
@@image_variants
|
18
18
|
@@end_point
|
19
|
+
@@site_id
|
19
20
|
|
20
21
|
def self.run
|
21
22
|
# Paths
|
@@ -61,6 +62,7 @@ class ZeroFetcher
|
|
61
62
|
end_point = config['fetcher']['end_point']
|
62
63
|
@@end_point = end_point
|
63
64
|
site_id = config['fetcher']['site_id'].to_s
|
65
|
+
@@site_id = site_id;
|
64
66
|
|
65
67
|
# Load data from API
|
66
68
|
data = self.loadDataFromApi(end_point, config['fetcher']['api_key'], site_id)
|
@@ -136,7 +138,7 @@ ErrorDocument 404 /404/index.html'
|
|
136
138
|
|
137
139
|
# save image
|
138
140
|
if page['image']
|
139
|
-
page['image'] = self.getAndSaveImages(end_point + '/media/images/
|
141
|
+
page['image'] = self.getAndSaveImages(end_point + '/media/images/'+site_id+'/pages/' + page['image'], jekyll_path+'/assets/images/pages/' + page['image'])
|
140
142
|
end
|
141
143
|
end
|
142
144
|
|
@@ -194,18 +196,20 @@ ErrorDocument 404 /404/index.html'
|
|
194
196
|
data['taxonomy'].each do |taxonomy_data_type|
|
195
197
|
taxonomy_data_type['taxonomies'].each do |taxonomy|
|
196
198
|
if '1' == taxonomy['enable_images']
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
199
|
+
FileUtils::mkdir_p jekyll_path+'/assets/images/tax-images/' + taxonomy['id']
|
200
|
+
|
201
|
+
if taxonomy.key?("terms")
|
202
|
+
taxonomy['terms'].each do |term|
|
203
|
+
if term['image']
|
204
|
+
image_path = jekyll_path+'/assets/images/tax-images/' + term['taxonomy_id']
|
205
|
+
src_image = end_point + '/media/images/'+site_id+'/taxonomies/' + term["image"]
|
206
|
+
|
207
|
+
#puts 'A: ' + src_image + ' -> ' + image_path + '/' + term["image"]
|
208
|
+
|
209
|
+
term['image'] = self.getAndSaveImages(src_image, image_path + '/' + term["image"])
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
209
213
|
end
|
210
214
|
end
|
211
215
|
end
|
@@ -243,7 +247,7 @@ ErrorDocument 404 /404/index.html'
|
|
243
247
|
|
244
248
|
# save image
|
245
249
|
if post['image']
|
246
|
-
post['image'] = self.getAndSaveImages(end_point + '/media/images/
|
250
|
+
post['image'] = self.getAndSaveImages(end_point + '/media/images/'+site_id+'/posts/' + post['image'], jekyll_path+'/assets/images/posts/' + post['image'])
|
247
251
|
end
|
248
252
|
|
249
253
|
jpost = JekyllPost.new(jekyll_path+'/_posts', post)
|
@@ -267,7 +271,7 @@ ErrorDocument 404 /404/index.html'
|
|
267
271
|
self.log(" - " + gallery['name'] + ' has ' + gallery['photos'].length.to_s + ' photos')
|
268
272
|
|
269
273
|
gallery['photos'].each_with_index do |photo,pidx|
|
270
|
-
photo['image'] = self.getAndSaveImages(end_point + '/media/images/galleries/photos/' + gallery['id'] + '/' + photo['image'], jekyll_path+'/assets/images/galleries/' + gallery['id'] + '/' + photo['image'])
|
274
|
+
photo['image'] = self.getAndSaveImages(end_point + '/media/images/'+site_id+'/galleries/photos/' + gallery['id'] + '/' + photo['image'], jekyll_path+'/assets/images/galleries/' + gallery['id'] + '/' + photo['image'])
|
271
275
|
end
|
272
276
|
end
|
273
277
|
|
@@ -288,11 +292,11 @@ ErrorDocument 404 /404/index.html'
|
|
288
292
|
if data['calendar'].key?("events")
|
289
293
|
data['calendar']['events'].each do |event|
|
290
294
|
if event['image']
|
291
|
-
event['image'] = self.getAndSaveImages(end_point + '/media/images/
|
295
|
+
event['image'] = self.getAndSaveImages(end_point + '/media/images/'+site_id+'/calendar/' + event['image'], jekyll_path+'/assets/images/calendar/' + event['image'])
|
292
296
|
end
|
293
297
|
|
294
298
|
if event['file']
|
295
|
-
self.getAndSaveFile(end_point + '/media/files/
|
299
|
+
self.getAndSaveFile(end_point + '/media/files/'+site_id+'/calendar/' + event['file'], jekyll_path+'/assets/files/calendar/' + event['file'])
|
296
300
|
end
|
297
301
|
end
|
298
302
|
end
|
@@ -314,14 +318,14 @@ ErrorDocument 404 /404/index.html'
|
|
314
318
|
if menu['image']
|
315
319
|
menu_image_path = jekyll_path+'/assets/images/menus'
|
316
320
|
|
317
|
-
src_image = end_point + '/media/images/
|
321
|
+
src_image = end_point + '/media/images/'+site_id+'/menus/' + menu['image']
|
318
322
|
|
319
323
|
menu['image'] = self.getAndSaveImages(src_image, menu_image_path + '/' + menu['image'])
|
320
324
|
end
|
321
325
|
if menu['download']
|
322
326
|
menu_download_path = jekyll_path+'/assets/files/menus'
|
323
327
|
|
324
|
-
src_image = end_point + '/media/files/
|
328
|
+
src_image = end_point + '/media/files/'+site_id+'/menu_downloads/' + menu['download']
|
325
329
|
|
326
330
|
self.getAndSaveFile(src_image, menu_download_path + '/' + menu['download'])
|
327
331
|
end
|
@@ -331,7 +335,7 @@ ErrorDocument 404 /404/index.html'
|
|
331
335
|
image_path = jekyll_path+'/assets/images/menus/items/'+menu['id']
|
332
336
|
FileUtils::mkdir_p image_path
|
333
337
|
|
334
|
-
src_image = end_point + '/media/images/
|
338
|
+
src_image = end_point + '/media/images/'+site_id+'/menus/items/' + item['image']
|
335
339
|
|
336
340
|
item['image'] = self.getAndSaveImages(src_image, image_path+'/' + item['image'])
|
337
341
|
end
|
@@ -357,7 +361,7 @@ ErrorDocument 404 /404/index.html'
|
|
357
361
|
|
358
362
|
download_path = jekyll_path+'/assets/files/downloads'
|
359
363
|
|
360
|
-
src_file = end_point + '/media/files/
|
364
|
+
src_file = end_point + '/media/files/'+site_id+'/downloads/' + download['file']
|
361
365
|
|
362
366
|
self.getAndSaveFile(src_file, download_path + '/' + download['file'])
|
363
367
|
end
|
@@ -405,7 +409,7 @@ ErrorDocument 404 /404/index.html'
|
|
405
409
|
if gallery.key?("images")
|
406
410
|
# save images
|
407
411
|
gallery['images'].each_with_index do |image,idx|
|
408
|
-
src_image = end_point + '/media/images/properties/'+row['id']+'/' + image['image']
|
412
|
+
src_image = end_point + '/media/images/'+site_id+'/properties/'+row['id']+'/' + image['image']
|
409
413
|
|
410
414
|
data['properties']['data'][pidx]['galleries'][gidx]['images'][idx]['image'] = self.getAndSaveImages(src_image, image_path+'/' + image['image'])
|
411
415
|
end
|
@@ -421,7 +425,7 @@ ErrorDocument 404 /404/index.html'
|
|
421
425
|
# save images
|
422
426
|
row['images'].each_with_index do |image,idx|
|
423
427
|
|
424
|
-
src_image = end_point + '/media/images/properties/'+row['id']+'/' + image['image']
|
428
|
+
src_image = end_point + '/media/images/'+site_id+'/properties/'+row['id']+'/' + image['image']
|
425
429
|
|
426
430
|
data['properties']['data'][pidx]['images'][idx]['image'] = self.getAndSaveImages(src_image, image_path+'/' + image['image'])
|
427
431
|
end
|
@@ -432,11 +436,11 @@ ErrorDocument 404 /404/index.html'
|
|
432
436
|
if row[ option['key'] ]
|
433
437
|
case option['input_type']
|
434
438
|
when 'file'
|
435
|
-
src_file = end_point + '/media/files/
|
439
|
+
src_file = end_point + '/media/files/'+site_id+'/property_files/' + row[ option['key'] ]
|
436
440
|
|
437
441
|
self.getAndSaveFile(src_file, option_file_path+'/' + row[ option['key'] ])
|
438
442
|
when 'image'
|
439
|
-
src_image = end_point + '/media/images/
|
443
|
+
src_image = end_point + '/media/images/'+site_id+'/property_images/' + row[ option['key'] ]
|
440
444
|
|
441
445
|
|
442
446
|
data['properties']['data'][pidx][ option['key'] ] = self.getAndSaveImages(src_image, option_image_path+'/' + row[ option['key'] ])
|
@@ -478,7 +482,7 @@ ErrorDocument 404 /404/index.html'
|
|
478
482
|
image_path = jekyll_path+'/assets/images/'+collection_type
|
479
483
|
FileUtils::mkdir_p image_path
|
480
484
|
|
481
|
-
src_image = end_point + '/media/images/'+
|
485
|
+
src_image = end_point + '/media/images/'+site_id+'/'+collection_type+'/' + val
|
482
486
|
|
483
487
|
collection_data['data'][cidx][fld_key] = self.getAndSaveImages(src_image, image_path+'/' + val)
|
484
488
|
when 'file'
|
@@ -486,7 +490,7 @@ ErrorDocument 404 /404/index.html'
|
|
486
490
|
file_path = jekyll_path+'/assets/files/'+collection_type
|
487
491
|
FileUtils::mkdir_p file_path
|
488
492
|
|
489
|
-
src_file = end_point + '/media/files/'+
|
493
|
+
src_file = end_point + '/media/files/'+site_id+'/'+collection_type+'/' + val
|
490
494
|
|
491
495
|
self.getAndSaveFile(src_file, file_path+'/' + val)
|
492
496
|
end
|
@@ -508,7 +512,7 @@ ErrorDocument 404 /404/index.html'
|
|
508
512
|
image_path = jekyll_path+'/assets/images/'+collection_type+'/'+hasmany_type+'/'+row['id']
|
509
513
|
FileUtils::mkdir_p image_path
|
510
514
|
|
511
|
-
src_image = end_point + '/media/images/'+
|
515
|
+
src_image = end_point + '/media/images/'+site_id+'/'+collection_type+'/'+row['id']+'/' + val
|
512
516
|
|
513
517
|
collection_data['data'][cidx]['hasmany_data'][hasmany_type]['data'][hsidx][fld_key] = self.getAndSaveImages(src_image, image_path+'/' + val)
|
514
518
|
when 'file'
|
@@ -516,7 +520,7 @@ ErrorDocument 404 /404/index.html'
|
|
516
520
|
file_path = jekyll_path+'/assets/files/'+collection_type+'/'+hasmany_type+'/'+row['id']
|
517
521
|
FileUtils::mkdir_p file_path
|
518
522
|
|
519
|
-
src_file = end_point + '/media/files/'+
|
523
|
+
src_file = end_point + '/media/files/'+site_id+'/'+collection_type+'/'+row['id']+'/' + val
|
520
524
|
|
521
525
|
self.getAndSaveFile(src_file, file_path+'/' + val)
|
522
526
|
end
|
@@ -583,7 +587,8 @@ ErrorDocument 404 /404/index.html'
|
|
583
587
|
##puts ' - ' + idx.to_s + ' saving tax image'
|
584
588
|
##puts ' - - ['+tax_row["image"]+']'
|
585
589
|
image_path = @@jekyll_path+'/assets/images/tax-images/' + tax_row['taxonomy_id']
|
586
|
-
src_image = @@end_point + '/media/images/
|
590
|
+
src_image = @@end_point + '/media/images/'+@@site_id+'/taxonomies/' + tax_row["image"]
|
591
|
+
#puts 'F: ' + src_image + ' -> ' + image_path + '/' + tax_row["image"]
|
587
592
|
|
588
593
|
row['taxonomy'][idx]['image'] = self.getAndSaveImages(src_image, image_path + '/' + tax_row["image"])
|
589
594
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zerofetcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Liccardo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: image_optimizer
|