awestruct 0.5.4.rc → 0.5.4.rc2
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.
- data/Gemfile +29 -0
- data/LICENSE.txt +18 -0
- data/README.md +31 -0
- data/Rakefile +100 -0
- data/awestruct.gemspec +48 -0
- data/lib/awestruct/cli/auto.rb +3 -4
- data/lib/awestruct/cli/generate.rb +2 -2
- data/lib/awestruct/cli/manifest.rb +4 -4
- data/lib/awestruct/deploy/base_deploy.rb +7 -4
- data/lib/awestruct/deploy/github_pages_deploy.rb +2 -1
- data/lib/awestruct/engine.rb +6 -0
- data/lib/awestruct/extensions/partial.rb +4 -0
- data/lib/awestruct/extensions/relative.rb +2 -2
- data/lib/awestruct/extensions/sitemap.rb +2 -1
- data/lib/awestruct/handlers/base_tilt_handler.rb +12 -7
- data/lib/awestruct/handlers/front_matter_handler.rb +3 -2
- data/lib/awestruct/handlers/interpolation_handler.rb +2 -3
- data/lib/awestruct/handlers/restructuredtext_handler.rb +4 -6
- data/lib/awestruct/page.rb +2 -1
- data/lib/awestruct/util/exception_helper.rb +29 -0
- data/lib/awestruct/version.rb +1 -2
- data/man/awestruct.adoc +135 -0
- data/spec/deploy_spec.rb +38 -9
- data/spec/front_matter_handler_spec.rb +6 -0
- data/spec/github_pages_deploy_spec.rb +1 -0
- data/spec/test-data/.awestruct_ignore +2 -0
- data/spec/test-data/front-matter-empty.txt +3 -0
- data/spec/test-data/handlers/textile-empty-page.textile +0 -0
- data/spec/textile_handler_spec.rb +11 -0
- metadata +276 -314
- data/lib/awestruct/page.rb.old +0 -181
data/Gemfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
group :development do
|
|
4
|
+
gem 'spectator', '>= 1.2.5'
|
|
5
|
+
gem 'hashery', '>= 2.1.0'
|
|
6
|
+
gem 'rspec', '>= 2.9'
|
|
7
|
+
gem 'rake', '>= 0.9.2'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
group :test do
|
|
11
|
+
gem 'rb-inotify', '>= 0.9.0'
|
|
12
|
+
gem 'rack-test'
|
|
13
|
+
gem 'tilt', '>= 1.3.5'
|
|
14
|
+
gem 'coffee-script', '>= 2.2.0'
|
|
15
|
+
gem 'asciidoctor', '>= 0.1.3' # >= 0.1.1 is required for front matter integration
|
|
16
|
+
gem 'slim', '>= 1.3.6'
|
|
17
|
+
gem 'kramdown', '>= 0.14.2'
|
|
18
|
+
gem 'therubyracer', '0.10.0', :platforms => :ruby
|
|
19
|
+
gem 'therubyrhino', '~> 2.0.2', :platforms => :jruby
|
|
20
|
+
gem 'less', '>= 2.2.2'
|
|
21
|
+
gem 'org-ruby', '>= 0.7'
|
|
22
|
+
gem 'RedCloth', '>= 4.2.9'
|
|
23
|
+
gem 'mustache', '>= 0.99.4'
|
|
24
|
+
gem 'uglifier', '>= 1.3.0'
|
|
25
|
+
gem 'htmlcompressor', '>= 0.0.7'
|
|
26
|
+
gem 'git', '~> 1.2.5'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
gemspec
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Copyright (c) 2010-2013 Bob McWhirter and contributors (see git log)
|
|
2
|
+
|
|
3
|
+
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
|
+
deal in the Software without restriction, including without limitation the
|
|
6
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
16
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[](http://travis-ci.org/awestruct/awestruct)
|
|
2
|
+
|
|
3
|
+
[](https://buildhive.cloudbees.com/job/awestruct/job/awestruct/)
|
|
4
|
+
|
|
5
|
+
# For more information
|
|
6
|
+
|
|
7
|
+
Please see the complete site at <http://awestruct.org/>.
|
|
8
|
+
|
|
9
|
+
# License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2010-2011 Bob McWhirter and contributors (see git log)
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to
|
|
15
|
+
deal in the Software without restriction, including without limitation the
|
|
16
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
17
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
|
21
|
+
all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
26
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
27
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
28
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
+
|
|
30
|
+
It also uses code from the Sequel project under the same license.
|
|
31
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'date'
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
|
|
6
|
+
def gem_name
|
|
7
|
+
@gem_name ||= Dir['*.gemspec'].first.split('.').first
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def gem_version
|
|
11
|
+
line = File.read("lib/#{gem_name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
|
|
12
|
+
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def date
|
|
16
|
+
Date.today.to_s
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def gemspec_file
|
|
20
|
+
"#{gem_name}.gemspec"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def gem_file
|
|
24
|
+
"#{gem_name}-#{gem_version}.gem"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def version_tag
|
|
28
|
+
"v#{gem_version}"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def replace_header(head, header_name)
|
|
32
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
task :default => :build
|
|
36
|
+
|
|
37
|
+
if !defined?(RSpec)
|
|
38
|
+
puts 'spec targets require RSpec'
|
|
39
|
+
else
|
|
40
|
+
desc 'Run all specs'
|
|
41
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
|
42
|
+
t.pattern = 'spec/**/*_spec.rb'
|
|
43
|
+
t.rspec_opts = ['-cfs']
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc "Run all specs and build #{gem_file} into the pkg directory"
|
|
48
|
+
task :build => [:spec, :gemspec] do
|
|
49
|
+
sh "gem build #{gemspec_file}"
|
|
50
|
+
sh 'mkdir -p pkg'
|
|
51
|
+
sh "mv #{gem_file} pkg"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
desc "Build #{gem_file} and install it locally"
|
|
55
|
+
task :install => :build do
|
|
56
|
+
sh "gem install -l -f pkg/#{gem_file}"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
desc "Update #{gemspec_file}"
|
|
60
|
+
task :gemspec do
|
|
61
|
+
spec = File.read(gemspec_file)
|
|
62
|
+
|
|
63
|
+
# replace name version and date
|
|
64
|
+
replace_header(spec, :gem_name)
|
|
65
|
+
replace_header(spec, :date)
|
|
66
|
+
|
|
67
|
+
File.open(gemspec_file, 'w') { |io| io.write spec }
|
|
68
|
+
puts "Updated #{gemspec_file}"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
desc "Create tag #{version_tag} and push repository to origin"
|
|
72
|
+
task :tag do
|
|
73
|
+
unless `git branch` =~ / master$/
|
|
74
|
+
puts 'You must be on the master branch to release!'
|
|
75
|
+
exit!
|
|
76
|
+
end
|
|
77
|
+
if version_tag.end_with?('.dev')
|
|
78
|
+
puts 'You cannot tag and release a dev version!'
|
|
79
|
+
exit!
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
if `git tag`.split(/\n/).include?(version_tag)
|
|
83
|
+
puts "Tag #{version_tag} has already been created."
|
|
84
|
+
else
|
|
85
|
+
sh "git commit --allow-empty -a -m 'Release #{gem_version}'"
|
|
86
|
+
sh 'git push origin master'
|
|
87
|
+
sh "git tag #{version_tag}"
|
|
88
|
+
sh "git push origin #{version_tag}"
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
desc "Build #{gem_file}, create and push tag #{version_tag} and publish gem to RubyGems.org"
|
|
93
|
+
task :release => [ :build, :tag ] do
|
|
94
|
+
sh "gem push pkg/#{gem_file}"
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
desc 'Run `spectator` to monitor changes and execute specs in TDD fashion'
|
|
98
|
+
task :tdd do
|
|
99
|
+
sh 'spectator'
|
|
100
|
+
end
|
data/awestruct.gemspec
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
|
2
|
+
require 'awestruct/version'
|
|
3
|
+
|
|
4
|
+
spec = Gem::Specification.new do |s|
|
|
5
|
+
s.name = 'awestruct'
|
|
6
|
+
s.version = Awestruct::VERSION
|
|
7
|
+
s.date = '2013-11-11'
|
|
8
|
+
|
|
9
|
+
s.authors = ['Bob McWhirter', 'Jason Porter', 'Lance Ball', 'Dan Allen', 'Torsten Curdt', 'other contributors']
|
|
10
|
+
s.email = ['bob@mcwhirter.org', 'lightguard.jp@gmail.com', 'lball@redhat.com', 'dan.j.allen@gmail.com', 'tcurdt@vafer.org']
|
|
11
|
+
s.homepage = 'http://awestruct.org'
|
|
12
|
+
s.summary = 'Static site baking and publishing tool'
|
|
13
|
+
s.description = 'Awestruct is a static site baking and publishing tool. It supports an extensive list of both templating and markup languages via Tilt (Haml, Slim, AsciiDoc, Markdown, Sass via Compass, etc), provides mobile-first layout and styling via Bootstrap or Foundation, offers a variety of deployment options (rsync, git, S3), handles site optimizations (minification, compression, cache busting), includes built-in extensions such as blog post management and is highly extensible.'
|
|
14
|
+
|
|
15
|
+
s.rubyforge_project = s.name
|
|
16
|
+
|
|
17
|
+
s.license = 'MIT'
|
|
18
|
+
|
|
19
|
+
s.platform = Gem::Platform::RUBY
|
|
20
|
+
|
|
21
|
+
s.has_rdoc = true
|
|
22
|
+
s.rdoc_options = ['--charset=UTF-8']
|
|
23
|
+
s.extra_rdoc_files = 'README.md'
|
|
24
|
+
|
|
25
|
+
s.files = `git ls-files -z -- {lib,man,spec}/* {README,LICENSE}* *{.gemspec,file}`.split("\0")
|
|
26
|
+
s.test_files = s.files.select { |path| path =~ /^spec\/.*_spec\.rb/ }
|
|
27
|
+
s.executables = `git ls-files -z -- bin/*`.split("\0").map {|f| File.basename f }
|
|
28
|
+
s.require_paths = ['lib']
|
|
29
|
+
|
|
30
|
+
s.requirements = <<-EOS
|
|
31
|
+
Any markup languages you are using and its dependencies.
|
|
32
|
+
Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if you're running on MRI. JRuby should be using haml 4.0.0+ with Kramdown.'
|
|
33
|
+
EOS
|
|
34
|
+
|
|
35
|
+
s.add_dependency 'haml', '~> 4.0.1'
|
|
36
|
+
s.add_dependency 'nokogiri', '1.5.10'
|
|
37
|
+
s.add_dependency 'tilt', '>= 1.3.6'
|
|
38
|
+
s.add_dependency 'compass', '>= 0.12.1'
|
|
39
|
+
s.add_dependency 'compass-960-plugin', '~> 0.10.4'
|
|
40
|
+
s.add_dependency 'bootstrap-sass', '>= 2.3.1.0'
|
|
41
|
+
s.add_dependency 'zurb-foundation', '>= 4.0.9'
|
|
42
|
+
s.add_dependency 'mime-types', '1.25'
|
|
43
|
+
s.add_dependency 'rest-client', '>= 1.6.7'
|
|
44
|
+
s.add_dependency 'ruby-s3cmd', '~> 0.1.5'
|
|
45
|
+
|
|
46
|
+
s.add_dependency 'listen', '~> 1.0'
|
|
47
|
+
s.add_dependency 'rack', '~> 1.5.2'
|
|
48
|
+
end
|
data/lib/awestruct/cli/auto.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#require 'guard/awestruct'
|
|
2
|
+
require 'awestruct/util/exception_helper'
|
|
2
3
|
|
|
3
4
|
require 'listen'
|
|
4
5
|
|
|
@@ -39,13 +40,11 @@ module Awestruct
|
|
|
39
40
|
engine.generate_page_by_output_path( path )
|
|
40
41
|
$LOG.info "Generating.... done!" if $LOG.info?
|
|
41
42
|
rescue => e
|
|
42
|
-
|
|
43
|
-
$LOG.error e.backtrace.join("\n") if $LOG.error?
|
|
43
|
+
ExceptionHelper.log_building_error e, path
|
|
44
44
|
end
|
|
45
45
|
}
|
|
46
46
|
rescue => e
|
|
47
|
-
|
|
48
|
-
$LOG.error e.backtrace.join("\n") if $LOG.error?
|
|
47
|
+
ExceptionHelper.log_building_error e, path
|
|
49
48
|
end
|
|
50
49
|
end
|
|
51
50
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'awestruct/engine'
|
|
2
|
+
require 'awestruct/util/exception_helper'
|
|
2
3
|
require 'compass'
|
|
3
4
|
|
|
4
5
|
module Awestruct
|
|
@@ -19,8 +20,7 @@ module Awestruct
|
|
|
19
20
|
$LOG.info "Generating site: #{base_url}" if $LOG.info?
|
|
20
21
|
@engine.run( @profile, @base_url, @default_base_url, @force )
|
|
21
22
|
rescue =>e
|
|
22
|
-
|
|
23
|
-
$LOG.error e.backtrace.join("\n") if $LOG.error?
|
|
23
|
+
ExceptionHelper.log_building_error e, ''
|
|
24
24
|
return false
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -78,8 +78,8 @@ module Awestruct
|
|
|
78
78
|
begin
|
|
79
79
|
step.perform(dir)
|
|
80
80
|
rescue => e
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
ExceptionHelper.log_error e
|
|
82
|
+
ExceptionHelper.log_backtrace e
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
end
|
|
@@ -89,8 +89,8 @@ module Awestruct
|
|
|
89
89
|
begin
|
|
90
90
|
step.unperform(dir)
|
|
91
91
|
rescue => e
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
ExceptionHelper.log_error e
|
|
93
|
+
ExceptionHelper.log_backtrace e
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
require 'awestruct/deployers'
|
|
2
2
|
require 'awestruct/compatibility'
|
|
3
|
+
require 'awestruct/util/exception_helper'
|
|
4
|
+
|
|
3
5
|
Dir[ File.join( File.dirname(__FILE__), '..', 'scm', '*.rb' ) ].each do |f|
|
|
4
6
|
begin
|
|
5
7
|
require f
|
|
@@ -18,6 +20,7 @@ module Awestruct
|
|
|
18
20
|
# Add a single front slash at the end of output dir
|
|
19
21
|
@site_path = File.join( site_config.output_dir, '/' ).gsub(/^\w:\//, '/')
|
|
20
22
|
@gzip = deploy_config['gzip']
|
|
23
|
+
@gzip_level = deploy_config['gzip_level'] || Zlib::BEST_COMPRESSION
|
|
21
24
|
@source_dir = deploy_config['source_dir'] || site_config.dir
|
|
22
25
|
@ignore_uncommitted = deploy_config['uncommitted']
|
|
23
26
|
init_scm(deploy_config['scm'] || 'git')
|
|
@@ -61,16 +64,16 @@ module Awestruct
|
|
|
61
64
|
when :css, :js, :html
|
|
62
65
|
require 'zlib'
|
|
63
66
|
if !is_gzipped item
|
|
64
|
-
gzip_file
|
|
67
|
+
gzip_file(item, @gzip_level)
|
|
65
68
|
end
|
|
66
69
|
end
|
|
67
70
|
end
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
73
|
|
|
71
|
-
def gzip_file(filename)
|
|
74
|
+
def gzip_file(filename, level)
|
|
72
75
|
$LOG.debug "Gzipping File #{filename}"
|
|
73
|
-
Zlib::GzipWriter.open("#{filename}.gz") do |gz|
|
|
76
|
+
Zlib::GzipWriter.open("#{filename}.gz", level) do |gz|
|
|
74
77
|
gz.mtime = File.mtime(filename)
|
|
75
78
|
gz.orig_name = filename
|
|
76
79
|
gz.write File.binread(filename)
|
|
@@ -94,7 +97,7 @@ module Awestruct
|
|
|
94
97
|
clazz = Object.const_get('Awestruct').const_get('Scm').const_get(type.capitalize)
|
|
95
98
|
@scm = clazz.new
|
|
96
99
|
rescue
|
|
97
|
-
|
|
100
|
+
ExceptionHelper.log_message( "Could not resolve class for scm type: #{type}" )
|
|
98
101
|
end
|
|
99
102
|
end
|
|
100
103
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'awestruct/deploy/base_deploy'
|
|
2
|
+
require 'awestruct/util/exception_helper'
|
|
2
3
|
require 'git'
|
|
3
4
|
|
|
4
5
|
module Awestruct
|
|
@@ -43,7 +44,7 @@ module Awestruct
|
|
|
43
44
|
begin
|
|
44
45
|
git.commit("Published #{@branch} to GitHub pages.")
|
|
45
46
|
rescue ::Git::GitExecuteError => e
|
|
46
|
-
|
|
47
|
+
ExceptionHelper.log_message "Can't commit. #{e}."
|
|
47
48
|
end
|
|
48
49
|
end
|
|
49
50
|
git.reset_hard
|
data/lib/awestruct/engine.rb
CHANGED
|
@@ -327,6 +327,12 @@ module Awestruct
|
|
|
327
327
|
full_path = File.join( '', path )
|
|
328
328
|
page = site.pages.find{ |p| p.relative_source_path.to_s == full_path } ||
|
|
329
329
|
site.layouts.find{ |p| p.relative_source_path.to_s == full_path }
|
|
330
|
+
#return if page.nil?
|
|
331
|
+
|
|
332
|
+
if ( page.nil? )
|
|
333
|
+
page = (site.partials||[]).find{ |p| p.relative_source_path.to_s == full_path }
|
|
334
|
+
end
|
|
335
|
+
|
|
330
336
|
return if page.nil?
|
|
331
337
|
|
|
332
338
|
if !page.output_path.nil?
|
|
@@ -18,6 +18,10 @@ module Awestruct
|
|
|
18
18
|
page.send( "#{k}=", v )
|
|
19
19
|
end if params
|
|
20
20
|
|
|
21
|
+
Awestruct::Dependencies.top_page.site.partials ||= []
|
|
22
|
+
Awestruct::Dependencies.top_page.site.partials << page
|
|
23
|
+
Awestruct::Dependencies.track_dependency( page )
|
|
24
|
+
|
|
21
25
|
page.content
|
|
22
26
|
end
|
|
23
27
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'awestruct/util/exception_helper'
|
|
1
2
|
require 'pathname'
|
|
2
3
|
|
|
3
4
|
module Awestruct
|
|
@@ -14,8 +15,7 @@ module Awestruct
|
|
|
14
15
|
end
|
|
15
16
|
result
|
|
16
17
|
rescue Exception => e
|
|
17
|
-
|
|
18
|
-
$LOG.error "#{e.backtrace.join("\n")}" if $LOG.error?
|
|
18
|
+
ExceptionHelper.log_building_error e, p.relative_source_path
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# Add a sitemap.yml file to add files that for one reason or
|
|
4
4
|
# another won't be hanging off of site (e.g. they're in .htaccess)
|
|
5
5
|
require 'ostruct'
|
|
6
|
+
require 'awestruct/util/exception_helper'
|
|
6
7
|
|
|
7
8
|
module Awestruct
|
|
8
9
|
module Extensions
|
|
@@ -74,7 +75,7 @@ module Awestruct
|
|
|
74
75
|
page.lastmod = date.strftime( "%Y-%m-%d" )
|
|
75
76
|
end
|
|
76
77
|
rescue Exception => e
|
|
77
|
-
|
|
78
|
+
ExceptionHelper.log_building_error e, page.relative_source_path
|
|
78
79
|
end
|
|
79
80
|
else
|
|
80
81
|
page.lastmod = Time.now.strftime( "%Y-%m-%d" )
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'awestruct/util/exception_helper'
|
|
1
2
|
require 'awestruct/handlers/base_handler'
|
|
2
3
|
|
|
3
4
|
require 'tilt'
|
|
@@ -118,21 +119,25 @@ module Awestruct
|
|
|
118
119
|
end
|
|
119
120
|
|
|
120
121
|
def rendered_content(context, with_layouts=true)
|
|
121
|
-
$LOG.debug "invoking tilt for #{delegate.path
|
|
122
|
+
$LOG.debug "invoking tilt for #{delegate.path} with_layouts = #{with_layouts}" if $LOG.debug?
|
|
123
|
+
|
|
122
124
|
begin
|
|
125
|
+
c = delegate.rendered_content(context, with_layouts)
|
|
126
|
+
return "" if c.nil? or c.empty?
|
|
123
127
|
template = Tilt::new(delegate.path.to_s, delegate.content_line_offset + 1, options) { |engine|
|
|
124
|
-
|
|
128
|
+
c
|
|
125
129
|
}
|
|
126
130
|
return template.render(context)
|
|
127
131
|
rescue LoadError => e
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
ExceptionHelper.log_message "Could not load template library required for rendering #{File.join site.dir, relative_source_path}."
|
|
133
|
+
ExceptionHelper.log_message "Please see #{File.join site.dir, output_path} for more information"
|
|
134
|
+
return ExceptionHelper.html_error_report e, relative_source_path
|
|
130
135
|
rescue Exception => e
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
ExceptionHelper.log_message "An error during rendering #{File.join site.dir, relative_source_path} occurred."
|
|
137
|
+
ExceptionHelper.log_message "Please see #{File.join site.dir, output_path} for more information"
|
|
138
|
+
return ExceptionHelper.html_error_report e, relative_source_path
|
|
133
139
|
end
|
|
134
140
|
end
|
|
135
|
-
|
|
136
141
|
end
|
|
137
142
|
end
|
|
138
143
|
end
|