awestructx 0.4.0 → 0.4.1.x1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/awestruct/astruct_mixin.rb +13 -3
- data/lib/awestruct/cli/auto.rb +18 -4
- data/lib/awestruct/cli/deploy.rb +38 -0
- data/lib/awestruct/cli/invoker.rb +12 -1
- data/lib/awestruct/config.rb +10 -0
- data/lib/awestruct/dependencies.rb +102 -0
- data/lib/awestruct/deploy/github_pages_deploy.rb +61 -0
- data/lib/awestruct/deploy/rsync_deploy.rb +51 -0
- data/lib/awestruct/deployers.rb +15 -0
- data/lib/awestruct/engine.rb +49 -13
- data/lib/awestruct/extensions/atomizer.rb +3 -3
- data/lib/awestruct/extensions/minify.rb +21 -23
- data/lib/awestruct/extensions/posts.rb +4 -4
- data/lib/awestruct/extensions/sitemap.rb +1 -0
- data/lib/awestruct/handler_chains.rb +15 -32
- data/lib/awestruct/handlers/asciidoc_handler.rb +57 -0
- data/lib/awestruct/handlers/base_handler.rb +23 -4
- data/lib/awestruct/handlers/coffeescript_handler.rb +48 -0
- data/lib/awestruct/handlers/erb_handler.rb +44 -0
- data/lib/awestruct/handlers/file_handler.rb +6 -3
- data/lib/awestruct/handlers/front_matter_handler.rb +5 -0
- data/lib/awestruct/handlers/haml_handler.rb +14 -2
- data/lib/awestruct/handlers/layout_handler.rb +4 -2
- data/lib/awestruct/handlers/markdown_handler.rb +14 -0
- data/lib/awestruct/handlers/orgmode_handler.rb +48 -0
- data/lib/awestruct/handlers/page_delegating_handler.rb +54 -0
- data/lib/awestruct/handlers/restructuredtext_handler.rb +67 -0
- data/lib/awestruct/handlers/sass_handler.rb +7 -0
- data/lib/awestruct/handlers/scss_handler.rb +7 -0
- data/lib/awestruct/handlers/textile_handler.rb +15 -0
- data/lib/awestruct/layouts.rb +1 -0
- data/lib/awestruct/page.rb +27 -14
- data/lib/awestruct/page_loader.rb +15 -5
- data/lib/awestruct/pipeline.rb +7 -0
- data/lib/awestruct/version.rb +1 -1
- data/lib/guard/awestruct.rb +1 -1
- metadata +173 -267
data/lib/awestruct/page.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'awestruct/context'
|
3
3
|
|
4
4
|
require 'awestruct/handlers/no_op_handler'
|
5
|
+
require 'awestruct/handlers/page_delegating_handler'
|
5
6
|
require 'hashery/open_cascade'
|
6
7
|
require 'ostruct'
|
7
8
|
require 'awestruct/astruct'
|
@@ -12,13 +13,19 @@ module Awestruct
|
|
12
13
|
|
13
14
|
attr_accessor :site
|
14
15
|
attr_accessor :handler
|
15
|
-
|
16
|
-
attr_reader :dependencies
|
16
|
+
attr_reader :dependencies
|
17
17
|
|
18
18
|
def initialize(site, handler=nil)
|
19
19
|
@site = site
|
20
|
-
|
21
|
-
|
20
|
+
case (handler)
|
21
|
+
when Page
|
22
|
+
@handler = Awestruct::Handlers::LayoutHandler.new( site, Awestruct::Handlers::PageDelegatingHandler.new( site, handler ) )
|
23
|
+
when nil
|
24
|
+
@handler = Awestruct::Handlers::NoOpHandler.new( site )
|
25
|
+
else
|
26
|
+
@handler = handler
|
27
|
+
end
|
28
|
+
@dependencies = Awestruct::Dependencies.new( self )
|
22
29
|
end
|
23
30
|
|
24
31
|
def prepare!
|
@@ -59,25 +66,24 @@ module Awestruct
|
|
59
66
|
(@output_path || handler.output_path).to_s
|
60
67
|
end
|
61
68
|
|
62
|
-
def output_extension
|
63
|
-
handler.output_extension
|
64
|
-
end
|
65
|
-
|
66
69
|
def output_path=(path)
|
67
70
|
case ( path )
|
68
|
-
when Pathname
|
69
|
-
|
70
|
-
else
|
71
|
-
@output_path = Pathname.new( path )
|
71
|
+
when Pathname then @output_path = path
|
72
|
+
else @output_path = Pathname.new( path )
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
76
|
+
def output_extension
|
77
|
+
handler.output_extension
|
78
|
+
end
|
79
|
+
|
80
|
+
|
75
81
|
def source_path
|
76
82
|
handler.path.to_s
|
77
83
|
end
|
78
84
|
|
79
85
|
def stale?
|
80
|
-
handler.stale? || @dependencies.any?(&:stale?)
|
86
|
+
handler.stale? || @dependencies.dependencies.any?(&:stale?)
|
81
87
|
end
|
82
88
|
|
83
89
|
def stale_output?(output_path)
|
@@ -102,6 +108,10 @@ module Awestruct
|
|
102
108
|
t
|
103
109
|
end
|
104
110
|
|
111
|
+
def all_dependencies
|
112
|
+
@dependencies + handler.dependencies
|
113
|
+
end
|
114
|
+
|
105
115
|
def content_syntax
|
106
116
|
handler.content_syntax
|
107
117
|
end
|
@@ -111,7 +121,10 @@ module Awestruct
|
|
111
121
|
end
|
112
122
|
|
113
123
|
def rendered_content(context=create_context(), with_layouts=true)
|
114
|
-
|
124
|
+
Awestruct::Dependencies.push_page( self ) if context.site.config.track_dependencies
|
125
|
+
c = handler.rendered_content( context, with_layouts )
|
126
|
+
Awestruct::Dependencies.pop_page if context.site.config.track_dependencies
|
127
|
+
site.engine.pipeline.apply_transformers( site, self, c )
|
115
128
|
end
|
116
129
|
|
117
130
|
def content(with_layouts=false)
|
@@ -24,23 +24,27 @@ module Awestruct
|
|
24
24
|
pages = []
|
25
25
|
root_dir.find do |path|
|
26
26
|
if ( path == root_dir )
|
27
|
+
#puts "skip #{path}"
|
27
28
|
next
|
28
29
|
end
|
29
30
|
basename = File.basename( path )
|
30
31
|
if ( basename == '.htaccess' )
|
31
32
|
#special case
|
32
33
|
elsif ( basename =~ /^[_.]/ )
|
34
|
+
#puts "skip #{path} and prune"
|
33
35
|
Find.prune
|
34
36
|
next
|
35
37
|
end
|
36
38
|
relative_path = path.relative_path_from( root_dir ).to_s
|
37
39
|
if ignore?(relative_path)
|
40
|
+
#puts "skip ignored #{path} and prune"
|
38
41
|
Find.prune
|
39
42
|
next
|
40
43
|
end
|
41
44
|
unless path.directory?
|
42
45
|
page = load_page( path, prepare )
|
43
46
|
if ( page )
|
47
|
+
#puts "loaded! #{path} and added to site"
|
44
48
|
#inherit_front_matter( page )
|
45
49
|
site.send( @target ) << page
|
46
50
|
pages << page
|
@@ -54,16 +58,22 @@ module Awestruct
|
|
54
58
|
|
55
59
|
def load_page(path,prepare=:inline)
|
56
60
|
pathname = case( path )
|
57
|
-
when Pathname
|
58
|
-
|
59
|
-
else
|
60
|
-
pathname = Pathname.new( path )
|
61
|
+
when Pathname then pathname = path
|
62
|
+
else pathname = Pathname.new( path )
|
61
63
|
end
|
62
64
|
chain = site.engine.pipeline.handler_chains[ path ]
|
63
65
|
return nil if chain.nil?
|
64
66
|
handler = chain.create(site, Pathname.new(path))
|
65
67
|
p = Page.new( site, handler )
|
66
|
-
|
68
|
+
if ( @target == :layouts )
|
69
|
+
p.__is_layout = true
|
70
|
+
else
|
71
|
+
p.__is_layout = false
|
72
|
+
end
|
73
|
+
p.track_dependencies!
|
74
|
+
if prepare == :inline
|
75
|
+
p.prepare!
|
76
|
+
end
|
67
77
|
p
|
68
78
|
end
|
69
79
|
|
data/lib/awestruct/pipeline.rb
CHANGED
@@ -37,6 +37,13 @@ module Awestruct
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def apply_transformers(site, page, rendered)
|
41
|
+
@transformers.each do |t|
|
42
|
+
rendered = t.transform( site, page, rendered )
|
43
|
+
end
|
44
|
+
rendered
|
45
|
+
end
|
46
|
+
|
40
47
|
def mixin_helpers(context)
|
41
48
|
context.extend( Awestruct::ContextHelper )
|
42
49
|
@helpers.each do |h|
|
data/lib/awestruct/version.rb
CHANGED
data/lib/guard/awestruct.rb
CHANGED