awestruct 0.5.5 → 0.5.6.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -4
- data/Rakefile +0 -4
- data/awestruct.gemspec +3 -2
- data/lib/awestruct/cli/auto.rb +5 -0
- data/lib/awestruct/cli/invoker.rb +2 -2
- data/lib/awestruct/cli/options.rb +4 -0
- data/lib/awestruct/engine.rb +36 -22
- data/lib/awestruct/extensions/pipeline.rb +5 -0
- data/lib/awestruct/extensions/tag_cloud.rb +2 -1
- data/lib/awestruct/handlers/asciidoctor_handler.rb +2 -1
- data/lib/awestruct/handlers/base_tilt_handler.rb +5 -6
- data/lib/awestruct/version.rb +1 -1
- data/spec/awestruct/handlers/tilt_handler_spec.rb +1 -0
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb0a51f409f8009c7c325d9d2e7acea5437e2c1e
|
4
|
+
data.tar.gz: e392c0a5f0fd4252953d61a0399d548de9f072c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b818f8b17abc86d8f471b52b0d3e8e2820d77619a3492c9ca47d34a4a47961a07891bc73b4fa7d3a7b7baebfee4a00bbff2d5933a7ffd8eb8bca6055804b925
|
7
|
+
data.tar.gz: 3a7dd3521dbe40d059c79a12edcc51d36a2c6d7aa7da2b54b4ea6dd557885615a46a855436d6ef71a3882a2585fbadb7251bd42ca5b3f00f0317b115fdaef4f2
|
data/Gemfile
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'spectator', '~> 1.2.6'
|
5
4
|
gem 'hashery', '~> 2.1.1'
|
6
5
|
gem 'rspec', '~> 2.14.1'
|
7
6
|
gem 'rake', '~> 10.2.2'
|
8
7
|
gem 'guard-rspec', '~> 4.2.0', :require => false
|
9
|
-
gem 'pry',
|
10
|
-
gem 'pry-
|
8
|
+
gem 'pry', :require => false
|
9
|
+
gem 'pry-byebug', :require => false
|
11
10
|
end
|
12
11
|
|
13
12
|
group :test do
|
@@ -18,7 +17,7 @@ group :test do
|
|
18
17
|
gem 'asciidoctor', '~> 0.1.4'
|
19
18
|
gem 'slim', '~> 2.0.2'
|
20
19
|
gem 'kramdown', '~> 1.3.3'
|
21
|
-
gem 'therubyracer', '~> 0.
|
20
|
+
gem 'therubyracer', '~> 0.12.1', :platforms => :ruby
|
22
21
|
gem 'therubyrhino', '~> 2.0.3', :platforms => :jruby
|
23
22
|
gem 'less', '~> 2.5.0'
|
24
23
|
gem 'org-ruby', '~> 0.9.3'
|
data/Rakefile
CHANGED
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 = '2014-
|
7
|
+
s.date = '2014-09-26'
|
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']
|
@@ -41,11 +41,12 @@ Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if
|
|
41
41
|
s.add_dependency 'bootstrap-sass', '~> 3.1.1.0'
|
42
42
|
s.add_dependency 'zurb-foundation', '~> 4.3.2'
|
43
43
|
s.add_dependency 'mime-types', '~> 2.1'
|
44
|
-
s.add_dependency 'rest-client', '~> 1.
|
44
|
+
s.add_dependency 'rest-client', '~> 1.7.2'
|
45
45
|
s.add_dependency 'ruby-s3cmd', '~> 0.1.5'
|
46
46
|
s.add_dependency 'listen', '~> 2.7.1'
|
47
47
|
s.add_dependency 'rack', '~> 1.5.2'
|
48
48
|
s.add_dependency 'git', '~> 1.2.6'
|
49
49
|
s.add_dependency 'guard-livereload', '~> 2.1.2'
|
50
50
|
s.add_dependency 'colorize', '~> 0.7.1'
|
51
|
+
s.add_dependency 'parallel', '> 1.1.1'
|
51
52
|
end
|
data/lib/awestruct/cli/auto.rb
CHANGED
@@ -83,6 +83,11 @@ module Awestruct
|
|
83
83
|
listener.ignore( %r(\.awestruct) )
|
84
84
|
listener.ignore( %r(^#{File.basename( @config.tmp_dir )}) )
|
85
85
|
listener.ignore( %r(^#{File.basename( @config.output_dir )}) )
|
86
|
+
|
87
|
+
@config.ignore.each do |i|
|
88
|
+
listener.ignore( %r(^#{i}) )
|
89
|
+
end
|
90
|
+
|
86
91
|
listener.start
|
87
92
|
end
|
88
93
|
|
@@ -26,8 +26,8 @@ module Awestruct
|
|
26
26
|
@success = true
|
27
27
|
logging_path = Pathname.new '.awestruct'
|
28
28
|
logging_path.mkdir unless logging_path.exist?
|
29
|
-
$LOG = Logger.new(Awestruct::AwestructLoggerMultiIO.new(@options.
|
30
|
-
$LOG.level = @options.
|
29
|
+
$LOG = Logger.new(Awestruct::AwestructLoggerMultiIO.new(@options.debug, STDOUT, File.open('.awestruct/debug.log', 'w')))
|
30
|
+
$LOG.level = @options.debug ? Logger::DEBUG : Logger::INFO
|
31
31
|
$LOG.formatter = Awestruct::AwestructLogFormatter.new
|
32
32
|
|
33
33
|
# these requires are deferred until after $LOG is set
|
@@ -35,6 +35,7 @@ module Awestruct
|
|
35
35
|
attr_accessor :source_dir
|
36
36
|
attr_accessor :output_dir
|
37
37
|
attr_accessor :livereload
|
38
|
+
attr_accessor :debug
|
38
39
|
|
39
40
|
def initialize()
|
40
41
|
@generate = nil
|
@@ -63,6 +64,9 @@ module Awestruct
|
|
63
64
|
|
64
65
|
def parse!(args)
|
65
66
|
opts = OptionParser.new do |opts|
|
67
|
+
opts.on('-D', '--debug', 'Enable debug logging') do |verbose|
|
68
|
+
self.debug = true
|
69
|
+
end
|
66
70
|
opts.on('-w', '--verbose', 'Enable verbose mode') do |verbose|
|
67
71
|
self.verbose = true
|
68
72
|
end
|
data/lib/awestruct/engine.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'awestruct/util/inflector'
|
2
|
+
require 'awestruct/util/exception_helper'
|
2
3
|
require 'awestruct/util/default_inflections'
|
3
4
|
|
4
5
|
require 'awestruct/config'
|
@@ -12,10 +13,10 @@ require 'awestruct/extensions/pipeline'
|
|
12
13
|
|
13
14
|
require 'fileutils'
|
14
15
|
require 'set'
|
16
|
+
require 'date'
|
15
17
|
|
16
18
|
require 'compass'
|
17
|
-
|
18
|
-
require 'pry'
|
19
|
+
require 'parallel'
|
19
20
|
|
20
21
|
class OpenStruct
|
21
22
|
def inspect
|
@@ -68,6 +69,7 @@ module Awestruct
|
|
68
69
|
$LOG.debug 'load_pages' if $LOG.debug?
|
69
70
|
load_pages
|
70
71
|
$LOG.debug 'execute_pipeline' if $LOG.debug?
|
72
|
+
$LOG.info 'Excecuting pipeline...' if $LOG.info?
|
71
73
|
execute_pipeline
|
72
74
|
$LOG.debug 'configure_compass' if $LOG.debug?
|
73
75
|
configure_compass
|
@@ -76,7 +78,9 @@ module Awestruct
|
|
76
78
|
$LOG.debug 'build_page_index' if $LOG.debug?
|
77
79
|
build_page_index
|
78
80
|
$LOG.debug 'generate_output' if $LOG.debug?
|
81
|
+
$LOG.info 'Generating pages...' if $LOG.info?
|
79
82
|
generate_output
|
83
|
+
return 0
|
80
84
|
end
|
81
85
|
|
82
86
|
def build_page_index
|
@@ -128,32 +132,42 @@ module Awestruct
|
|
128
132
|
|
129
133
|
def load_site_yaml(yaml_path, profile = nil)
|
130
134
|
if ( File.exist?( yaml_path ) )
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
begin
|
136
|
+
data = YAML.load( File.read( yaml_path, :encoding => 'bom|utf-8' ) )
|
137
|
+
if ( profile )
|
138
|
+
# JP: Interpolation now turned off by default, turn it per page if needed
|
139
|
+
site.interpolate = false
|
140
|
+
profile_data = {}
|
141
|
+
data.each do |k,v|
|
142
|
+
if ( ( k == 'profiles' ) && ( ! profile.nil? ) )
|
143
|
+
profile_data = ( v[profile] || {} )
|
144
|
+
else
|
145
|
+
site.send( "#{k}=", merge_data( site.send( "#{k}" ), v ) )
|
146
|
+
end
|
147
|
+
end if data
|
148
|
+
site.profile = profile
|
149
|
+
profile_data.each do |k,v|
|
140
150
|
site.send( "#{k}=", merge_data( site.send( "#{k}" ), v ) )
|
141
151
|
end
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
152
|
+
else
|
153
|
+
data.each do |k,v|
|
154
|
+
site.send( "#{k}=", v )
|
155
|
+
end if data
|
146
156
|
end
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
end if data
|
157
|
+
rescue Exception => e
|
158
|
+
ExceptionHelper.log_building_error e, yaml_path
|
159
|
+
ExceptionHelper.mark_failed
|
151
160
|
end
|
152
161
|
end
|
153
162
|
end
|
154
163
|
|
155
164
|
def load_yaml(yaml_path)
|
156
|
-
|
165
|
+
begin
|
166
|
+
data = YAML.load( File.read( yaml_path ) )
|
167
|
+
rescue Exception => e
|
168
|
+
ExceptionHelper.log_building_error e, yaml_path
|
169
|
+
ExceptionHelper.mark_failed
|
170
|
+
end
|
157
171
|
name = File.basename( yaml_path, '.yml' )
|
158
172
|
site.send( "#{name}=", massage_yaml( data ) )
|
159
173
|
end
|
@@ -267,7 +281,7 @@ module Awestruct
|
|
267
281
|
|
268
282
|
def generate_output
|
269
283
|
FileUtils.mkdir_p( site.config.output_dir )
|
270
|
-
@site.pages.
|
284
|
+
Parallel.each(@site.pages, :in_processes => Parallel.processor_count) do |page|
|
271
285
|
generated_path = File.join( site.config.output_dir, page.output_path )
|
272
286
|
if ( page.stale_output?( generated_path ) )
|
273
287
|
generate_page( page, generated_path )
|
@@ -279,7 +293,7 @@ module Awestruct
|
|
279
293
|
|
280
294
|
def generate_page(page, generated_path, produce_output=true)
|
281
295
|
if ( produce_output )
|
282
|
-
$LOG.
|
296
|
+
$LOG.debug "Generating: #{generated_path}" if $LOG.debug? && config.verbose
|
283
297
|
FileUtils.mkdir_p( File.dirname( generated_path ) )
|
284
298
|
|
285
299
|
c = page.rendered_content
|
@@ -7,10 +7,11 @@ module Awestruct
|
|
7
7
|
@output_path = output_path
|
8
8
|
@layout = opts[:layout].to_s
|
9
9
|
@title = opts[:title] || 'Tags'
|
10
|
+
@template = opts[:template] || File.join( File.dirname( __FILE__ ), 'tag_cloud.html.haml' )
|
10
11
|
end
|
11
12
|
|
12
13
|
def execute(site)
|
13
|
-
page = site.engine.load_page(
|
14
|
+
page = site.engine.load_page( @template )
|
14
15
|
page.output_path = File.join( @output_path )
|
15
16
|
page.layout = @layout
|
16
17
|
page.title = @title
|
@@ -89,7 +89,8 @@ module Awestruct
|
|
89
89
|
collector["site-#{key}"] = "#{val}@" if types.detect {|t| val.kind_of? t }
|
90
90
|
collector
|
91
91
|
})
|
92
|
-
opts[:attributes]['
|
92
|
+
opts[:attributes]['env'] = @site
|
93
|
+
opts[:attributes]['env-site'] = true
|
93
94
|
opts[:attributes]['awestruct-version'] = Awestruct::VERSION
|
94
95
|
if @front_matter['header_footer']
|
95
96
|
opts[:header_footer] = true
|
@@ -14,14 +14,13 @@ module Awestruct
|
|
14
14
|
def match(path)
|
15
15
|
matcher = ::Tilt[File.basename(path)]
|
16
16
|
if matcher.nil?
|
17
|
-
|
17
|
+
$LOG.warn(%(Copying #{path})) if $LOG.warn? && Awestruct::Engine.instance.config.verbose
|
18
18
|
return false
|
19
19
|
end
|
20
20
|
|
21
21
|
# We have our own extra integration with Asciidoctor
|
22
|
-
if matcher.name.include? 'Asciidoctor'
|
23
|
-
|
24
|
-
end
|
22
|
+
return false if matcher.name.include? 'Asciidoctor'
|
23
|
+
|
25
24
|
matcher
|
26
25
|
end
|
27
26
|
end
|
@@ -141,9 +140,9 @@ module Awestruct
|
|
141
140
|
rescue Exception => e
|
142
141
|
error_page = context[:page]
|
143
142
|
if error_page[:__is_layout] == true
|
144
|
-
|
143
|
+
ExceptionHelper.log_message "An error during rendering layout file #{File.join site.dir, error_page.source_path} occurred."
|
145
144
|
else
|
146
|
-
|
145
|
+
ExceptionHelper.log_message "An error during rendering #{File.join site.dir, error_page.source_path} occurred."
|
147
146
|
end
|
148
147
|
ExceptionHelper.log_message "Please see #{File.join site.dir, error_page.output_path} for more information"
|
149
148
|
return ExceptionHelper.html_error_report e, error_page.source_path
|
data/lib/awestruct/version.rb
CHANGED
@@ -106,6 +106,7 @@ describe Awestruct::Handlers::TiltHandler do
|
|
106
106
|
context 'when loading an engine not installed' do
|
107
107
|
specify 'should not throw exceptions; instead have the error in the rendered output' do
|
108
108
|
# setup
|
109
|
+
Awestruct::Engine.instance.config.verbose = true
|
109
110
|
Tilt::register Tilt::BogusTemplate, '.bogus',
|
110
111
|
log = StringIO.new
|
111
112
|
$LOG = Logger.new(log)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awestruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob McWhirter
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-
|
16
|
+
date: 2014-09-26 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: haml
|
@@ -147,14 +147,14 @@ dependencies:
|
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: 1.
|
150
|
+
version: 1.7.2
|
151
151
|
type: :runtime
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: 1.
|
157
|
+
version: 1.7.2
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: ruby-s3cmd
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,6 +239,20 @@ dependencies:
|
|
239
239
|
- - "~>"
|
240
240
|
- !ruby/object:Gem::Version
|
241
241
|
version: 0.7.1
|
242
|
+
- !ruby/object:Gem::Dependency
|
243
|
+
name: parallel
|
244
|
+
requirement: !ruby/object:Gem::Requirement
|
245
|
+
requirements:
|
246
|
+
- - ">"
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: 1.1.1
|
249
|
+
type: :runtime
|
250
|
+
prerelease: false
|
251
|
+
version_requirements: !ruby/object:Gem::Requirement
|
252
|
+
requirements:
|
253
|
+
- - ">"
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
version: 1.1.1
|
242
256
|
description: Awestruct is a static site baking and publishing tool. It supports an
|
243
257
|
extensive list of both templating and markup languages via Tilt (Haml, Slim, AsciiDoc,
|
244
258
|
Markdown, Sass via Compass, etc), provides mobile-first layout and styling via Bootstrap
|
@@ -512,9 +526,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
512
526
|
version: '0'
|
513
527
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
514
528
|
requirements:
|
515
|
-
- - "
|
529
|
+
- - ">"
|
516
530
|
- !ruby/object:Gem::Version
|
517
|
-
version:
|
531
|
+
version: 1.3.1
|
518
532
|
requirements:
|
519
533
|
- |
|
520
534
|
Any markup languages you are using and its dependencies.
|