flutterby 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flutterby/node.rb +23 -7
- data/lib/flutterby/server.rb +1 -0
- data/lib/flutterby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78586bd3d1eedcc69f7930f0085e70a1fab7ca8d
|
4
|
+
data.tar.gz: d237d120d8ff04886174bea1b3b79c45084f9241
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4915a538cea2c6ee6ba35f44d4f35cad2377df0541c99a461e65867a5f51f3801c4995c01d41618dd8ae8850f19cea33845932e0ed718b8f870c43e81fcb85d1
|
7
|
+
data.tar.gz: '069bb50722079b73986c60d54f316a313b6fe3bae2f26531864ef949b06c76090c6a03ab447e310f4f5be0ab47ed2686b1e3ae9be9671f2dee60089381f227c7'
|
data/lib/flutterby/node.rb
CHANGED
@@ -2,8 +2,8 @@ require 'benchmark'
|
|
2
2
|
|
3
3
|
module Flutterby
|
4
4
|
class Node
|
5
|
-
attr_accessor :
|
6
|
-
attr_reader :
|
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
|
-
|
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!
|
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
|
-
|
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
|
data/lib/flutterby/server.rb
CHANGED
data/lib/flutterby/version.rb
CHANGED