zerofetcher 0.0.27 → 0.0.28

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zerofetcher.rb +28 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7415a6fc87d85ac694b550124ba2677ce683bf28
4
- data.tar.gz: b081a5de4c433a98edecfded0426baa1d1e5e32d
3
+ metadata.gz: 488d65417957257c3b96e40683d5f45e070cedde
4
+ data.tar.gz: f62345d8a31bf0abc81dd26ff507bea7b97b6491
5
5
  SHA512:
6
- metadata.gz: 7056697cdae13151a6a5e9a8b89f5c81d0eb9c8a841fb26ad589fdc93e332e4e280bd81175bc3c50a1de7e235084d34523f480c22bcf64c7c4ccdae0a38b562f
7
- data.tar.gz: c741fec1d32ee9d70be82e609d594a60e82f767d22765f262f65207b5baaebf4a764428085ec1fe3994ad4432b72e887ee20edbb247c4cc785c147f7ca3c3fe6
6
+ metadata.gz: 0a2a7074bf61074ffb572303ac616c385eec21073a936b1fa95625bc534b0d60f4e33037478bc9dd34f6b6d42cdaa5765866f6f4967e39e94be6a897fb51980d
7
+ data.tar.gz: 7591740ffca8410dfd5e4d80a5d87c283e36c285d62aa00d28edbc66225d2b847ec1fdbc6bae33d968f5a7f26e678ae115ccba8f1cc156806a5683cb4f4afc60
data/lib/zerofetcher.rb CHANGED
@@ -305,6 +305,13 @@ class ZeroFetcher
305
305
  # Make Dir
306
306
  FileUtils::mkdir_p jekyll_path+'/assets/images/properties'
307
307
 
308
+ # Directory Check
309
+ option_file_path = jekyll_path+'/assets/files/property_files'
310
+ FileUtils::mkdir_p option_file_path
311
+
312
+ option_image_path = jekyll_path+'/assets/images/property_images'
313
+ FileUtils::mkdir_p option_image_path
314
+
308
315
  # Save Collection Info
309
316
  collection_config[ 'properties' ] = {'output' => true}
310
317
 
@@ -316,7 +323,7 @@ class ZeroFetcher
316
323
  files_saved = Array.new
317
324
 
318
325
  # Save Individual Collection Files
319
- data['properties'].each_with_index do |row,pidx|
326
+ data['properties']['data'].each_with_index do |row,pidx|
320
327
  row_data = row.clone;
321
328
  row_data.delete('id')
322
329
  id_key = 'property_id'
@@ -334,7 +341,24 @@ class ZeroFetcher
334
341
 
335
342
  src_image = end_point + '/media/images/properties/'+row['id']+'/' + image['image']
336
343
 
337
- data['properties'][pidx]['images'][idx]['image'] = self.getAndSaveImages(src_image, image_path+'/' + image['image'])
344
+ data['properties']['data'][pidx]['images'][idx]['image'] = self.getAndSaveImages(src_image, image_path+'/' + image['image'])
345
+ end
346
+ end
347
+
348
+ # image/file option fields
349
+ data['properties']['options'].each do |option|
350
+ if row[ option['key'] ]
351
+ case option['key']
352
+ when 'file'
353
+ src_file = end_point + '/media/files/property_files/'+site_id+'/' + row[ option['key'] ]
354
+
355
+ self.getAndSaveFile(src_file, option_file_path+'/' + row[ option['key'] ])
356
+ when 'image'
357
+ src_image = end_point + '/media/images/property_images/' + site_id + '/' + row[ option['key'] ]
358
+
359
+
360
+ data['properties']['data'][pidx][ option['key'] ] = self.getAndSaveImages(src_image, option_image_path+'/' + row[ option['key'] ])
361
+ end
338
362
  end
339
363
  end
340
364
 
@@ -347,7 +371,8 @@ class ZeroFetcher
347
371
  end
348
372
 
349
373
  # Save Json Data
350
- File.write(jekyll_path+'/_data/properties.json', JSON.pretty_generate(data['properties']))
374
+ File.write(jekyll_path+'/_data/properties.json', JSON.pretty_generate(data['properties']['data']))
375
+ File.write(jekyll_path+'/_data/properties_options.json', JSON.pretty_generate(data['properties']['options']))
351
376
 
352
377
  # Clean up unused collection files
353
378
  self.cleanUpFolder(collection_path, files_saved)
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.27
4
+ version: 0.0.28
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-05-24 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fetches content from zero
14
14
  email: brian@d3corp.com