flutterby 0.0.15 → 0.0.16

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: 999c3198c2142accdf16e2ceb75e3bed0d2c1465
4
- data.tar.gz: d2b5a2573131d8275baf6b64ed0def712befc72f
3
+ metadata.gz: 78586bd3d1eedcc69f7930f0085e70a1fab7ca8d
4
+ data.tar.gz: d237d120d8ff04886174bea1b3b79c45084f9241
5
5
  SHA512:
6
- metadata.gz: 9dbfa0722dab9e0bc5b50bc0f436cf7e5ae55c2c51732d44baaff615e667f61d86248d7f3075f3c0fd5e2bab3e483d3182386caadd90aaaba0dfccc1bfbd00f0
7
- data.tar.gz: 1410e3505211430225a98f0093a9dc1045e841b8b50a0820c2142cf38a8784206de90f1e72d7361f365a0a3f21e1330d129872e40709ea43fd48803a1161fbc3
6
+ metadata.gz: 4915a538cea2c6ee6ba35f44d4f35cad2377df0541c99a461e65867a5f51f3801c4995c01d41618dd8ae8850f19cea33845932e0ed718b8f870c43e81fcb85d1
7
+ data.tar.gz: '069bb50722079b73986c60d54f316a313b6fe3bae2f26531864ef949b06c76090c6a03ab447e310f4f5be0ab47ed2686b1e3ae9be9671f2dee60089381f227c7'
@@ -2,8 +2,8 @@ require 'benchmark'
2
2
 
3
3
  module Flutterby
4
4
  class Node
5
- attr_accessor :parent, :ext, :source, :body
6
- attr_reader :name, :filters, :fs_path, :children, :paths
5
+ attr_accessor :name, :ext, :source, :body
6
+ attr_reader :filters, :parent, :fs_path, :children, :paths
7
7
 
8
8
  def initialize(name, parent: nil, fs_path: nil, source: nil)
9
9
  @fs_path = fs_path ? ::File.expand_path(fs_path) : nil
@@ -17,8 +17,7 @@ module Flutterby
17
17
 
18
18
  # Register this node with its parent
19
19
  if parent
20
- @parent = parent
21
- parent.children << self
20
+ self.parent = parent
22
21
  end
23
22
 
24
23
  reload!
@@ -48,10 +47,20 @@ module Flutterby
48
47
  end
49
48
  end
50
49
 
50
+ def parent=(new_parent)
51
+ if @parent
52
+ @parent.children.delete(self)
53
+ end
54
+
55
+ @parent = new_parent
56
+
57
+ @parent.children << self
58
+ end
59
+
51
60
  # Returns all children that will compile to a HTML page.
52
61
  #
53
62
  def pages
54
- children.select { |c| c.ext == "html" }
63
+ children.select { |c| c.ext == "html" && c.should_publish? }
55
64
  end
56
65
 
57
66
  #
@@ -151,7 +160,7 @@ module Flutterby
151
160
  # available extensions loaded.
152
161
  #
153
162
  walk_tree do |node|
154
- node.load_extension! if node.should_publish?
163
+ node.load_extension! unless node.name == "_node"
155
164
  end
156
165
 
157
166
  # Now do another pass, prerendering stuff where necessary,
@@ -164,7 +173,7 @@ module Flutterby
164
173
  end
165
174
 
166
175
  def should_prerender?
167
- should_publish? && !folder? &&
176
+ !folder? &&
168
177
  (["json", "yaml", "rb"] & filters).any?
169
178
  end
170
179
 
@@ -318,5 +327,12 @@ module Flutterby
318
327
  def logger
319
328
  Flutterby.logger
320
329
  end
330
+
331
+ def copy(new_name)
332
+ dup.tap do |c|
333
+ c.name = new_name
334
+ parent.children << c
335
+ end
336
+ end
321
337
  end
322
338
  end
@@ -17,6 +17,7 @@ module Flutterby
17
17
 
18
18
  Flutterby.logger.info "Change detected, reloading everything!"
19
19
  @root.reload!
20
+ @root.preprocess!
20
21
  end
21
22
 
22
23
  # Set up server
@@ -1,3 +1,3 @@
1
1
  module Flutterby
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flutterby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Mans