awestruct 0.5.7 → 0.6.0.RC1
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/Gemfile +3 -0
- data/LICENSE.txt +14 -11
- data/README.md +13 -4
- data/awestruct.gemspec +19 -20
- data/lib/awestruct/cli/invoker.rb +4 -2
- data/lib/awestruct/cli/manifest.rb +1 -2
- data/lib/awestruct/cli/options.rb +2 -1
- data/lib/awestruct/config.rb +5 -0
- data/lib/awestruct/config/default-site.yml +1 -2
- data/lib/awestruct/context_helper.rb +2 -2
- data/lib/awestruct/engine.rb +43 -41
- data/lib/awestruct/extensions/partial.rb +14 -12
- data/lib/awestruct/extensions/posts.rb +2 -2
- data/lib/awestruct/extensions/sitemap.rb +2 -2
- data/lib/awestruct/handlers/base_handler.rb +4 -2
- data/lib/awestruct/handlers/base_tilt_handler.rb +3 -4
- data/lib/awestruct/handlers/file_handler.rb +4 -1
- data/lib/awestruct/handlers/javascript_handler.rb +2 -2
- data/lib/awestruct/handlers/redirect_handler.rb +1 -1
- data/lib/awestruct/handlers/template/asciidoc.rb +4 -1
- data/lib/awestruct/page_loader.rb +5 -5
- data/lib/awestruct/pipeline.rb +5 -5
- data/lib/awestruct/version.rb +1 -1
- data/spec/awestruct/engine_spec.rb +29 -1
- data/spec/awestruct/handlers/haml_handler_spec.rb +2 -2
- data/spec/awestruct/handlers/page_delegating_handler_spec.rb +5 -11
- data/spec/awestruct/handlers/tilt_handler_spec.rb +1 -0
- data/spec/support/test-data/engine-generate-syntax-errors/_config/site.yml +26 -0
- data/spec/support/test-data/engine-generate-syntax-errors/_ext/pipeline.rb +8 -0
- data/spec/support/test-data/engine-generate-syntax-errors/_layouts/base.html.slim +6 -0
- data/spec/support/test-data/engine-generate-syntax-errors/index.html.slim +7 -0
- metadata +40 -73
- data/lib/awestruct/compass/default_configuration.rb +0 -131
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0399037b69ee735bc1afbad093fdc95faa02c153'
|
4
|
+
data.tar.gz: 5bd7ff867e171dd6d96ff218438a5ef0e5b66f53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab3587a8d9d0bf6d8c129476e2ae598452e5952ba0bea7dfabd603fcd8732974da8db6742864d6fa167bd339d7db73a642b01cf4b23fb5a2d0283d32feae2c12
|
7
|
+
data.tar.gz: 9bd1ab9df76ea3c7fb2feb6ef1b4822fa2c19c2f3b52544dc0fbdbf72ad94a6b4eadeba6d482f533868adfcd3c4714473eabed9db0ee328c0f0fc8d32048cbd0
|
data/Gemfile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
+
ruby '>= 2.4.0'
|
2
3
|
|
3
4
|
group :development do
|
4
5
|
gem 'hashery', '~> 2.1.1'
|
@@ -29,6 +30,8 @@ group :test do
|
|
29
30
|
gem 'sass'
|
30
31
|
gem 'bootstrap-sass'
|
31
32
|
gem 'zurb-foundation'
|
33
|
+
gem 'rspec'
|
34
|
+
gem 'rspec_runner'
|
32
35
|
gem "win32-open3-19", :platforms => :mingw # htmlcompressor depends on old yui compressor, that needs this on win32
|
33
36
|
end
|
34
37
|
|
data/LICENSE.txt
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010-2019 Bob McWhirter and contributors (see git log)
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
10
|
furnished to do so, subject to the following conditions:
|
9
11
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
12
14
|
|
13
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
-
|
17
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,12 +1,21 @@
|
|
1
|
-
|
1
|
+
# Awestruct
|
2
|
+
[](https://rubygems.org/gems/awestruct)
|
3
|
+
[](https://rubygems.org/gems/awestruct)
|
4
|
+
[](https://travis-ci.org/awestruct/awestruct)
|
2
5
|
|
3
|
-
|
6
|
+
## Requirements
|
4
7
|
|
5
|
-
|
8
|
+
Ruby 2.4 or later
|
9
|
+
|
10
|
+
## Getting started
|
11
|
+
|
12
|
+
Install Awestruct using `gem install awestruct`. Then you can initialize an Awestruct projet by running `awestruct --init`. To generate the static site use `awestruct generate`.
|
13
|
+
|
14
|
+
## For more information
|
6
15
|
|
7
16
|
Please see the complete site at <http://awestruct.org/>.
|
8
17
|
|
9
|
-
|
18
|
+
## License
|
10
19
|
|
11
20
|
Copyright (c) 2010-2014 Bob McWhirter and contributors (see git log)
|
12
21
|
|
data/awestruct.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'awestruct/version'
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
s.name = 'awestruct'
|
6
6
|
s.version = Awestruct::VERSION
|
7
|
-
s.date = '
|
7
|
+
s.date = '2020-01-21'
|
8
8
|
|
9
9
|
s.authors = ['Bob McWhirter', 'Jason Porter', 'Lance Ball', 'Dan Allen', 'Torsten Curdt', 'other contributors']
|
10
10
|
s.email = ['bob@mcwhirter.org', 'lightguard.jp@gmail.com', 'lball@redhat.com', 'dan.j.allen@gmail.com', 'tcurdt@vafer.org']
|
@@ -17,13 +17,13 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.license = 'MIT'
|
18
18
|
|
19
19
|
s.platform = Gem::Platform::RUBY
|
20
|
-
s.required_ruby_version = '>= 2.0'
|
20
|
+
s.required_ruby_version = '>= 2.4.0'
|
21
21
|
|
22
22
|
s.has_rdoc = true
|
23
23
|
s.rdoc_options = ['--charset=UTF-8']
|
24
24
|
s.extra_rdoc_files = 'README.md'
|
25
25
|
|
26
|
-
s.files = `git ls-files -z --
|
26
|
+
s.files = `git ls-files -z -- lib/* man/* spec/* README* LICENSE* *.gemspec *file`.split("\0")
|
27
27
|
s.test_files = s.files.select { |path| path =~ /^spec\/.*_spec\.rb/ }
|
28
28
|
s.executables = `git ls-files -z -- bin/*`.split("\0").map {|f| File.basename f }
|
29
29
|
s.require_paths = ['lib']
|
@@ -34,25 +34,24 @@ Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if
|
|
34
34
|
Compass and sass are no longer hard dependencies. You'll need too add them on your own should you want them. We also should be able to work with sassc.
|
35
35
|
EOS
|
36
36
|
|
37
|
-
s.add_dependency 'haml', '
|
37
|
+
s.add_dependency 'haml', '>= 4.0.5', '< 6.0'
|
38
38
|
s.add_dependency 'asciidoctor', '~> 1.5', '>= 1.5.2'
|
39
39
|
s.add_dependency 'tilt', '~> 2.0', '>= 2.0.1'
|
40
|
-
s.add_dependency 'mime-types', '~>
|
41
|
-
s.add_dependency 'rest-client', '~>
|
42
|
-
s.add_dependency 'listen', '
|
43
|
-
s.add_dependency 'rack', '~>
|
40
|
+
s.add_dependency 'mime-types', '~> 3.0'
|
41
|
+
s.add_dependency 'rest-client', '~> 2.0'
|
42
|
+
s.add_dependency 'listen', '~> 3.1'
|
43
|
+
s.add_dependency 'rack', '~> 2.0'
|
44
44
|
s.add_dependency 'git', '~> 1.2', '>= 1.2.6'
|
45
|
-
s.add_dependency 'guard', '~> 2.
|
46
|
-
s.add_dependency 'guard-livereload', '~> 2.
|
47
|
-
|
48
|
-
s.add_dependency '
|
49
|
-
s.add_dependency '
|
50
|
-
|
51
|
-
|
52
|
-
s.add_development_dependency 'nokogiri', '~> 1.5.0','>= 1.5.10'
|
45
|
+
s.add_dependency 'guard', '~> 2.0', '>= 2.13.0'
|
46
|
+
s.add_dependency 'guard-livereload', '~> 2.0', '>= 2.1.2'
|
47
|
+
s.add_dependency 'logging', '~> 2.2'
|
48
|
+
s.add_dependency 'oga', '~> 2.0'
|
49
|
+
s.add_dependency 'parallel', '~> 1.0', '> 1.1.1'
|
50
|
+
|
51
|
+
s.add_development_dependency 'nokogiri', '>= 1.5.10'
|
53
52
|
s.add_development_dependency 'compass-960-plugin', '~> 0.10','>= 0.10.4'
|
54
|
-
s.add_development_dependency 'bootstrap-sass', '
|
55
|
-
s.add_development_dependency 'zurb-foundation', '
|
56
|
-
s.add_development_dependency 'rspec', '
|
57
|
-
s.add_development_dependency 'guard-rspec', '
|
53
|
+
s.add_development_dependency 'bootstrap-sass', '>= 3.2.0.2'
|
54
|
+
s.add_development_dependency 'zurb-foundation', '>= 4.3.2'
|
55
|
+
s.add_development_dependency 'rspec', '>= 3.0'
|
56
|
+
s.add_development_dependency 'guard-rspec', '>= 4.0'
|
58
57
|
end
|
@@ -97,7 +97,7 @@ module Awestruct
|
|
97
97
|
abort( "No config file at #{site_yaml_file}" )
|
98
98
|
end
|
99
99
|
|
100
|
-
site_yaml = YAML.load( ERB.new(File.read( site_yaml_file )).result )
|
100
|
+
site_yaml = YAML.load( ERB.new(File.read( site_yaml_file ), nil, '<>').result )
|
101
101
|
|
102
102
|
if ( !site_yaml )
|
103
103
|
abort( "Failed to parse #{site_yaml_file}" )
|
@@ -130,7 +130,9 @@ module Awestruct
|
|
130
130
|
@config = Awestruct::Config.new( @options )
|
131
131
|
@config.track_dependencies = true if ( @options.auto )
|
132
132
|
@config.verbose = true if ( @options.verbose )
|
133
|
-
@config.
|
133
|
+
@config.debug = @options.debug
|
134
|
+
@config.quiet = true if @options.quiet
|
135
|
+
@config.perf = true if @options.perf_log
|
134
136
|
end
|
135
137
|
|
136
138
|
def invoke_init()
|
@@ -77,8 +77,7 @@ module Awestruct
|
|
77
77
|
|
78
78
|
def load_gem(add_compass = false)
|
79
79
|
spec = {:dependencies => {}}
|
80
|
-
gem_spec = Gem::Specification
|
81
|
-
File.join(File.dirname(__FILE__), "../../../", "awestruct.gemspec"))
|
80
|
+
gem_spec = Gem::Specification.find_all_by_name('awestruct').last # Make sure we have the latest version
|
82
81
|
|
83
82
|
if add_compass
|
84
83
|
gem_spec.add_dependency('compass', '>= 1.0.1')
|
@@ -36,7 +36,7 @@ module Awestruct
|
|
36
36
|
def initialize(opts = {})
|
37
37
|
default_opts = { server: false, port: DEFAULT_PORT, bind_addr: DEFAULT_BIND_ADDR, auto: false, force: false,
|
38
38
|
init: false, framework: 'compass', scaffold: true, base_url: DEFAULT_BASE_URL, deploy: false,
|
39
|
-
verbose: false, quiet: false, livereload: false, source_dir: Dir.pwd,
|
39
|
+
verbose: false, quiet: false, livereload: false, source_dir: Dir.pwd, debug: false,
|
40
40
|
output_dir: File.expand_path('_site'), generate_on_access: DEFAULT_GENERATE_ON_ACCESS,
|
41
41
|
perf_log: false
|
42
42
|
}.merge opts
|
@@ -60,6 +60,7 @@ module Awestruct
|
|
60
60
|
@output_dir = default_opts[:output_dir]
|
61
61
|
@generate_on_access = default_opts[:generate_on_access]
|
62
62
|
@perf_log = default_opts[:perf_log]
|
63
|
+
@debug = default_opts[:debug]
|
63
64
|
end
|
64
65
|
|
65
66
|
def self.parse!(args)
|
data/lib/awestruct/config.rb
CHANGED
@@ -21,6 +21,8 @@ module Awestruct
|
|
21
21
|
attr_accessor :verbose
|
22
22
|
attr_accessor :quiet
|
23
23
|
attr_accessor :options
|
24
|
+
attr_accessor :debug
|
25
|
+
attr_accessor :perf
|
24
26
|
|
25
27
|
def initialize(opts = Awestruct::CLI::Options.new)
|
26
28
|
@dir = Pathname.new(File.expand_path(Pathname.new( opts.source_dir )))
|
@@ -35,6 +37,9 @@ module Awestruct
|
|
35
37
|
@stylesheets_dir = Pathname.new( File.join(@dir, 'stylesheets') )
|
36
38
|
|
37
39
|
@options = opts
|
40
|
+
@verbose = opts.verbose
|
41
|
+
@debug = opts.debug
|
42
|
+
@perf = opts.perf_log
|
38
43
|
|
39
44
|
# Dir[] doesn't like empty list
|
40
45
|
ignore_file = File.join(@dir, ".awestruct_ignore")
|
@@ -40,10 +40,10 @@ module Awestruct
|
|
40
40
|
|
41
41
|
def fully_qualify_urls(base_url, text)
|
42
42
|
begin
|
43
|
-
doc = Oga.
|
43
|
+
doc = Oga.parse_xml text
|
44
44
|
|
45
45
|
doc.each_node do |elem|
|
46
|
-
if elem.is_a?(Oga::XML::Element)
|
46
|
+
if elem.is_a?(Oga::XML::Element)
|
47
47
|
case elem.name
|
48
48
|
when 'a'
|
49
49
|
elem.set 'href', fix_url(base_url, elem.get('href')) if elem.get('href')
|
data/lib/awestruct/engine.rb
CHANGED
@@ -54,72 +54,72 @@ module Awestruct
|
|
54
54
|
|
55
55
|
def run(profile, base_url, default_base_url, force=false, generate=true)
|
56
56
|
start_time = DateTime.now
|
57
|
-
$LOG.verbose 'adjust_load_path'
|
57
|
+
$LOG.verbose 'adjust_load_path' if config.verbose
|
58
58
|
adjust_load_path
|
59
|
-
$LOG.trace "Total time in adjust_load_path: #{DateTime.now.to_time - start_time.to_time} seconds"
|
59
|
+
$LOG.trace "Total time in adjust_load_path: #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
60
60
|
|
61
|
-
$LOG.verbose 'load_default_site_yaml'
|
61
|
+
$LOG.verbose 'load_default_site_yaml' if config.verbose
|
62
62
|
start_time = DateTime.now
|
63
63
|
load_default_site_yaml( profile )
|
64
|
-
$LOG.trace "Total time in load_default_site_yaml #{DateTime.now.to_time - start_time.to_time} seconds"
|
64
|
+
$LOG.trace "Total time in load_default_site_yaml #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
65
65
|
|
66
|
-
$LOG.verbose 'load_user_site_yaml -- profile'
|
66
|
+
$LOG.verbose 'load_user_site_yaml -- profile' if config.verbose
|
67
67
|
start_time = DateTime.now
|
68
68
|
load_user_site_yaml( profile )
|
69
|
-
$LOG.trace "Total time in load_user_site_yaml #{DateTime.now.to_time - start_time.to_time} seconds"
|
69
|
+
$LOG.trace "Total time in load_user_site_yaml #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
70
70
|
|
71
|
-
$LOG.verbose 'set_base_url'
|
71
|
+
$LOG.verbose 'set_base_url' if config.verbose
|
72
72
|
start_time = DateTime.now
|
73
73
|
set_base_url( base_url, default_base_url )
|
74
|
-
$LOG.trace "Total time in set_base_url #{DateTime.now.to_time - start_time.to_time} seconds"
|
74
|
+
$LOG.trace "Total time in set_base_url #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
75
75
|
|
76
|
-
$LOG.verbose 'load_yamls'
|
76
|
+
$LOG.verbose 'load_yamls' if config.verbose
|
77
77
|
start_time = DateTime.now
|
78
78
|
load_yamls
|
79
|
-
$LOG.trace "Total time in load_yamls #{DateTime.now.to_time - start_time.to_time} seconds"
|
79
|
+
$LOG.trace "Total time in load_yamls #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
80
80
|
|
81
|
-
$LOG.verbose 'load_pipeline'
|
81
|
+
$LOG.verbose 'load_pipeline' if config.verbose
|
82
82
|
start_time = DateTime.now
|
83
83
|
load_pipeline
|
84
|
-
$LOG.trace "Total time in load_pipeline #{DateTime.now.to_time - start_time.to_time} seconds"
|
84
|
+
$LOG.trace "Total time in load_pipeline #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
85
85
|
|
86
|
-
$LOG.verbose 'load_pages'
|
86
|
+
$LOG.verbose 'load_pages' if config.verbose
|
87
87
|
start_time = DateTime.now
|
88
88
|
load_pages
|
89
|
-
$LOG.trace "Total time in load_pages #{DateTime.now.to_time - start_time.to_time} seconds"
|
89
|
+
$LOG.trace "Total time in load_pages #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
90
90
|
|
91
|
-
$LOG.verbose 'execute_pipeline'
|
92
|
-
$LOG.info '
|
91
|
+
$LOG.verbose 'execute_pipeline' if config.verbose
|
92
|
+
$LOG.info 'Executing pipeline...'
|
93
93
|
start_time = DateTime.now
|
94
94
|
execute_pipeline(false)
|
95
|
-
$LOG.trace "Total time in execute_pipeline #{DateTime.now.to_time - start_time.to_time} seconds"
|
95
|
+
$LOG.trace "Total time in execute_pipeline #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
96
96
|
|
97
97
|
begin
|
98
98
|
if defined?(::Compass)
|
99
|
-
$LOG.verbose 'configure_compass'
|
99
|
+
$LOG.verbose 'configure_compass' if config.verbose
|
100
100
|
start_time = DateTime.now
|
101
101
|
configure_compass
|
102
|
-
$LOG.trace "Total time in configure_compass #{DateTime.now.to_time - start_time.to_time} seconds"
|
102
|
+
$LOG.trace "Total time in configure_compass #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
103
103
|
end
|
104
104
|
rescue LoadError
|
105
105
|
# doesn't matter if we can't load it
|
106
106
|
end
|
107
|
-
$LOG.verbose 'set_urls'
|
107
|
+
$LOG.verbose 'set_urls' if config.verbose
|
108
108
|
start_time = DateTime.now
|
109
109
|
set_urls( site.pages )
|
110
|
-
$LOG.trace "Total time in set_urls #{DateTime.now.to_time - start_time.to_time} seconds"
|
110
|
+
$LOG.trace "Total time in set_urls #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
111
111
|
|
112
|
-
$LOG.verbose 'build_page_index'
|
112
|
+
$LOG.verbose 'build_page_index' if config.verbose
|
113
113
|
start_time = DateTime.now
|
114
114
|
build_page_index
|
115
|
-
$LOG.trace "Total time in build_page_index #{DateTime.now.to_time - start_time.to_time} seconds"
|
115
|
+
$LOG.trace "Total time in build_page_index #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
116
116
|
|
117
117
|
if generate
|
118
|
-
$LOG.debug 'generate_output'
|
118
|
+
$LOG.debug 'generate_output' if config.debug
|
119
119
|
$LOG.info 'Generating pages...'
|
120
120
|
start_time = DateTime.now
|
121
121
|
generate_output
|
122
|
-
$LOG.trace "Total time in generate_output #{DateTime.now.to_time - start_time.to_time} seconds"
|
122
|
+
$LOG.trace "Total time in generate_output #{DateTime.now.to_time - start_time.to_time} seconds" if config.perf
|
123
123
|
end
|
124
124
|
Awestruct::ExceptionHelper::EXITCODES[:success]
|
125
125
|
end
|
@@ -181,7 +181,7 @@ module Awestruct
|
|
181
181
|
def load_site_yaml(yaml_path, profile = nil)
|
182
182
|
if File.exist?(yaml_path)
|
183
183
|
begin
|
184
|
-
data = YAML.load( ERB.new(File.read( yaml_path, :encoding => 'bom|utf-8' )).result )
|
184
|
+
data = YAML.load( ERB.new(File.read( yaml_path, :encoding => 'bom|utf-8' ), nil, '<>').result )
|
185
185
|
if profile
|
186
186
|
# JP: Interpolation now turned off by default, turn it per page if needed
|
187
187
|
site.interpolate = false
|
@@ -211,7 +211,7 @@ module Awestruct
|
|
211
211
|
|
212
212
|
def load_yaml(yaml_path)
|
213
213
|
begin
|
214
|
-
data = YAML.load( ERB.new(File.read( yaml_path )).result )
|
214
|
+
data = YAML.load( ERB.new(File.read( yaml_path ), nil, '<>').result )
|
215
215
|
rescue Exception => e
|
216
216
|
ExceptionHelper.log_building_error e, yaml_path
|
217
217
|
ExceptionHelper.mark_failed
|
@@ -267,7 +267,7 @@ module Awestruct
|
|
267
267
|
|
268
268
|
def set_urls(pages)
|
269
269
|
pages.each do |page|
|
270
|
-
$LOG.debug "relative_source_path #{page.relative_source_path}"
|
270
|
+
$LOG.debug "relative_source_path #{page.relative_source_path}" if config.debug
|
271
271
|
page_path = page.output_path
|
272
272
|
if page_path =~ /^\//
|
273
273
|
page.url = page_path
|
@@ -324,21 +324,21 @@ module Awestruct
|
|
324
324
|
config.environment = site.profile
|
325
325
|
config.project_path = site.config.dir
|
326
326
|
config.sass_path = File.join(config.project_path, 'stylesheets')
|
327
|
-
config.
|
327
|
+
config.asset_host = lambda { |_| site.base_url || site.config.options.base_url || '/' }
|
328
328
|
config.css_path = File.join(site.output_dir, 'stylesheets')
|
329
329
|
config.javascripts_path = File.join(site.output_dir, 'javascripts')
|
330
|
-
config.http_javascripts_dir =
|
331
|
-
config.http_stylesheets_dir =
|
330
|
+
config.http_javascripts_dir = 'javascripts'
|
331
|
+
config.http_stylesheets_dir = 'stylesheets'
|
332
332
|
config.sprite_load_path = [config.images_path]
|
333
|
-
config.http_images_dir =
|
333
|
+
config.http_images_dir = 'images'
|
334
334
|
config.images_path = File.join(config.project_path, 'images')
|
335
335
|
config.fonts_dir = 'fonts'
|
336
336
|
config.fonts_path = File.join(config.project_path, 'fonts')
|
337
|
-
config.http_fonts_dir =
|
337
|
+
config.http_fonts_dir = 'fonts'
|
338
338
|
|
339
339
|
if config.generated_images_dir == config.default_for('generated_images_dir')
|
340
340
|
config.generated_images_dir = File.join(site.output_dir, 'images')
|
341
|
-
config.http_generated_images_dir =
|
341
|
+
config.http_generated_images_dir = 'images'
|
342
342
|
end
|
343
343
|
|
344
344
|
config.line_comments = lambda do
|
@@ -388,9 +388,9 @@ module Awestruct
|
|
388
388
|
end
|
389
389
|
|
390
390
|
def load_pages
|
391
|
-
$LOG.debug "layout_page_loader.load_all :post"
|
391
|
+
$LOG.debug "layout_page_loader.load_all :post" if config.debug
|
392
392
|
@layout_page_loader.load_all( :post )
|
393
|
-
$LOG.debug "site_page_loader.load_all :inline"
|
393
|
+
$LOG.debug "site_page_loader.load_all :inline" if config.debug
|
394
394
|
@site_page_loader.load_all( :inline )
|
395
395
|
end
|
396
396
|
|
@@ -398,10 +398,11 @@ module Awestruct
|
|
398
398
|
FileUtils.mkdir_p( site.config.output_dir )
|
399
399
|
return_value = [Awestruct::ExceptionHelper::EXITCODES[:success]]
|
400
400
|
begin
|
401
|
+
$LOG.verbose "Using the following options from site.generation: #{site.generation}" if config.verbose
|
401
402
|
return_value = Parallel.map(@site.pages, site.generation) do |page|
|
402
403
|
start_time = DateTime.now
|
403
404
|
return_value = generate_page( page )
|
404
|
-
$LOG.trace "Total time generating #{page.output_path} #{DateTime.now.to_time - start_time.to_time} seconds" if
|
405
|
+
$LOG.trace "Total time generating #{page.output_path} #{DateTime.now.to_time - start_time.to_time} seconds" if config.verbose && config.perf
|
405
406
|
|
406
407
|
return_value
|
407
408
|
end
|
@@ -420,7 +421,7 @@ module Awestruct
|
|
420
421
|
def generate_page(page, produce_output=true)
|
421
422
|
if produce_output
|
422
423
|
generated_path = File.join( site.config.output_dir, page.output_path )
|
423
|
-
$LOG.debug "Generating: #{generated_path}" if config.verbose
|
424
|
+
$LOG.debug "Generating: #{generated_path}" if config.verbose && config.debug
|
424
425
|
|
425
426
|
c = ''
|
426
427
|
begin
|
@@ -434,15 +435,16 @@ module Awestruct
|
|
434
435
|
end
|
435
436
|
rescue Exception => e
|
436
437
|
Awestruct::ExceptionHelper.log_building_error e, page.relative_source_path
|
438
|
+
return Awestruct::ExceptionHelper::EXITCODES[:generation_error]
|
437
439
|
ensure
|
438
440
|
return Awestruct::ExceptionHelper::EXITCODES[:generation_error] if c.include? 'Backtrace:'
|
439
441
|
end
|
440
442
|
Awestruct::ExceptionHelper::EXITCODES[:success]
|
441
443
|
elsif site.config.track_dependencies
|
442
444
|
if page.dependencies.load!
|
443
|
-
$LOG.debug "Cached: #{generated_path}"
|
445
|
+
$LOG.debug "Cached: #{generated_path}" if config.debug
|
444
446
|
else
|
445
|
-
$LOG.debug "Analyzing: #{generated_path}"
|
447
|
+
$LOG.debug "Analyzing: #{generated_path}" if config.debug
|
446
448
|
page.rendered_content
|
447
449
|
end
|
448
450
|
return Awestruct::ExceptionHelper::EXITCODES[:success]
|
@@ -472,7 +474,7 @@ module Awestruct
|
|
472
474
|
|
473
475
|
regen_pages = page_dependencies( page )
|
474
476
|
|
475
|
-
$LOG.debug 'Starting regeneration of content dependent pages:' if regen_pages.size > 0
|
477
|
+
$LOG.debug 'Starting regeneration of content dependent pages:' if regen_pages.size > 0 && config.debug
|
476
478
|
|
477
479
|
regen_pages.each do |p|
|
478
480
|
$LOG.info "Regenerating page #{p.output_path}"
|