vizbuilder 1.0.5 → 1.0.6

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/vizbuilder.rb +13 -19
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb940b378df8d29c0b34ae8cafce1ffe6a2baf0997e9a5b8306bdf4c0a80208d
4
- data.tar.gz: 2a213a778a2d961cad5e9349bdaed185b5fba2fbe90eb5868d24b31f7ddabf43
3
+ metadata.gz: d6197eeb10fd826f8e6947e1c6ba0b6df754e6274caca5985456c76e234989a8
4
+ data.tar.gz: fa6b2b0014b2486b7dbd7d9e04d2ad255d9762fc3a6115a83843844351b7e8d6
5
5
  SHA512:
6
- metadata.gz: f42712411120f39a05c378e37de0cb38ab105a55aca8eab9956a9d3f99dd6433590b3559e2a26c255ae37a59045430f6a50870de8bc1866c79ecc376c63fcef3
7
- data.tar.gz: a71e0b2f144fe3bc69aacafd948af954e9a989549c9441e00c0f3a1c1955439499daf7176f7577d00012b63699d6eba70627beb742b7dfc5aefcfcf8d68338af
6
+ metadata.gz: cbb4912215b85cdd543ddbf64ab75c0c4628d429635077dc692c820b979e84f220dc24f319316eb0ba4726aef09c895eeaadedf9294dc3aa18f901b7a7146e2d
7
+ data.tar.gz: 1ae34bc33bcf5547d8feab61b50fc6016fcb6740526347fad5026d618d34d9f8da5d1aab93295b1d39674835c1d289bd277a4bf200fbc9b7f316413adb59c6b4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -411,34 +411,28 @@ class VizBuilder
411
411
  out_fname = File.join(BUILD_DIR, path)
412
412
  puts "Rendering #{out_fname}..." unless silent
413
413
 
414
- # Check if we have a layout defined, use it
415
- layout = ctx.page['layout'] || config['layout'] || nil
416
-
417
414
  # Check page data for info on how to build this path
418
415
  if ctx.page['template'].present?
416
+ # Check if we have a layout defined, use it
417
+ layout = ctx.page.key?('layout') ? ctx.page['layout'] : config['layout']
418
+
419
419
  # Make sure to render the template inside the layout render so code in the
420
420
  # erb layout and template are executed in a sensible order.
421
- content = \
421
+ content =
422
422
  if layout.present?
423
423
  ctx.render(layout) { ctx.render(ctx.page['template']) }
424
424
  else
425
425
  ctx.render(ctx.page['template'])
426
426
  end
427
+ elsif ctx.page['json'].present?
428
+ content = ctx.page['json'].to_json
429
+ elsif ctx.page['file'].present?
430
+ content = File.read(ctx.page['file'])
427
431
  else
428
- # Everything else static data and not executable, so we don't have to load
429
- # the content inside the layout execution.
430
- if ctx.page['json'].present?
431
- content = ctx.page['json'].to_json
432
- elsif ctx.page['file'].present?
433
- content = File.read(ctx.page['file'])
434
- else
435
- raise(
436
- ArgumentError,
437
- "Page '#{path}' missing one of required attributes: 'template', 'json', 'file'."
438
- )
439
- end
440
-
441
- content = ctx.render(layout) { content } if layout.present?
432
+ raise(
433
+ ArgumentError,
434
+ "Page '#{path}' missing one of required attributes: 'template', 'json', 'file'."
435
+ )
442
436
  end
443
437
 
444
438
  # If page data includes a digest flag, add sha1 digest to output filename
@@ -466,7 +460,7 @@ class VizBuilder
466
460
  Dir.glob("#{DATA_DIR}/*#{ext}") do |fname|
467
461
  key = File.basename(fname, ext).to_sym
468
462
  puts "Loading data[:#{key}] from #{fname}..."
469
- data[key] = \
463
+ data[key] =
470
464
  if ext == '.json'
471
465
  JSON.parse(File.read(fname))
472
466
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vizbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-30 00:00:00.000000000 Z
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport