vizbuilder 1.1.1 → 1.1.2
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/VERSION +1 -1
- data/lib/vizbuilder.rb +16 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71af917f2f1a1a80a6bd1d2e56bac7574e7e2a3a7b076fcbf203d461eb1924cc
|
4
|
+
data.tar.gz: 6bef1bb5f64ec5565068b1627db81a5469dcc993c26be08329f294e808546a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90e932c5a6184a02a6b9741d91bebca2dc79f7cdce4afdd4b283862ed8669b5d0ff72da055093c468401ca9578bc1d0fcf9105ed589c8d0f4865024eeedd7cd8
|
7
|
+
data.tar.gz: 44710ff243b226bb202c4c32bdd6391a34c3deec1f99dacfcf7b9b450526ba08492e60a949c23c831497fc3b1c1339d7a05ccabc5838141c03db5174db41bf80
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
data/lib/vizbuilder.rb
CHANGED
@@ -37,10 +37,10 @@ class VizBuilder
|
|
37
37
|
index_prebuilt!
|
38
38
|
# First we build prebuilt pages that need digests calculated by build_page
|
39
39
|
digested = sitemap.select { |_path, page| page[:digest] == true }
|
40
|
-
digested.each { |path, _page| build_page(path,
|
40
|
+
digested.each { |path, _page| build_page(path, silent: silent) }
|
41
41
|
# Then we build all other pages
|
42
42
|
undigested = sitemap.reject { |_path, page| page[:digest] == true }
|
43
|
-
undigested.each { |path, _page| build_page(path,
|
43
|
+
undigested.each { |path, _page| build_page(path, silent: silent) }
|
44
44
|
end
|
45
45
|
|
46
46
|
# Run this builder as a server
|
@@ -112,8 +112,7 @@ class VizBuilder
|
|
112
112
|
# Check our sitemap then our prebuilt folder for content to serve
|
113
113
|
if sitemap[path].present?
|
114
114
|
content_type = MimeMagic.by_path(path).to_s
|
115
|
-
|
116
|
-
content = build_page(path, ctx)
|
115
|
+
content = build_page(path)
|
117
116
|
status = 200
|
118
117
|
elsif File.exist?(build_filename)
|
119
118
|
content_type = MimeMagic.by_path(path).to_s
|
@@ -155,7 +154,7 @@ class VizBuilder
|
|
155
154
|
# data was called.
|
156
155
|
run_hook!(:after_load_data)
|
157
156
|
# Add helpers to the TemplateContext class
|
158
|
-
TemplateContext.include(*helper_modules) unless helper_modules.empty?
|
157
|
+
TemplateContext.include(*helper_modules.reverse) unless helper_modules.empty?
|
159
158
|
# Mark app configured
|
160
159
|
@_configured = true
|
161
160
|
# Chainable
|
@@ -260,7 +259,7 @@ class VizBuilder
|
|
260
259
|
if new_helpers.present?
|
261
260
|
# extend the current Config instance with the helpers, making them available
|
262
261
|
# to the rest of the configuration block
|
263
|
-
extend(*new_helpers) if type.nil? || type.to_sym == :config
|
262
|
+
extend(*new_helpers.reverse) if type.nil? || type.to_sym == :config
|
264
263
|
# add our new helpers to our array of all helpers
|
265
264
|
@helper_modules += new_helpers if type.nil? || type.to_sym == :template
|
266
265
|
end
|
@@ -406,13 +405,15 @@ class VizBuilder
|
|
406
405
|
private
|
407
406
|
|
408
407
|
# Generate one page from the sitemap and save to `build/`
|
409
|
-
def build_page(path,
|
410
|
-
|
408
|
+
def build_page(path, silent: false)
|
409
|
+
page = sitemap[path]
|
411
410
|
out_fname = File.join(BUILD_DIR, path)
|
412
411
|
puts "Rendering #{out_fname}..." unless silent
|
413
412
|
|
414
413
|
# Check page data for info on how to build this path
|
415
|
-
if
|
414
|
+
if page['template'].present?
|
415
|
+
ctx = TemplateContext.new(@config)
|
416
|
+
ctx.page = page
|
416
417
|
# Check if we have a layout defined, use it
|
417
418
|
layout = ctx.page.key?('layout') ? ctx.page['layout'] : config['layout']
|
418
419
|
|
@@ -424,10 +425,10 @@ class VizBuilder
|
|
424
425
|
else
|
425
426
|
ctx.render(ctx.page['template'])
|
426
427
|
end
|
427
|
-
elsif
|
428
|
-
content =
|
429
|
-
elsif
|
430
|
-
content = File.read(
|
428
|
+
elsif page['json'].present?
|
429
|
+
content = page['json'].to_json
|
430
|
+
elsif page['file'].present?
|
431
|
+
content = File.read(page['file'])
|
431
432
|
else
|
432
433
|
raise(
|
433
434
|
ArgumentError,
|
@@ -436,13 +437,13 @@ class VizBuilder
|
|
436
437
|
end
|
437
438
|
|
438
439
|
# If page data includes a digest flag, add sha1 digest to output filename
|
439
|
-
if
|
440
|
+
if page['digest'] == true
|
440
441
|
ext = VizBuilder.fullextname(path)
|
441
442
|
fname = File.basename(path, ext)
|
442
443
|
dir = File.dirname(path)
|
443
444
|
digest = Digest::SHA1.hexdigest(content)
|
444
445
|
digest_fname = "#{fname}-#{digest}#{ext}"
|
445
|
-
|
446
|
+
page['digest_path'] = "#{dir}/#{digest_fname}"
|
446
447
|
out_fname = File.join(BUILD_DIR, dir, digest_fname)
|
447
448
|
end
|
448
449
|
|
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.1.
|
4
|
+
version: 1.1.2
|
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-08-
|
11
|
+
date: 2019-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|