flutterby 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/lib/flutterby.rb +0 -12
- data/lib/flutterby/cli.rb +4 -2
- data/lib/flutterby/filters.rb +23 -23
- data/lib/flutterby/node.rb +5 -7
- data/lib/flutterby/version.rb +1 -1
- data/lib/flutterby/view.rb +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8ec47d6e879ee1b0b7bc5d36b512d676fabc12c
|
4
|
+
data.tar.gz: 63ba7c9c302c8819b928792fb688b919fda9ed6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5887dcc9beb924087c15df334529cb9661c43765236f3dcb40e449ef2911d2e703ce67e5a8d639373a3c214d7a868f57be1402c784d3b2db24f03630aeb62a19
|
7
|
+
data.tar.gz: a7f3da8b6b221501271352a7ed9cc1ab18583c68c6dc404349c64fe9b0cb65808e595ba795e9b3b1dc565e42bd5bf0043c0b38388800bc84c799c46421aff007
|
data/.travis.yml
CHANGED
data/lib/flutterby.rb
CHANGED
@@ -17,18 +17,6 @@ module Flutterby
|
|
17
17
|
|
18
18
|
attr_writer :logger
|
19
19
|
|
20
|
-
def from(fs_path, name: nil, parent: nil)
|
21
|
-
name ||= ::File.basename(fs_path)
|
22
|
-
|
23
|
-
if ::File.exist?(fs_path)
|
24
|
-
Node.new(name, fs_path: fs_path, parent: parent).tap do |node|
|
25
|
-
node.preprocess!
|
26
|
-
end
|
27
|
-
else
|
28
|
-
raise "Path #{fs_path} could not be found."
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
20
|
def logger
|
33
21
|
@logger ||= Logger.new(STDOUT)
|
34
22
|
end
|
data/lib/flutterby/cli.rb
CHANGED
@@ -30,7 +30,8 @@ Commander.configure do
|
|
30
30
|
time = Benchmark.realtime do
|
31
31
|
# Import site
|
32
32
|
say color("📚 Importing site...", :bold)
|
33
|
-
root = Flutterby.
|
33
|
+
root = Flutterby::Node.new("/", fs_path: options.in)
|
34
|
+
root.preprocess!
|
34
35
|
say color("🌲 Read #{root.tree_size} nodes.", :green, :bold)
|
35
36
|
|
36
37
|
# Export site
|
@@ -54,7 +55,8 @@ Commander.configure do
|
|
54
55
|
options.default in: "./site/", port: 4004
|
55
56
|
|
56
57
|
say color("📚 Importing site...", :bold)
|
57
|
-
root = Flutterby.
|
58
|
+
root = Flutterby::Node.new("/", fs_path: options.in)
|
59
|
+
root.preprocess!
|
58
60
|
say color("🌲 Read #{root.tree_size} nodes.", :green, :bold)
|
59
61
|
|
60
62
|
say color("🌤 Serving your site on port #{options.port}. Enjoy!", :bold)
|
data/lib/flutterby/filters.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Flutterby
|
2
2
|
module Filters
|
3
|
-
def apply!(node)
|
3
|
+
def self.apply!(node)
|
4
4
|
node.body = node.source
|
5
5
|
|
6
6
|
# Apply all filters
|
@@ -13,34 +13,34 @@ module Flutterby
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
node.extend(mod)
|
21
|
-
node.filter! if node.respond_to?(:filter!)
|
16
|
+
def self.add(fmts, &blk)
|
17
|
+
Array(fmts).each do |fmt|
|
18
|
+
define_singleton_method("process_#{fmt}!", &blk)
|
19
|
+
end
|
22
20
|
end
|
23
21
|
|
24
|
-
def
|
25
|
-
|
22
|
+
def self.tilt(format, body)
|
23
|
+
Tilt[format].new { body }
|
26
24
|
end
|
25
|
+
end
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
Flutterby::Filters.add("rb") do |node|
|
29
|
+
node.instance_eval(node.body)
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
Flutterby::Filters.add("erb") do |node|
|
33
|
+
node.body = tilt("erb", node.body).render(node.view)
|
34
|
+
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
Flutterby::Filters.add("slim") do |node|
|
37
|
+
node.body = tilt("slim", node.body).render(node.view)
|
38
|
+
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
Flutterby::Filters.add(["md", "markdown"]) do |node|
|
41
|
+
node.body = Slodown::Formatter.new(node.body).complete.to_s
|
42
|
+
end
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
Flutterby::Filters.add("scss") do |node|
|
45
|
+
node.body = Sass::Engine.new(node.body, syntax: :scss).render
|
46
46
|
end
|
data/lib/flutterby/node.rb
CHANGED
@@ -27,8 +27,8 @@ module Flutterby
|
|
27
27
|
# Children
|
28
28
|
#
|
29
29
|
|
30
|
-
def
|
31
|
-
if file?
|
30
|
+
def register_url!
|
31
|
+
if file? && should_publish?
|
32
32
|
root.paths[url] = self
|
33
33
|
end
|
34
34
|
end
|
@@ -168,7 +168,7 @@ module Flutterby
|
|
168
168
|
#
|
169
169
|
walk_tree do |node|
|
170
170
|
node.render_body! if node.should_prerender?
|
171
|
-
node.
|
171
|
+
node.register_url! if node.should_publish?
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
@@ -195,7 +195,7 @@ module Flutterby
|
|
195
195
|
|
196
196
|
# Extract date from name
|
197
197
|
if name =~ %r{^(\d\d\d\d\-\d\d?\-\d\d?)\-}
|
198
|
-
@data['date'] =
|
198
|
+
@data['date'] = Date.parse($1)
|
199
199
|
end
|
200
200
|
|
201
201
|
# Read remaining data from frontmatter. Data in frontmatter
|
@@ -209,9 +209,7 @@ module Flutterby
|
|
209
209
|
|
210
210
|
def load_extension!
|
211
211
|
if extension = sibling("_node.rb")
|
212
|
-
|
213
|
-
mod.class_eval(extension.body)
|
214
|
-
extend mod
|
212
|
+
instance_eval(extension.body)
|
215
213
|
end
|
216
214
|
end
|
217
215
|
|
data/lib/flutterby/version.rb
CHANGED
data/lib/flutterby/view.rb
CHANGED
@@ -29,9 +29,7 @@ module Flutterby
|
|
29
29
|
if view_node = e.sibling("_view.rb")
|
30
30
|
case view_node.ext
|
31
31
|
when "rb" then
|
32
|
-
|
33
|
-
mod.class_eval(view_node.source)
|
34
|
-
view.extend mod
|
32
|
+
view.instance_eval(view_node.source)
|
35
33
|
else
|
36
34
|
raise "Unknown view extension #{view_node.full_name}"
|
37
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flutterby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hendrik Mans
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|