awestruct 0.5.0.cr → 0.5.0
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/lib/awestruct/cli/init.rb +2 -1
- data/lib/awestruct/cli/manifest.rb +5 -3
- data/lib/awestruct/config/default-site.yml +2 -0
- data/lib/awestruct/dependencies.rb +7 -1
- data/lib/awestruct/engine.rb +23 -3
- data/lib/awestruct/extensions/pipeline.rb +3 -1
- data/lib/awestruct/extensions/posts.rb +1 -1
- data/lib/awestruct/handlers/asciidoctor_handler.rb +6 -0
- data/lib/awestruct/handlers/base_tilt_handler.rb +2 -2
- data/lib/awestruct/handlers/front_matter_handler.rb +4 -1
- data/lib/awestruct/handlers/redirect_handler.rb +6 -1
- data/lib/awestruct/page.rb +1 -1
- data/lib/awestruct/rack/app.rb +2 -2
- data/lib/awestruct/version.rb +1 -1
- data/spec/engine_spec.rb +31 -15
- data/spec/file_handler_spec.rb +2 -2
- data/spec/front_matter_handler_spec.rb +2 -1
- data/spec/handler_chain_spec.rb +2 -3
- data/spec/interpolation_handler_spec.rb +4 -4
- data/spec/layout_handler_spec.rb +2 -2
- data/spec/layouts_spec.rb +2 -2
- data/spec/page_delegating_handler_spec.rb +2 -1
- data/spec/page_spec.rb +3 -2
- data/spec/posts_archive_spec.rb +4 -4
- data/spec/redirect_handler_spec.rb +4 -4
- data/spec/server_spec.rb +9 -0
- data/spec/support/shared_handler_example.rb +2 -2
- data/spec/test-data/engine/_config/site.yml +9 -2
- data/spec/test-data/handlers/redirect-page.redirect +1 -1
- data/spec/test-data/subdir/index.html +10 -0
- data/spec/tilt_handler_spec.rb +14 -16
- data/spec/yaml_handler_spec.rb +2 -2
- metadata +33 -13
data/lib/awestruct/cli/init.rb
CHANGED
@@ -10,8 +10,9 @@ module Awestruct
|
|
10
10
|
mkdir( '_layouts' )
|
11
11
|
mkdir( '_ext' )
|
12
12
|
copy_file( '_ext/pipeline.rb', File.join( File.dirname(__FILE__), '/../frameworks/base_pipeline.rb' ) )
|
13
|
+
copy_file( '.awestruct_ignore', File.join( File.dirname(__FILE__), '/../frameworks/base_awestruct_ignore' ) )
|
14
|
+
copy_file( 'Rakefile', File.join( File.dirname(__FILE__), '/../frameworks/base_Rakefile' ) )
|
13
15
|
mkdir( 'stylesheets' )
|
14
|
-
touch_file( '.awestruct_ignore' )
|
15
16
|
}
|
16
17
|
|
17
18
|
def initialize(dir=Dir.pwd,framework='compass',scaffold=true)
|
@@ -20,13 +20,15 @@ class Compass::AppIntegration::StandAlone::Installer
|
|
20
20
|
|
21
21
|
Now you're awestruct!
|
22
22
|
|
23
|
-
To generate your site
|
23
|
+
To generate and run your site in development mode, execute:
|
24
24
|
|
25
25
|
awestruct -d
|
26
26
|
|
27
|
-
|
27
|
+
or, simply:
|
28
28
|
|
29
|
-
|
29
|
+
rake
|
30
|
+
|
31
|
+
then visit your site at: http://localhost:4242
|
30
32
|
|
31
33
|
END
|
32
34
|
end
|
@@ -139,7 +139,13 @@ module Awestruct
|
|
139
139
|
|
140
140
|
def clear
|
141
141
|
@dependencies.clear
|
142
|
-
@dependents.each
|
142
|
+
@dependents.each do |d|
|
143
|
+
if (d.instance_of? Awestruct::Dependencies)
|
144
|
+
d.remove_dependent( page )
|
145
|
+
else
|
146
|
+
d.dependencies.remove_dependent( page )
|
147
|
+
end
|
148
|
+
end
|
143
149
|
end
|
144
150
|
|
145
151
|
def persist!
|
data/lib/awestruct/engine.rb
CHANGED
@@ -148,18 +148,19 @@ module Awestruct
|
|
148
148
|
|
149
149
|
def merge_data(existing, new)
|
150
150
|
if existing.kind_of? Hash
|
151
|
-
existing.inject({}) do |merged, (k,v)|
|
151
|
+
result = existing.inject({}) do |merged, (k,v)|
|
152
152
|
if new.has_key? k
|
153
153
|
if v.kind_of? Hash
|
154
|
-
merged[k] = v
|
154
|
+
merged[k] = merge_data(v, new.delete(k))
|
155
155
|
else
|
156
|
-
merged[k] = new
|
156
|
+
merged[k] = new.delete(k)
|
157
157
|
end
|
158
158
|
else
|
159
159
|
merged[k] = v
|
160
160
|
end
|
161
161
|
merged
|
162
162
|
end
|
163
|
+
result.merge new
|
163
164
|
else
|
164
165
|
new
|
165
166
|
end
|
@@ -244,6 +245,25 @@ module Awestruct
|
|
244
245
|
Compass.configuration.fonts_dir = 'fonts'
|
245
246
|
Compass.configuration.line_comments = include_line_comments?
|
246
247
|
Compass.configuration.output_style = compress_css?
|
248
|
+
|
249
|
+
# port old style configuration to new Tilt-based configuration
|
250
|
+
# TODO consider deprecating the old config mechanism and move to default-site.yml
|
251
|
+
[:scss, :sass].each do |sass_ext|
|
252
|
+
if !site.key? sass_ext
|
253
|
+
sass_config = {}
|
254
|
+
site[sass_ext] = sass_config
|
255
|
+
else
|
256
|
+
sass_config = site[sass_ext]
|
257
|
+
end
|
258
|
+
|
259
|
+
if !sass_config.has_key?(:line_numbers) || site.profile.eql?('production')
|
260
|
+
sass_config[:line_numbers] = Compass.configuration.line_comments
|
261
|
+
end
|
262
|
+
|
263
|
+
if !sass_config.has_key?(:style) || site.profile.eql?('production')
|
264
|
+
sass_config[:style] = Compass.configuration.output_style
|
265
|
+
end
|
266
|
+
end
|
247
267
|
end
|
248
268
|
|
249
269
|
def include_line_comments?
|
@@ -3,7 +3,9 @@ Dir[ File.join( File.dirname(__FILE__), '*.rb' ) ].each do |f|
|
|
3
3
|
begin
|
4
4
|
require f
|
5
5
|
rescue LoadError => e
|
6
|
-
puts "WARNING: Missing required dependency to activate optional built in extension #{File.basename(f)}
|
6
|
+
puts "WARNING: Missing required dependency to activate optional built in extension #{File.basename(f)}\n #{e}"
|
7
|
+
rescue StandardError => e
|
8
|
+
puts "WARNING: Missing runtime configuration to activate optional built in extension #{File.basename(f)}\n #{e}"
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
@@ -55,6 +55,9 @@ module Awestruct
|
|
55
55
|
hash[k.to_s] = v if not k.to_s.start_with?('__') and types.detect { |t| v.kind_of? t }
|
56
56
|
hash
|
57
57
|
end)
|
58
|
+
if with_layouts && !context.page.layout
|
59
|
+
@front_matter['header_footer'] = true
|
60
|
+
end
|
58
61
|
super
|
59
62
|
end
|
60
63
|
|
@@ -67,6 +70,9 @@ module Awestruct
|
|
67
70
|
end
|
68
71
|
opts[:attributes]['awestruct'] = true
|
69
72
|
opts[:attributes]['awestruct-version'] = Awestruct::VERSION
|
73
|
+
if @front_matter['header_footer']
|
74
|
+
opts[:header_footer] = true
|
75
|
+
end
|
70
76
|
opts
|
71
77
|
end
|
72
78
|
|
@@ -55,9 +55,9 @@ module Awestruct
|
|
55
55
|
def content_syntax
|
56
56
|
# Check configuration for override, else convert extension to sym
|
57
57
|
extension = input_extension[1..-1]
|
58
|
-
if !site[:content_syntax].nil?
|
58
|
+
if ( !site[:content_syntax].nil? && !site[:content_syntax].empty?)
|
59
59
|
syntax = site[:content_syntax][extension]
|
60
|
-
return syntax.to_sym unless syntax.nil?
|
60
|
+
return syntax.to_sym unless syntax.nil? or syntax.empty?
|
61
61
|
end
|
62
62
|
|
63
63
|
return extension.to_sym
|
@@ -42,7 +42,10 @@ module Awestruct
|
|
42
42
|
return if ( @parsed_parts && ! delegate.stale? )
|
43
43
|
|
44
44
|
full_content = delegate.raw_content
|
45
|
-
|
45
|
+
|
46
|
+
#if force_encoding is supported then set to charset defined in site config
|
47
|
+
full_content.force_encoding(site.encoding) if (full_content.respond_to?(:force_encoding) && site.encoding)
|
48
|
+
|
46
49
|
yaml_content = ''
|
47
50
|
|
48
51
|
dash_lines = 0
|
@@ -38,7 +38,12 @@ module Awestruct
|
|
38
38
|
|
39
39
|
def rendered_content(context, with_layouts=false)
|
40
40
|
url = delegate.rendered_content( context, with_layouts ).strip
|
41
|
-
|
41
|
+
# should we auto-qualify the URL?
|
42
|
+
# they can use #{site.base_url}/path currently
|
43
|
+
#if url.start_with? '/'
|
44
|
+
# url = File.join(@site.base_url, url)
|
45
|
+
#end
|
46
|
+
%{<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;url=#{url}"></head></html>}
|
42
47
|
end
|
43
48
|
|
44
49
|
end
|
data/lib/awestruct/page.rb
CHANGED
@@ -146,7 +146,7 @@ module Awestruct
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
lineinfo = lineno ? " at line #{lineno}" : ''
|
149
|
-
raise StandardError,
|
149
|
+
raise StandardError, "ERROR: Failed to render: #{self.relative_source_path}#{lineinfo}\n#{e.class}: #{e.message.rstrip}\n" + e.backtrace.join("\n")
|
150
150
|
end
|
151
151
|
|
152
152
|
if context.site.config.track_dependencies
|
data/lib/awestruct/rack/app.rb
CHANGED
@@ -14,8 +14,8 @@ module Awestruct
|
|
14
14
|
if ( File.directory?( fs_path ) )
|
15
15
|
if ( ! ( path =~ %r(/$) ) )
|
16
16
|
return [ 301,
|
17
|
-
{
|
18
|
-
"Redirecting to: #{path}" ]
|
17
|
+
{ 'location'=>File.join(path, '') },
|
18
|
+
["Redirecting to: #{path}"] ]
|
19
19
|
elsif ( File.exist?( File.join( fs_path, 'index.html' ) ) )
|
20
20
|
fs_path = File.join( fs_path, 'index.html' )
|
21
21
|
end
|
data/lib/awestruct/version.rb
CHANGED
data/spec/engine_spec.rb
CHANGED
@@ -12,6 +12,8 @@ describe Awestruct::Engine do
|
|
12
12
|
engine.load_default_site_yaml
|
13
13
|
|
14
14
|
engine.site.asciidoctor.backend.should == 'html5'
|
15
|
+
engine.site.asciidoctor.safe.should == 1
|
16
|
+
engine.site.asciidoctor.attributes['imagesdir'].should == '/images'
|
15
17
|
end
|
16
18
|
|
17
19
|
it "should be able to override default with site" do
|
@@ -21,21 +23,28 @@ describe Awestruct::Engine do
|
|
21
23
|
engine.load_default_site_yaml
|
22
24
|
engine.load_site_yaml( 'development' )
|
23
25
|
|
24
|
-
engine.site.asciidoctor.
|
26
|
+
engine.site.asciidoctor.safe.should == 0
|
27
|
+
engine.site.asciidoctor.eruby.should == 'erubis'
|
28
|
+
engine.site.asciidoctor.attributes['imagesdir'].should == '/assets/images'
|
29
|
+
engine.site.asciidoctor.attributes['idprefix'].should == ''
|
25
30
|
end
|
26
31
|
|
27
32
|
it "should be able to load site.yml with the correct profile" do
|
28
33
|
config = Awestruct::Config.new( File.dirname(__FILE__) + '/test-data/engine' )
|
29
34
|
|
30
35
|
engine = Awestruct::Engine.new(config)
|
36
|
+
engine.load_default_site_yaml
|
31
37
|
engine.load_site_yaml( 'development' )
|
32
38
|
engine.site.cook.should == 'microwave'
|
33
39
|
engine.site.title.should == 'Awestruction!'
|
34
40
|
|
35
41
|
engine = Awestruct::Engine.new(config)
|
42
|
+
engine.load_default_site_yaml
|
36
43
|
engine.load_site_yaml( 'production' )
|
37
44
|
engine.site.cook.should == 'oven'
|
38
45
|
engine.site.title.should == 'Awestruction!'
|
46
|
+
engine.site.asciidoctor.eruby.should == 'erb'
|
47
|
+
engine.site.asciidoctor.attributes['imagesdir'].should == '/img'
|
39
48
|
end
|
40
49
|
|
41
50
|
it "should be able to load arbitrary _config/*.yml files" do
|
@@ -56,26 +65,21 @@ describe Awestruct::Engine do
|
|
56
65
|
engine.site.other.tags.should == [ 'a', 'b', 'c' ]
|
57
66
|
end
|
58
67
|
|
59
|
-
it "should exclude line comments in compass by default in production mode" do
|
60
|
-
compass = compass_config
|
61
|
-
config = Awestruct::Config.new( File.dirname(__FILE__) + '/test-data/engine' )
|
62
|
-
engine = Awestruct::Engine.new(config)
|
63
|
-
engine.load_site_yaml( 'production' )
|
64
|
-
Compass.stub(:configuration).and_return(compass)
|
65
|
-
compass.should_receive(:line_comments=).with(false)
|
66
|
-
compass.should_receive(:output_style=).with(:compressed)
|
67
|
-
engine.configure_compass
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should exclude minify in compass by default in production mode" do
|
68
|
+
it "should exclude line comments and minify in compass by default in production mode" do
|
71
69
|
compass = compass_config
|
72
70
|
config = Awestruct::Config.new( File.dirname(__FILE__) + '/test-data/engine' )
|
73
71
|
engine = Awestruct::Engine.new(config)
|
74
72
|
engine.load_site_yaml( 'production' )
|
75
73
|
Compass.stub(:configuration).and_return(compass)
|
76
74
|
compass.should_receive(:line_comments=).with(false)
|
75
|
+
compass.stub(:line_comments).and_return(false)
|
77
76
|
compass.should_receive(:output_style=).with(:compressed)
|
77
|
+
compass.stub(:output_style).and_return(:compressed)
|
78
78
|
engine.configure_compass
|
79
|
+
engine.site.sass.line_numbers.should == false
|
80
|
+
engine.site.sass.style.should == :compressed
|
81
|
+
engine.site.scss.line_numbers.should == false
|
82
|
+
engine.site.scss.style.should == :compressed
|
79
83
|
end
|
80
84
|
|
81
85
|
it "should include line comments in compass by default in development mode" do
|
@@ -85,19 +89,31 @@ describe Awestruct::Engine do
|
|
85
89
|
engine.load_site_yaml( 'development' )
|
86
90
|
Compass.stub(:configuration).and_return(compass)
|
87
91
|
compass.should_receive(:line_comments=).with(true)
|
92
|
+
compass.stub(:line_comments).and_return(true)
|
88
93
|
compass.should_receive(:output_style=).with(:expanded)
|
94
|
+
compass.stub(:output_style).and_return(:expanded)
|
89
95
|
engine.configure_compass
|
96
|
+
engine.site.sass.line_numbers.should == true
|
97
|
+
engine.site.sass.style.should == :expanded
|
98
|
+
engine.site.scss.line_numbers.should == true
|
99
|
+
engine.site.scss.style.should == :expanded
|
90
100
|
end
|
91
101
|
|
92
|
-
it "should accept site.compass_line_comments to configure behavior" do
|
102
|
+
it "wip should accept site.compass_line_comments and site.compass_output_style to configure behavior" do
|
93
103
|
compass = compass_config
|
94
104
|
config = Awestruct::Config.new( File.dirname(__FILE__) + '/test-data/engine' )
|
95
105
|
engine = Awestruct::Engine.new(config)
|
96
106
|
engine.load_site_yaml( 'staging' )
|
97
107
|
Compass.stub(:configuration).and_return(compass)
|
98
108
|
compass.should_receive(:line_comments=).with(false)
|
99
|
-
compass.
|
109
|
+
compass.stub(:line_comments).and_return(false)
|
110
|
+
compass.should_receive(:output_style=).with(:compact)
|
111
|
+
compass.stub(:output_style).and_return(:compact)
|
100
112
|
engine.configure_compass
|
113
|
+
engine.site.sass.line_numbers.should == false
|
114
|
+
engine.site.sass.style.should == :compact
|
115
|
+
engine.site.scss.line_numbers.should == false
|
116
|
+
engine.site.scss.style.should == :compact
|
101
117
|
end
|
102
118
|
|
103
119
|
end
|
data/spec/file_handler_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'fileutils'
|
2
|
-
|
2
|
+
require 'hashery'
|
3
3
|
require 'awestruct/handlers/file_handler'
|
4
4
|
|
5
5
|
describe Awestruct::Handlers::FileHandler do
|
6
6
|
|
7
7
|
before :all do
|
8
|
-
@site = OpenCascade
|
8
|
+
@site = Hashery::OpenCascade[ { :encoding=>false, :dir=>Pathname.new( File.dirname( __FILE__ ) + '/test-data' ) } ]
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should be able to read a valid absolute file handler" do
|
@@ -2,11 +2,12 @@ require 'fileutils'
|
|
2
2
|
|
3
3
|
require 'awestruct/handlers/file_handler'
|
4
4
|
require 'awestruct/handlers/front_matter_handler'
|
5
|
+
require 'hashery'
|
5
6
|
|
6
7
|
describe Awestruct::Handlers::FrontMatterHandler do
|
7
8
|
|
8
9
|
before :all do
|
9
|
-
@site = OpenCascade
|
10
|
+
@site = Hashery::OpenCascade[ { :encoding=>false } ]
|
10
11
|
end
|
11
12
|
|
12
13
|
before :each do
|
data/spec/handler_chain_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'awestruct/handler_chain'
|
3
|
-
|
4
|
-
require 'hashery/open_cascade'
|
3
|
+
require 'hashery'
|
5
4
|
|
6
5
|
describe Awestruct::HandlerChain do
|
7
6
|
|
@@ -18,7 +17,7 @@ describe Awestruct::HandlerChain do
|
|
18
17
|
|
19
18
|
|
20
19
|
before :all do
|
21
|
-
@site = OpenCascade
|
20
|
+
@site = Hashery::OpenCascade[ { :encoding => false } ]
|
22
21
|
end
|
23
22
|
|
24
23
|
it "should use a regexp to match" do
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require 'hashery
|
1
|
+
require 'hashery'
|
2
2
|
require 'awestruct/handlers/string_handler'
|
3
3
|
require 'awestruct/handlers/interpolation_handler'
|
4
4
|
|
5
5
|
describe Awestruct::Handlers::InterpolationHandler do
|
6
6
|
|
7
7
|
before :all do
|
8
|
-
@site = OpenCascade
|
8
|
+
@site = Hashery::OpenCascade[ { :encoding=>false } ]
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should interpolate content when rendered" do
|
12
12
|
handler = build_handler( 'This is #{cheese}' )
|
13
13
|
|
14
|
-
context = OpenCascade
|
14
|
+
context = Hashery::OpenCascade[ { :cheese=>'swiss' } ]
|
15
15
|
content = handler.rendered_content( context )
|
16
16
|
content.should == 'This is swiss'
|
17
17
|
end
|
@@ -20,7 +20,7 @@ describe Awestruct::Handlers::InterpolationHandler do
|
|
20
20
|
if RUBY_VERSION >= '1.9'
|
21
21
|
input = %q(url = url.replace(/\/?#$/, '');)
|
22
22
|
handler = build_handler( input )
|
23
|
-
content = handler.rendered_content( OpenCascade
|
23
|
+
content = handler.rendered_content( Hashery::OpenCascade[] )
|
24
24
|
content.should == input
|
25
25
|
else
|
26
26
|
pending "Cannot yet handle this test case with ruby 1.8"
|
data/spec/layout_handler_spec.rb
CHANGED
@@ -7,14 +7,14 @@ require 'awestruct/site'
|
|
7
7
|
require 'awestruct/page'
|
8
8
|
require 'awestruct/page_loader'
|
9
9
|
|
10
|
-
require 'hashery
|
10
|
+
require 'hashery'
|
11
11
|
require 'ostruct'
|
12
12
|
|
13
13
|
describe Awestruct::Handlers::LayoutHandler do
|
14
14
|
|
15
15
|
|
16
16
|
before :all do
|
17
|
-
@config = OpenCascade
|
17
|
+
@config = Hashery::OpenCascade[ { :dir=>Pathname.new( File.dirname(__FILE__) + '/test-data/handlers' ) } ]
|
18
18
|
@engine = Awestruct::Engine.new
|
19
19
|
@site = Awestruct::Site.new( @engine, @config )
|
20
20
|
layout_loader = Awestruct::PageLoader.new( @site, :layouts )
|
data/spec/layouts_spec.rb
CHANGED
@@ -4,13 +4,13 @@ require 'awestruct/page'
|
|
4
4
|
require 'awestruct/handlers/file_handler'
|
5
5
|
require 'awestruct/handlers/tilt_handler'
|
6
6
|
|
7
|
-
require 'hashery
|
7
|
+
require 'hashery'
|
8
8
|
|
9
9
|
describe Awestruct::Layouts do
|
10
10
|
|
11
11
|
it "should be able to index layouts by simple name and output extension" do
|
12
12
|
dir = Pathname.new( File.dirname( __FILE__ ) + '/test-data/handlers' )
|
13
|
-
site = OpenCascade
|
13
|
+
site = Hashery::OpenCascade[ { :dir=>dir } ]
|
14
14
|
file_handler = Awestruct::Handlers::FileHandler.new( site, File.join( dir, 'haml-layout.html.haml' ) )
|
15
15
|
haml_handler = Awestruct::Handlers::TiltHandler.new( site, file_handler )
|
16
16
|
page = Awestruct::Page.new( nil, haml_handler )
|
@@ -3,11 +3,12 @@ require 'awestruct/engine'
|
|
3
3
|
require 'awestruct/site'
|
4
4
|
require 'awestruct/page'
|
5
5
|
require 'awestruct/handlers/page_delegating_handler'
|
6
|
+
require 'hashery'
|
6
7
|
|
7
8
|
describe Awestruct::Handlers::PageDelegatingHandler do
|
8
9
|
|
9
10
|
before :all do
|
10
|
-
@config = OpenCascade
|
11
|
+
@config = Hashery::OpenCascade[ { :dir=>Pathname.new( File.dirname(__FILE__) + '/test-data/handlers' ) } ]
|
11
12
|
@engine = Awestruct::Engine.new( @config )
|
12
13
|
@site = @engine.site
|
13
14
|
layout_loader = Awestruct::PageLoader.new( @site, :layouts )
|
data/spec/page_spec.rb
CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
|
|
4
4
|
require 'awestruct/page'
|
5
5
|
require 'awestruct/pipeline'
|
6
6
|
require 'awestruct/handlers/file_handler'
|
7
|
+
require 'hashery'
|
7
8
|
|
8
9
|
describe Awestruct::Handlers::FileHandler do
|
9
10
|
|
@@ -14,8 +15,8 @@ describe Awestruct::Handlers::FileHandler do
|
|
14
15
|
end
|
15
16
|
|
16
17
|
before :all do
|
17
|
-
@site = OpenCascade
|
18
|
-
@site.engine = OpenCascade
|
18
|
+
@site = Hashery::OpenCascade[ { :encoding=>false } ]
|
19
|
+
@site.engine = Hashery::OpenCascade[]
|
19
20
|
end
|
20
21
|
|
21
22
|
before :each do
|
data/spec/posts_archive_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'awestruct/extensions/posts'
|
2
2
|
require 'awestruct/util/inflector'
|
3
|
-
require 'hashery
|
3
|
+
require 'hashery'
|
4
4
|
|
5
5
|
describe Awestruct::Extensions::Posts do
|
6
6
|
|
@@ -14,9 +14,9 @@ describe Awestruct::Extensions::Posts do
|
|
14
14
|
extension.assign_to.should == :posts
|
15
15
|
end
|
16
16
|
|
17
|
-
it "should have
|
17
|
+
it "should have 'posts' as a layout by default" do
|
18
18
|
extension = Awestruct::Extensions::Posts.new('/posts', :posts)
|
19
|
-
extension.
|
19
|
+
extension.default_layout.should eql 'posts'
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should have a nil archive template by default" do
|
@@ -53,7 +53,7 @@ describe Awestruct::Extensions::Posts do
|
|
53
53
|
|
54
54
|
it "should assign default layout if specified to post without layout" do
|
55
55
|
extension = Awestruct::Extensions::Posts.new( '/posts', :news, nil, nil, :default_layout => 'post' )
|
56
|
-
site = OpenCascade
|
56
|
+
site = Hashery::OpenCascade[ { :encoding=>false } ]
|
57
57
|
page = __create_page( 2012, 8, 9, '/posts/mock-post.md' )
|
58
58
|
page.stub(:layout).and_return(nil)
|
59
59
|
page.should_receive(:layout=).with('post')
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
verify = lambda { |output|
|
4
|
-
output.should =~ %r(
|
4
|
+
output.should =~ %r(<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;url=http://google.com"></head></html>)
|
5
5
|
}
|
6
6
|
verify_with_interpol = lambda { |output|
|
7
|
-
output.should =~ %r(
|
7
|
+
output.should =~ %r(<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;url=http://mysite/bacon/"></head></html>)
|
8
8
|
}
|
9
9
|
|
10
10
|
theories =
|
@@ -26,7 +26,7 @@ theories =
|
|
26
26
|
]
|
27
27
|
|
28
28
|
describe Awestruct::Handlers::TiltHandler.to_s + "-Redirect" do
|
29
|
-
let(:additional_config) { {:interpolate => true, :crunchy =>
|
29
|
+
let(:additional_config) { {:interpolate => true, :crunchy => 'bacon', :base_url => 'http://mysite' } }
|
30
30
|
it_should_behave_like "a handler", theories
|
31
31
|
|
32
|
-
end
|
32
|
+
end
|
data/spec/server_spec.rb
CHANGED
@@ -15,6 +15,15 @@ describe Awestruct::Rack::App do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
describe "Directory redirect" do
|
19
|
+
it "should redirect to /" do
|
20
|
+
get('/subdir')
|
21
|
+
last_response.headers['location'].should == '/subdir/'
|
22
|
+
last_response.instance_variable_get('@body').should == ['Redirecting to: /subdir']
|
23
|
+
last_response.body.should == 'Redirecting to: /subdir'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
18
27
|
describe "CSS media type" do
|
19
28
|
it "should return text/css" do
|
20
29
|
get('/stylesheets/screen.css')
|
@@ -2,7 +2,7 @@ require 'awestruct/engine'
|
|
2
2
|
require 'awestruct/config'
|
3
3
|
require 'rspec'
|
4
4
|
|
5
|
-
require 'hashery
|
5
|
+
require 'hashery'
|
6
6
|
|
7
7
|
REQUIRED_VARIABLES = [:page, :simple_name, :syntax, :extension]
|
8
8
|
ALL_VARIABLES = REQUIRED_VARIABLES + [:format, :matcher, :unless]
|
@@ -14,7 +14,7 @@ shared_examples "a handler" do |theories|
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_context
|
17
|
-
OpenCascade
|
17
|
+
Hashery::OpenCascade[ { :site=>@site } ]
|
18
18
|
end
|
19
19
|
|
20
20
|
describe Awestruct::Handlers do
|
@@ -1,14 +1,21 @@
|
|
1
|
-
|
2
1
|
profiles:
|
3
2
|
development:
|
4
3
|
cook: microwave
|
5
4
|
production:
|
6
5
|
cook: oven
|
6
|
+
asciidoctor:
|
7
|
+
:eruby: erb
|
8
|
+
:attributes:
|
9
|
+
imagesdir: /img
|
7
10
|
staging:
|
8
11
|
compass_line_comments: off
|
12
|
+
compass_output_style: :compact
|
9
13
|
|
10
14
|
title: Awestruction!
|
11
15
|
|
12
16
|
asciidoctor:
|
17
|
+
:safe: 0
|
18
|
+
:eruby: erubis
|
13
19
|
:attributes:
|
14
|
-
|
20
|
+
imagesdir: /assets/images
|
21
|
+
idprefix: ''
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
#{site.base_url}/#{site.crunchy}/
|
data/spec/tilt_handler_spec.rb
CHANGED
@@ -3,16 +3,14 @@ require 'awestruct/config'
|
|
3
3
|
require 'awestruct/handlers/file_handler'
|
4
4
|
require 'awestruct/handlers/tilt_handler'
|
5
5
|
|
6
|
-
require 'hashery
|
6
|
+
require 'hashery'
|
7
7
|
|
8
8
|
describe Awestruct::Handlers::TiltHandler do
|
9
9
|
|
10
10
|
before do
|
11
11
|
dir = Pathname.new( File.dirname(__FILE__) + '/test-data/handlers' )
|
12
12
|
|
13
|
-
@site = OpenCascade
|
14
|
-
:dir=>dir,
|
15
|
-
:config=>Awestruct::Config.new( dir )
|
13
|
+
@site = Hashery::OpenCascade[ { :encoding=>false, :dir=>dir, :config=>Awestruct::Config.new( dir ) } ]
|
16
14
|
end
|
17
15
|
|
18
16
|
def handler_file(path)
|
@@ -20,7 +18,7 @@ describe Awestruct::Handlers::TiltHandler do
|
|
20
18
|
end
|
21
19
|
|
22
20
|
def create_context
|
23
|
-
OpenCascade
|
21
|
+
Hashery::OpenCascade[ { :site=>@site } ]
|
24
22
|
end
|
25
23
|
|
26
24
|
it "should provide default configuration options from site based on output_extension" do
|
@@ -57,12 +55,12 @@ describe Awestruct::Handlers::TiltHandler do
|
|
57
55
|
file_handler = Awestruct::Handlers::FileHandler.new( @site, handler_file( "asciidoc-page.asciidoc" ) )
|
58
56
|
handler = Awestruct::Handlers::TiltHandler.new( @site, file_handler )
|
59
57
|
|
60
|
-
handler.relative_source_path.should be_nil
|
61
|
-
handler.simple_name.should
|
62
|
-
handler.content_syntax.should
|
63
|
-
handler.output_extension.should
|
64
|
-
handler.input_extension.should
|
65
|
-
handler.output_filename.should
|
58
|
+
handler.relative_source_path.should be_nil
|
59
|
+
handler.simple_name.should eql 'asciidoc-page'
|
60
|
+
handler.content_syntax.should eql :asciidoc
|
61
|
+
handler.output_extension.should eql '.html'
|
62
|
+
handler.input_extension.should eql '.asciidoc'
|
63
|
+
handler.output_filename.should eql 'asciidoc-page.html'
|
66
64
|
end
|
67
65
|
|
68
66
|
it "should handle non extension dots in source name" do
|
@@ -71,11 +69,11 @@ describe Awestruct::Handlers::TiltHandler do
|
|
71
69
|
handler = Awestruct::Handlers::TiltHandler.new( @site, file_handler )
|
72
70
|
|
73
71
|
handler.relative_source_path.should be_nil
|
74
|
-
handler.simple_name.should
|
75
|
-
handler.content_syntax.should
|
76
|
-
handler.output_extension.should
|
77
|
-
handler.input_extension.should
|
78
|
-
handler.output_filename.should
|
72
|
+
handler.simple_name.should eql 'warp-1.0.0.Alpha2'
|
73
|
+
handler.content_syntax.should eql :textile
|
74
|
+
handler.output_extension.should eql '.html'
|
75
|
+
handler.input_extension.should eql '.textile'
|
76
|
+
handler.output_filename.should eql 'warp-1.0.0.Alpha2.html'
|
79
77
|
|
80
78
|
end
|
81
79
|
end
|
data/spec/yaml_handler_spec.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
|
-
require 'hashery
|
2
|
+
require 'hashery'
|
3
3
|
require 'awestruct/handlers/file_handler'
|
4
4
|
require 'awestruct/handlers/yaml_handler'
|
5
5
|
|
6
6
|
describe Awestruct::Handlers::YamlHandler do
|
7
7
|
|
8
8
|
before :all do
|
9
|
-
@site = OpenCascade
|
9
|
+
@site = Hashery::OpenCascade[ { :encoding=>false } ]
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should provide access to the yaml as front-matter" do
|
metadata
CHANGED
@@ -1,16 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awestruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bob McWhirter and other contributors
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: haml
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 4.0.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 4.0.1
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: nokogiri
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +50,7 @@ dependencies:
|
|
34
50
|
requirements:
|
35
51
|
- - ~>
|
36
52
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.3.
|
53
|
+
version: 1.3.6
|
38
54
|
type: :runtime
|
39
55
|
prerelease: false
|
40
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +58,7 @@ dependencies:
|
|
42
58
|
requirements:
|
43
59
|
- - ~>
|
44
60
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.3.
|
61
|
+
version: 1.3.6
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: compass
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +98,7 @@ dependencies:
|
|
82
98
|
requirements:
|
83
99
|
- - ~>
|
84
100
|
- !ruby/object:Gem::Version
|
85
|
-
version: 2.3.0
|
101
|
+
version: 2.3.1.0
|
86
102
|
type: :runtime
|
87
103
|
prerelease: false
|
88
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +106,7 @@ dependencies:
|
|
90
106
|
requirements:
|
91
107
|
- - ~>
|
92
108
|
- !ruby/object:Gem::Version
|
93
|
-
version: 2.3.0
|
109
|
+
version: 2.3.1.0
|
94
110
|
- !ruby/object:Gem::Dependency
|
95
111
|
name: json
|
96
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +178,7 @@ dependencies:
|
|
162
178
|
requirements:
|
163
179
|
- - ~>
|
164
180
|
- !ruby/object:Gem::Version
|
165
|
-
version: 0.
|
181
|
+
version: 0.7.3
|
166
182
|
type: :runtime
|
167
183
|
prerelease: false
|
168
184
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,7 +186,7 @@ dependencies:
|
|
170
186
|
requirements:
|
171
187
|
- - ~>
|
172
188
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
189
|
+
version: 0.7.3
|
174
190
|
- !ruby/object:Gem::Dependency
|
175
191
|
name: rack
|
176
192
|
requirement: !ruby/object:Gem::Requirement
|
@@ -307,6 +323,7 @@ files:
|
|
307
323
|
- spec/test-data/front-matter-file-no-front.txt
|
308
324
|
- spec/test-data/stylesheets/screen.css
|
309
325
|
- spec/test-data/out-of-site/page-three.html.haml
|
326
|
+
- spec/test-data/subdir/index.html
|
310
327
|
- spec/test-data/handlers/scss-page-include.scss
|
311
328
|
- spec/test-data/handlers/haml-layout-two.html.haml
|
312
329
|
- spec/test-data/handlers/haml-page.xml.haml
|
@@ -401,15 +418,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
401
418
|
version: '0'
|
402
419
|
segments:
|
403
420
|
- 0
|
404
|
-
hash:
|
421
|
+
hash: 1113133206677710409
|
405
422
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
406
423
|
none: false
|
407
424
|
requirements:
|
408
|
-
- - ! '
|
425
|
+
- - ! '>='
|
409
426
|
- !ruby/object:Gem::Version
|
410
|
-
version:
|
427
|
+
version: '0'
|
428
|
+
segments:
|
429
|
+
- 0
|
430
|
+
hash: 1113133206677710409
|
411
431
|
requirements:
|
412
|
-
- Any markup languages you are using and
|
432
|
+
- Any markup languages you are using and its dependencies
|
413
433
|
- If LESS is used, or some other fixes within tilt, it is required to use Bundler
|
414
434
|
and the :git ref for the tilt gem
|
415
435
|
- Haml and markdown filters are touchy things. Rdiscount works well if you're running
|