zerofetcher 0.0.53 → 0.0.54

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be001929b75652e1b28f94b958f72a56cd405a4c
4
- data.tar.gz: 25aa947d4044236c32ac6979d73d0fb8b869bad8
3
+ metadata.gz: bfa2627dd77f48d6a6b0f8432e9f9084d6cf2ec6
4
+ data.tar.gz: a7b3bca0cbe2008b1a8d161a4a739e6289f1ac9c
5
5
  SHA512:
6
- metadata.gz: b8ec366de567e282969b7ea8af3f27e4fac2a79d5a97f084bd3645049804f9cfd177fad5cc524d0ae37c52ba1ee97eb9b965daafab84203efc56f0f6059b60e4
7
- data.tar.gz: faf7a44e0542bad27781eb36fb31bb96416e8d64ac2b298ba597f5a5104f6715c8cfb57af933679cafa6d28b56348cc937c7286ac638df02b97852b70dcfedc6
6
+ metadata.gz: 9ec5efdceae35387249cb56cbb39f8248cb41b57d59c97b9bcdddc51fe1f013c51985202ca36de03c31bf5b780f366b9969f614dd7caa30041d17328cbe64ffe
7
+ data.tar.gz: '089a78fd6f4be8d0e646228fbac1f79871e93c97b72bce4f7a85431055a255864e51c3bf222cc8204405cdecb54d8b9cd4dc31d80c2d60cddd18cf4354726ea8'
@@ -70,12 +70,12 @@ class JekyllFile
70
70
 
71
71
  # add content
72
72
  @content_keys.each do |key|
73
- if @file_data.key?(key)
74
- if @file_data[key].is_a? String
75
- @content_section = @file_data[key]
76
- end
73
+ if @file_data.key?(key)
74
+ if @file_data[key].is_a? String
75
+ @content_section = @file_data[key]
77
76
  end
78
77
  end
78
+ end
79
79
  end
80
80
  end
81
81
 
@@ -141,7 +141,7 @@ class JekyllFile
141
141
  end
142
142
 
143
143
  def saveContentFile(file_path, contents)
144
- File.write(file_path, contents)
144
+ ZeroFetcher.writeFile(file_path, contents)
145
145
  end
146
146
 
147
147
  def savePageFile
@@ -12,7 +12,8 @@ class JekyllPost
12
12
  file_contents = @yaml_parsed.to_yaml
13
13
  file_contents += '---'+"\n"
14
14
  file_contents += @content_section
15
- File.write(@file_path, file_contents)
15
+
16
+ ZeroFetcher.writeFile(@file_path, file_contents)
16
17
  end
17
18
 
18
19
  def initialize(path, post)
data/lib/zerofetcher.rb CHANGED
@@ -76,7 +76,7 @@ class ZeroFetcher
76
76
 
77
77
  # Site Info
78
78
  if data.key?("site")
79
- File.write(jekyll_path+'/_data/site.json', JSON.pretty_generate(data['site']))
79
+ self.writeFile( jekyll_path+'/_data/site.json', JSON.pretty_generate(data['site']) )
80
80
  self.log('Writing File /_data/site.json')
81
81
  end
82
82
 
@@ -89,7 +89,8 @@ class ZeroFetcher
89
89
  RewriteEngine On
90
90
  Redirect 301 /d3panel '+end_point+'/d3panel?sitekey='+data['site']['key']+'
91
91
  ErrorDocument 404 /404/index.html'
92
- File.write(jekyll_path+'/.htaccess', htaccess)
92
+
93
+ self.writeFile( jekyll_path+'/.htaccess', htaccess )
93
94
 
94
95
  # Image Variants
95
96
  @@image_variants = data['image_variants']
@@ -142,7 +143,7 @@ ErrorDocument 404 /404/index.html'
142
143
  end
143
144
  end
144
145
 
145
- File.write(jekyll_path+'/_data/pages.json', JSON.pretty_generate(pages))
146
+ self.writeFile( jekyll_path+'/_data/pages.json', JSON.pretty_generate(pages) )
146
147
  self.log("Writing File /_data/pages.json")
147
148
 
148
149
  # Clean Unused Pages
@@ -161,7 +162,7 @@ ErrorDocument 404 /404/index.html'
161
162
 
162
163
  # Variables
163
164
  if data.key?("variables")
164
- File.write(jekyll_path+'/_data/vars.json', JSON.pretty_generate(data['variables']))
165
+ self.writeFile( jekyll_path+'/_data/vars.json', JSON.pretty_generate(data['variables']) )
165
166
  self.log("Writing File /_data/vars.json")
166
167
  end
167
168
 
@@ -173,7 +174,7 @@ ErrorDocument 404 /404/index.html'
173
174
 
174
175
  data['content_blocks'].each do |key, content_block|
175
176
  self.log('writing File /_includes/content_blocks/'+key+'.md')
176
- File.write(cb_folder+'/'+key+'.md' , content_block.to_s)
177
+ self.writeFile( cb_folder+'/'+key+'.md' , content_block.to_s );
177
178
  end
178
179
  end
179
180
 
@@ -188,7 +189,7 @@ ErrorDocument 404 /404/index.html'
188
189
  image = self.getAndSaveImages(end_point + '/media/images/'+site_id+'/content-blocks/' + image, jekyll_path+'/assets/images/content/' + image)
189
190
  end
190
191
 
191
- File.write(jekyll_path+'/_data/content_images.json', JSON.pretty_generate(data['content_images']))
192
+ self.writeFile( jekyll_path+'/_data/content_images.json', JSON.pretty_generate(data['content_images']) )
192
193
  end
193
194
 
194
195
  # Taxonomy
@@ -214,7 +215,7 @@ ErrorDocument 404 /404/index.html'
214
215
  end
215
216
  end
216
217
 
217
- File.write(jekyll_path+'/_data/taxonomy.json', JSON.pretty_generate(data['taxonomy']))
218
+ self.writeFile( jekyll_path+'/_data/taxonomy.json', JSON.pretty_generate(data['taxonomy']) );
218
219
  self.log("Writing File /_data/taxonomy.json")
219
220
  end
220
221
 
@@ -222,7 +223,7 @@ ErrorDocument 404 /404/index.html'
222
223
  if data.key?("nav_menus")
223
224
  puts 'Nav menus - ' + data['nav_menus'].length.to_s
224
225
  self.log('Nav Menus - ' + data['nav_menus'].length.to_s)
225
- File.write(jekyll_path+'/_data/nav_menus.json', JSON.pretty_generate(data['nav_menus']))
226
+ self.writeFile( jekyll_path+'/_data/nav_menus.json', JSON.pretty_generate(data['nav_menus']) )
226
227
  end
227
228
 
228
229
  # Posts
@@ -276,7 +277,7 @@ ErrorDocument 404 /404/index.html'
276
277
  end
277
278
 
278
279
  # Save Json Data
279
- File.write(jekyll_path+'/_data/galleries.json', JSON.pretty_generate(data['galleries']))
280
+ self.writeFile( jekyll_path+'/_data/galleries.json', JSON.pretty_generate(data['galleries']) )
280
281
  self.log('Writing file /_data/galleries.json')
281
282
  end
282
283
 
@@ -302,7 +303,7 @@ ErrorDocument 404 /404/index.html'
302
303
  end
303
304
 
304
305
  # Save Json Data
305
- File.write(jekyll_path+'/_data/calendar.json', JSON.pretty_generate(data['calendar']))
306
+ self.writeFile( jekyll_path+'/_data/calendar.json', JSON.pretty_generate(data['calendar']) )
306
307
  self.log('Writing File /_data/calendar.json')
307
308
  end
308
309
 
@@ -342,7 +343,7 @@ ErrorDocument 404 /404/index.html'
342
343
  end
343
344
  end
344
345
 
345
- File.write(jekyll_path+'/_data/menus.json', JSON.pretty_generate(data['menus']))
346
+ self.writeFile( jekyll_path+'/_data/menus.json', JSON.pretty_generate(data['menus']) )
346
347
 
347
348
  self.log('Writing File /_data/menus.json')
348
349
  end
@@ -350,7 +351,7 @@ ErrorDocument 404 /404/index.html'
350
351
  # Downloads
351
352
  if data.key?("downloads")
352
353
  # Save Json Data
353
- File.write(jekyll_path+'/_data/downloads.json', JSON.pretty_generate(data['downloads']))
354
+ self.writeFile( File.write(jekyll_path+'/_data/downloads.json', JSON.pretty_generate(data['downloads'])) )
354
355
 
355
356
  # Make Dir
356
357
  FileUtils::mkdir_p jekyll_path+'/assets/files/downloads'
@@ -457,8 +458,8 @@ ErrorDocument 404 /404/index.html'
457
458
  end
458
459
 
459
460
  # Save Json Data
460
- File.write(jekyll_path+'/_data/properties.json', JSON.pretty_generate(data['properties']['data']))
461
- File.write(jekyll_path+'/_data/properties_options.json', JSON.pretty_generate(data['properties']['options']))
461
+ self.writeFile( jekyll_path+'/_data/properties.json', JSON.pretty_generate(data['properties']['data']) )
462
+ self.writeFile( jekyll_path+'/_data/properties_options.json', JSON.pretty_generate(data['properties']['options']) )
462
463
 
463
464
  # Clean up unused collection files
464
465
  self.cleanUpFolder(collection_path, files_saved)
@@ -564,14 +565,14 @@ ErrorDocument 404 /404/index.html'
564
565
  end
565
566
 
566
567
  # Save Json Data
567
- File.write(jekyll_path+'/_data/'+collection_type+'.json', JSON.pretty_generate(collection_data['data']))
568
+ self.writeFile( jekyll_path+'/_data/'+collection_type+'.json', JSON.pretty_generate(collection_data['data']) )
568
569
  self.log('Writing File /_data/'+collection_type+'.json')
569
570
 
570
571
  end
571
572
 
572
573
  # Add Collections to _config.tml
573
574
  config['collections'] = collection_config
574
- File.write(jekyll_path+"/_config.yml", config.to_yaml)
575
+ self.writeFile( jekyll_path+"/_config.yml", config.to_yaml )
575
576
  self.log('Writing File /_config.yml')
576
577
  end
577
578
 
@@ -609,6 +610,12 @@ ErrorDocument 404 /404/index.html'
609
610
  file.close
610
611
  return data
611
612
  end
613
+
614
+ def self.writeFile(path, contents)
615
+ File.open(path, 'wb') do |fo|
616
+ fo.write(contents)
617
+ end
618
+ end
612
619
 
613
620
  def self.loadDataFromApi(end_point, api_key, site_id)
614
621
  uri = URI(end_point+'/api/Sites/allcontent')
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.53
4
+ version: 0.0.54
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-10-25 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: image_optimizer