flora 0.6.1 → 0.6.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/lib/flora/blueprint/page.rb +5 -5
- data/lib/flora/blueprint.rb +2 -2
- data/lib/flora/factory.rb +2 -1
- data/lib/flora/plugins/blog.rb +10 -1
- data/lib/flora/version.rb +1 -1
- data/lib/flora.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84a83e09611588abf3ede492aa734a168aa8d611eb7b33e503243df4bbe13d89
|
|
4
|
+
data.tar.gz: 5aeb14cbae18ad40c725c8fcf88c814daf150a48491ff3594708b843cb80f200
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14084b4863fe3223d99ac2da8f3b1281ad6649f23501f150a13b73add8b451112a8f15607734b2750dd872214e40f579c51e46bf7aff2ba22f91a11e1db24c77
|
|
7
|
+
data.tar.gz: 155da839cd37104784aea6da12760c8d342b6d25c8b4eda9f6dfb2a5d192a76f9e29c0dd4f5c8f6470ee9ba3eb8bdccd9f16189a3f20e5a9bf74ca90aa5649a2
|
data/lib/flora/blueprint/page.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# A page is something can be turned into HTML.
|
|
1
|
+
# A page is something can be turned into an HTML file.
|
|
2
2
|
class Flora::Blueprint::Page
|
|
3
3
|
|
|
4
|
-
attr_reader(:
|
|
4
|
+
attr_reader(:file)
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def self.for(file)
|
|
@@ -16,10 +16,10 @@ class Flora::Blueprint::Page
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
def initialize(
|
|
20
|
-
@blueprint = blueprint
|
|
19
|
+
def initialize(file, blueprint)
|
|
21
20
|
@file = file
|
|
22
|
-
@
|
|
21
|
+
@blueprint = blueprint
|
|
22
|
+
|
|
23
23
|
@layout = find_layouts
|
|
24
24
|
end
|
|
25
25
|
|
data/lib/flora/blueprint.rb
CHANGED
|
@@ -42,8 +42,7 @@ class Flora::Blueprint
|
|
|
42
42
|
next if file.directory?
|
|
43
43
|
next unless supported_file_type?(file)
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
page = Page.for(file).new(self, file, route)
|
|
45
|
+
page = Page.for(file).new(file, self)
|
|
47
46
|
@page_modules.each { |mod| page.extend(mod) }
|
|
48
47
|
pages << page
|
|
49
48
|
end
|
|
@@ -52,6 +51,7 @@ class Flora::Blueprint
|
|
|
52
51
|
end
|
|
53
52
|
|
|
54
53
|
|
|
54
|
+
# TODO: this is duplicating logic from Page::for.
|
|
55
55
|
def supported_file_type?(file)
|
|
56
56
|
file.extname == '.rb' || file.extname == '.md'
|
|
57
57
|
end
|
data/lib/flora/factory.rb
CHANGED
|
@@ -11,7 +11,8 @@ class Flora::Factory
|
|
|
11
11
|
out_dir.mkdir unless out_dir.exist?
|
|
12
12
|
|
|
13
13
|
@blueprint.each_page do |page|
|
|
14
|
-
|
|
14
|
+
relative_path = page.file.relative_path_from(@blueprint.dir)
|
|
15
|
+
out_filename = out_dir.join(relative_path).sub_ext('.html')
|
|
15
16
|
out_filename.dirname.mkdir unless out_filename.dirname.exist?
|
|
16
17
|
out_filename.write(page.render)
|
|
17
18
|
end
|
data/lib/flora/plugins/blog.rb
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
module Flora::Plugins::Blog
|
|
2
2
|
|
|
3
|
+
module BlueprintMethods
|
|
4
|
+
|
|
5
|
+
def posts
|
|
6
|
+
@dir.glob('posts/**').map { Post.new(it, @dir) }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
|
|
3
12
|
module PageMethods
|
|
4
13
|
|
|
5
14
|
def posts
|
|
6
|
-
@blueprint.
|
|
15
|
+
@blueprint.posts
|
|
7
16
|
end
|
|
8
17
|
|
|
9
18
|
end
|
data/lib/flora/version.rb
CHANGED
data/lib/flora.rb
CHANGED
|
@@ -20,13 +20,14 @@ class Flora
|
|
|
20
20
|
# with other instances of Flora in the same process. This is mostly for the
|
|
21
21
|
# unit tests. Maybe one day we can use Ruby::Box or something here instead.
|
|
22
22
|
@config_class = Class.new(Config)
|
|
23
|
+
@blueprint_class = Class.new(Blueprint)
|
|
23
24
|
@factory_class = Class.new(Factory)
|
|
24
25
|
|
|
25
26
|
# Page plugins get mixed in directly to the page instances by Blueprint.
|
|
26
27
|
@page_modules = []
|
|
27
28
|
|
|
28
29
|
@config = @config_class.new(dir.join('_config.rb'), self)
|
|
29
|
-
@blueprint =
|
|
30
|
+
@blueprint = @blueprint_class.new(dir, @config, @page_modules)
|
|
30
31
|
@factory = @factory_class.new(@blueprint, @config)
|
|
31
32
|
end
|
|
32
33
|
|
|
@@ -43,8 +44,9 @@ class Flora
|
|
|
43
44
|
|
|
44
45
|
# TODO: it would be nice if this wasn't exposed here. It's just for Config#plugin.
|
|
45
46
|
def load_plugin(mod)
|
|
46
|
-
@factory_class.include(mod::FactoryMethods) if defined?(mod::FactoryMethods)
|
|
47
47
|
@config_class.include(mod::Config) if defined?(mod::Config)
|
|
48
|
+
@blueprint_class.include(mod::BlueprintMethods) if defined?(mod::BlueprintMethods)
|
|
49
|
+
@factory_class.include(mod::FactoryMethods) if defined?(mod::FactoryMethods)
|
|
48
50
|
|
|
49
51
|
@page_modules << mod::PageMethods if defined?(mod::PageMethods)
|
|
50
52
|
end
|