nanoc3 3.2.4 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- metadata +14 -313
- data/.gemtest +0 -0
- data/ChangeLog +0 -3
- data/Gemfile +0 -29
- data/LICENSE +0 -19
- data/NEWS.md +0 -449
- data/README.md +0 -108
- data/Rakefile +0 -14
- data/bin/nanoc3 +0 -12
- data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
- data/lib/nanoc3.rb +0 -28
- data/lib/nanoc3/base.rb +0 -49
- data/lib/nanoc3/base/compilation/checksum_store.rb +0 -57
- data/lib/nanoc3/base/compilation/compiled_content_cache.rb +0 -62
- data/lib/nanoc3/base/compilation/compiler.rb +0 -455
- data/lib/nanoc3/base/compilation/compiler_dsl.rb +0 -214
- data/lib/nanoc3/base/compilation/dependency_tracker.rb +0 -196
- data/lib/nanoc3/base/compilation/filter.rb +0 -165
- data/lib/nanoc3/base/compilation/item_rep_proxy.rb +0 -102
- data/lib/nanoc3/base/compilation/item_rep_recorder_proxy.rb +0 -88
- data/lib/nanoc3/base/compilation/outdatedness_checker.rb +0 -223
- data/lib/nanoc3/base/compilation/outdatedness_reasons.rb +0 -46
- data/lib/nanoc3/base/compilation/rule.rb +0 -73
- data/lib/nanoc3/base/compilation/rule_context.rb +0 -84
- data/lib/nanoc3/base/compilation/rule_memory_calculator.rb +0 -40
- data/lib/nanoc3/base/compilation/rule_memory_store.rb +0 -53
- data/lib/nanoc3/base/compilation/rules_collection.rb +0 -231
- data/lib/nanoc3/base/context.rb +0 -47
- data/lib/nanoc3/base/core_ext.rb +0 -6
- data/lib/nanoc3/base/core_ext/array.rb +0 -62
- data/lib/nanoc3/base/core_ext/hash.rb +0 -63
- data/lib/nanoc3/base/core_ext/pathname.rb +0 -26
- data/lib/nanoc3/base/core_ext/string.rb +0 -46
- data/lib/nanoc3/base/directed_graph.rb +0 -275
- data/lib/nanoc3/base/errors.rb +0 -174
- data/lib/nanoc3/base/memoization.rb +0 -67
- data/lib/nanoc3/base/notification_center.rb +0 -84
- data/lib/nanoc3/base/ordered_hash.rb +0 -200
- data/lib/nanoc3/base/plugin_registry.rb +0 -165
- data/lib/nanoc3/base/result_data/item_rep.rb +0 -488
- data/lib/nanoc3/base/source_data/code_snippet.rb +0 -58
- data/lib/nanoc3/base/source_data/configuration.rb +0 -24
- data/lib/nanoc3/base/source_data/data_source.rb +0 -234
- data/lib/nanoc3/base/source_data/item.rb +0 -301
- data/lib/nanoc3/base/source_data/layout.rb +0 -130
- data/lib/nanoc3/base/source_data/site.rb +0 -361
- data/lib/nanoc3/base/store.rb +0 -135
- data/lib/nanoc3/cli.rb +0 -133
- data/lib/nanoc3/cli/command.rb +0 -139
- data/lib/nanoc3/cli/commands/autocompile.rb +0 -60
- data/lib/nanoc3/cli/commands/compile.rb +0 -280
- data/lib/nanoc3/cli/commands/create_item.rb +0 -62
- data/lib/nanoc3/cli/commands/create_layout.rb +0 -75
- data/lib/nanoc3/cli/commands/create_site.rb +0 -410
- data/lib/nanoc3/cli/commands/debug.rb +0 -119
- data/lib/nanoc3/cli/commands/info.rb +0 -98
- data/lib/nanoc3/cli/commands/nanoc.rb +0 -37
- data/lib/nanoc3/cli/commands/update.rb +0 -72
- data/lib/nanoc3/cli/commands/view.rb +0 -84
- data/lib/nanoc3/cli/commands/watch.rb +0 -125
- data/lib/nanoc3/cli/error_handler.rb +0 -193
- data/lib/nanoc3/cli/logger.rb +0 -91
- data/lib/nanoc3/data_sources.rb +0 -29
- data/lib/nanoc3/data_sources/deprecated/delicious.rb +0 -42
- data/lib/nanoc3/data_sources/deprecated/last_fm.rb +0 -87
- data/lib/nanoc3/data_sources/deprecated/twitter.rb +0 -38
- data/lib/nanoc3/data_sources/filesystem.rb +0 -299
- data/lib/nanoc3/data_sources/filesystem_unified.rb +0 -116
- data/lib/nanoc3/data_sources/filesystem_verbose.rb +0 -86
- data/lib/nanoc3/extra.rb +0 -22
- data/lib/nanoc3/extra/auto_compiler.rb +0 -103
- data/lib/nanoc3/extra/chick.rb +0 -125
- data/lib/nanoc3/extra/core_ext.rb +0 -4
- data/lib/nanoc3/extra/core_ext/enumerable.rb +0 -33
- data/lib/nanoc3/extra/core_ext/time.rb +0 -19
- data/lib/nanoc3/extra/deployers.rb +0 -11
- data/lib/nanoc3/extra/deployers/rsync.rb +0 -114
- data/lib/nanoc3/extra/file_proxy.rb +0 -40
- data/lib/nanoc3/extra/validators.rb +0 -12
- data/lib/nanoc3/extra/validators/links.rb +0 -264
- data/lib/nanoc3/extra/validators/w3c.rb +0 -95
- data/lib/nanoc3/extra/vcs.rb +0 -66
- data/lib/nanoc3/extra/vcses.rb +0 -17
- data/lib/nanoc3/extra/vcses/bazaar.rb +0 -25
- data/lib/nanoc3/extra/vcses/dummy.rb +0 -24
- data/lib/nanoc3/extra/vcses/git.rb +0 -25
- data/lib/nanoc3/extra/vcses/mercurial.rb +0 -25
- data/lib/nanoc3/extra/vcses/subversion.rb +0 -25
- data/lib/nanoc3/filters.rb +0 -53
- data/lib/nanoc3/filters/asciidoc.rb +0 -38
- data/lib/nanoc3/filters/bluecloth.rb +0 -19
- data/lib/nanoc3/filters/coderay.rb +0 -21
- data/lib/nanoc3/filters/colorize_syntax.rb +0 -261
- data/lib/nanoc3/filters/erb.rb +0 -35
- data/lib/nanoc3/filters/erubis.rb +0 -27
- data/lib/nanoc3/filters/haml.rb +0 -27
- data/lib/nanoc3/filters/kramdown.rb +0 -20
- data/lib/nanoc3/filters/less.rb +0 -53
- data/lib/nanoc3/filters/markaby.rb +0 -20
- data/lib/nanoc3/filters/maruku.rb +0 -20
- data/lib/nanoc3/filters/mustache.rb +0 -24
- data/lib/nanoc3/filters/rainpress.rb +0 -19
- data/lib/nanoc3/filters/rdiscount.rb +0 -22
- data/lib/nanoc3/filters/rdoc.rb +0 -33
- data/lib/nanoc3/filters/redcarpet.rb +0 -27
- data/lib/nanoc3/filters/redcloth.rb +0 -47
- data/lib/nanoc3/filters/relativize_paths.rb +0 -45
- data/lib/nanoc3/filters/rubypants.rb +0 -20
- data/lib/nanoc3/filters/sass.rb +0 -66
- data/lib/nanoc3/filters/slim.rb +0 -25
- data/lib/nanoc3/filters/typogruby.rb +0 -23
- data/lib/nanoc3/filters/uglify_js.rb +0 -42
- data/lib/nanoc3/helpers.rb +0 -16
- data/lib/nanoc3/helpers/blogging.rb +0 -319
- data/lib/nanoc3/helpers/breadcrumbs.rb +0 -40
- data/lib/nanoc3/helpers/capturing.rb +0 -138
- data/lib/nanoc3/helpers/filtering.rb +0 -50
- data/lib/nanoc3/helpers/html_escape.rb +0 -55
- data/lib/nanoc3/helpers/link_to.rb +0 -151
- data/lib/nanoc3/helpers/rendering.rb +0 -140
- data/lib/nanoc3/helpers/tagging.rb +0 -71
- data/lib/nanoc3/helpers/text.rb +0 -44
- data/lib/nanoc3/helpers/xml_sitemap.rb +0 -76
- data/lib/nanoc3/tasks.rb +0 -10
- data/lib/nanoc3/tasks/clean.rake +0 -16
- data/lib/nanoc3/tasks/clean.rb +0 -29
- data/lib/nanoc3/tasks/deploy/rsync.rake +0 -14
- data/lib/nanoc3/tasks/validate.rake +0 -92
- data/nanoc3.gemspec +0 -49
- data/tasks/doc.rake +0 -16
- data/tasks/test.rake +0 -44
- data/test/base/core_ext/array_spec.rb +0 -73
- data/test/base/core_ext/hash_spec.rb +0 -98
- data/test/base/core_ext/pathname_spec.rb +0 -27
- data/test/base/core_ext/string_spec.rb +0 -37
- data/test/base/test_checksum_store.rb +0 -35
- data/test/base/test_code_snippet.rb +0 -31
- data/test/base/test_compiler.rb +0 -316
- data/test/base/test_compiler_dsl.rb +0 -161
- data/test/base/test_context.rb +0 -31
- data/test/base/test_data_source.rb +0 -46
- data/test/base/test_dependency_tracker.rb +0 -262
- data/test/base/test_directed_graph.rb +0 -283
- data/test/base/test_filter.rb +0 -83
- data/test/base/test_item.rb +0 -179
- data/test/base/test_item_rep.rb +0 -553
- data/test/base/test_layout.rb +0 -59
- data/test/base/test_memoization.rb +0 -90
- data/test/base/test_notification_center.rb +0 -34
- data/test/base/test_outdatedness_checker.rb +0 -394
- data/test/base/test_plugin.rb +0 -30
- data/test/base/test_rule.rb +0 -19
- data/test/base/test_rule_context.rb +0 -65
- data/test/base/test_site.rb +0 -190
- data/test/cli/commands/test_compile.rb +0 -33
- data/test/cli/commands/test_create_item.rb +0 -14
- data/test/cli/commands/test_create_layout.rb +0 -28
- data/test/cli/commands/test_create_site.rb +0 -24
- data/test/cli/commands/test_help.rb +0 -12
- data/test/cli/commands/test_info.rb +0 -11
- data/test/cli/commands/test_update.rb +0 -10
- data/test/cli/test_cli.rb +0 -102
- data/test/cli/test_error_handler.rb +0 -29
- data/test/cli/test_logger.rb +0 -10
- data/test/data_sources/test_filesystem.rb +0 -433
- data/test/data_sources/test_filesystem_unified.rb +0 -536
- data/test/data_sources/test_filesystem_verbose.rb +0 -357
- data/test/extra/core_ext/test_enumerable.rb +0 -30
- data/test/extra/core_ext/test_time.rb +0 -15
- data/test/extra/deployers/test_rsync.rb +0 -232
- data/test/extra/test_auto_compiler.rb +0 -417
- data/test/extra/test_file_proxy.rb +0 -19
- data/test/extra/test_vcs.rb +0 -22
- data/test/extra/validators/test_links.rb +0 -51
- data/test/extra/validators/test_w3c.rb +0 -47
- data/test/filters/test_asciidoc.rb +0 -22
- data/test/filters/test_bluecloth.rb +0 -18
- data/test/filters/test_coderay.rb +0 -44
- data/test/filters/test_colorize_syntax.rb +0 -283
- data/test/filters/test_erb.rb +0 -99
- data/test/filters/test_erubis.rb +0 -70
- data/test/filters/test_haml.rb +0 -96
- data/test/filters/test_kramdown.rb +0 -18
- data/test/filters/test_less.rb +0 -113
- data/test/filters/test_markaby.rb +0 -24
- data/test/filters/test_maruku.rb +0 -18
- data/test/filters/test_mustache.rb +0 -25
- data/test/filters/test_rainpress.rb +0 -29
- data/test/filters/test_rdiscount.rb +0 -31
- data/test/filters/test_rdoc.rb +0 -18
- data/test/filters/test_redcarpet.rb +0 -63
- data/test/filters/test_redcloth.rb +0 -33
- data/test/filters/test_relativize_paths.rb +0 -332
- data/test/filters/test_rubypants.rb +0 -18
- data/test/filters/test_sass.rb +0 -229
- data/test/filters/test_slim.rb +0 -35
- data/test/filters/test_typogruby.rb +0 -21
- data/test/filters/test_uglify_js.rb +0 -30
- data/test/gem_loader.rb +0 -11
- data/test/helper.rb +0 -179
- data/test/helpers/test_blogging.rb +0 -754
- data/test/helpers/test_breadcrumbs.rb +0 -81
- data/test/helpers/test_capturing.rb +0 -41
- data/test/helpers/test_filtering.rb +0 -106
- data/test/helpers/test_html_escape.rb +0 -32
- data/test/helpers/test_link_to.rb +0 -249
- data/test/helpers/test_rendering.rb +0 -89
- data/test/helpers/test_tagging.rb +0 -87
- data/test/helpers/test_text.rb +0 -24
- data/test/helpers/test_xml_sitemap.rb +0 -103
- data/test/tasks/test_clean.rb +0 -67
data/test/filters/test_erb.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::ERBTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter_with_instance_variable
|
8
|
-
# Create filter
|
9
|
-
filter = ::Nanoc3::Filters::ERB.new({ :location => 'a cheap motel' })
|
10
|
-
|
11
|
-
# Run filter
|
12
|
-
result = filter.run('<%= "I was hiding in #{@location}." %>')
|
13
|
-
assert_equal('I was hiding in a cheap motel.', result)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_filter_with_instance_method
|
17
|
-
# Create filter
|
18
|
-
filter = ::Nanoc3::Filters::ERB.new({ :location => 'a cheap motel' })
|
19
|
-
|
20
|
-
# Run filter
|
21
|
-
result = filter.run('<%= "I was hiding in #{location}." %>')
|
22
|
-
assert_equal('I was hiding in a cheap motel.', result)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_filter_error_item
|
26
|
-
# Create item and item rep
|
27
|
-
item = MiniTest::Mock.new
|
28
|
-
item.expect(:identifier, '/foo/bar/baz/')
|
29
|
-
item_rep = MiniTest::Mock.new
|
30
|
-
item_rep.expect(:name, :quux)
|
31
|
-
|
32
|
-
# Create filter
|
33
|
-
filter = ::Nanoc3::Filters::ERB.new({
|
34
|
-
:item => item,
|
35
|
-
:item_rep => item_rep,
|
36
|
-
:location => 'a cheap motel'
|
37
|
-
})
|
38
|
-
|
39
|
-
# Run filter
|
40
|
-
raised = false
|
41
|
-
begin
|
42
|
-
filter.run('<%= this isn\'t really ruby so it\'ll break, muahaha %>')
|
43
|
-
rescue SyntaxError => e
|
44
|
-
e.message =~ /(.+?):\d+: /
|
45
|
-
assert_match 'item /foo/bar/baz/ (rep quux)', $1
|
46
|
-
raised = true
|
47
|
-
end
|
48
|
-
assert raised
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_filter_with_yield
|
52
|
-
# Create filter
|
53
|
-
filter = ::Nanoc3::Filters::ERB.new({ :content => 'a cheap motel' })
|
54
|
-
|
55
|
-
# Run filter
|
56
|
-
result = filter.run('<%= "I was hiding in #{yield}." %>')
|
57
|
-
assert_equal('I was hiding in a cheap motel.', result)
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_filter_with_yield_without_content
|
61
|
-
# Create filter
|
62
|
-
filter = ::Nanoc3::Filters::ERB.new({ :location => 'a cheap motel' })
|
63
|
-
|
64
|
-
# Run filter
|
65
|
-
assert_raises LocalJumpError do
|
66
|
-
filter.run('<%= "I was hiding in #{yield}." %>')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_safe_level
|
71
|
-
# Set up
|
72
|
-
filter = ::Nanoc3::Filters::ERB.new
|
73
|
-
File.open('moo', 'w') { |io| io.write("one miiillion dollars") }
|
74
|
-
|
75
|
-
# Without
|
76
|
-
res = filter.run('<%= File.read("moo") %>', :safe_level => nil)
|
77
|
-
assert_equal 'one miiillion dollars', res
|
78
|
-
|
79
|
-
# With
|
80
|
-
assert_raises(SecurityError) do
|
81
|
-
res = filter.run('<%= File.read("moo") %>', :safe_level => 4)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_trim_mode
|
86
|
-
# Set up
|
87
|
-
filter = ::Nanoc3::Filters::ERB.new({ :location => 'a cheap motel' })
|
88
|
-
$trim_mode_works = false
|
89
|
-
|
90
|
-
# Without
|
91
|
-
filter.run('% $trim_mode_works = true')
|
92
|
-
refute $trim_mode_works
|
93
|
-
|
94
|
-
# With
|
95
|
-
filter.run('% $trim_mode_works = true', :trim_mode => '%')
|
96
|
-
assert $trim_mode_works
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
data/test/filters/test_erubis.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::ErubisTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter_with_instance_variable
|
8
|
-
if_have 'erubis' do
|
9
|
-
# Create filter
|
10
|
-
filter = ::Nanoc3::Filters::Erubis.new({ :location => 'a cheap motel' })
|
11
|
-
|
12
|
-
# Run filter
|
13
|
-
result = filter.run('<%= "I was hiding in #{@location}." %>')
|
14
|
-
assert_equal('I was hiding in a cheap motel.', result)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_filter_with_instance_method
|
19
|
-
if_have 'erubis' do
|
20
|
-
# Create filter
|
21
|
-
filter = ::Nanoc3::Filters::Erubis.new({ :location => 'a cheap motel' })
|
22
|
-
|
23
|
-
# Run filter
|
24
|
-
result = filter.run('<%= "I was hiding in #{location}." %>')
|
25
|
-
assert_equal('I was hiding in a cheap motel.', result)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_filter_error
|
30
|
-
if_have 'erubis' do
|
31
|
-
# Create filter
|
32
|
-
filter = ::Nanoc3::Filters::Erubis.new
|
33
|
-
|
34
|
-
# Run filter
|
35
|
-
raised = false
|
36
|
-
begin
|
37
|
-
filter.run('<%= this isn\'t really ruby so it\'ll break, muahaha %>')
|
38
|
-
rescue SyntaxError => e
|
39
|
-
e.message =~ /(.+?):\d+: /
|
40
|
-
assert_match '?', $1
|
41
|
-
raised = true
|
42
|
-
end
|
43
|
-
assert raised
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_filter_with_yield
|
48
|
-
if_have 'erubis' do
|
49
|
-
# Create filter
|
50
|
-
filter = ::Nanoc3::Filters::Erubis.new({ :content => 'a cheap motel' })
|
51
|
-
|
52
|
-
# Run filter
|
53
|
-
result = filter.run('<%= "I was hiding in #{yield}." %>')
|
54
|
-
assert_equal('I was hiding in a cheap motel.', result)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_filter_with_yield_without_content
|
59
|
-
if_have 'erubis' do
|
60
|
-
# Create filter
|
61
|
-
filter = ::Nanoc3::Filters::Erubis.new({ :location => 'a cheap motel' })
|
62
|
-
|
63
|
-
# Run filter
|
64
|
-
assert_raises LocalJumpError do
|
65
|
-
filter.run('<%= "I was hiding in #{yield}." %>')
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
data/test/filters/test_haml.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::HamlTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter
|
8
|
-
if_have 'haml' do
|
9
|
-
# Create filter
|
10
|
-
filter = ::Nanoc3::Filters::Haml.new({ :question => 'Is this the Payne residence?' })
|
11
|
-
|
12
|
-
# Run filter (no assigns)
|
13
|
-
result = filter.run('%html')
|
14
|
-
assert_match(/<html>.*<\/html>/, result)
|
15
|
-
|
16
|
-
# Run filter (assigns without @)
|
17
|
-
result = filter.run('%p= question')
|
18
|
-
assert_equal("<p>Is this the Payne residence?</p>\n", result)
|
19
|
-
|
20
|
-
# Run filter (assigns with @)
|
21
|
-
result = filter.run('%p= @question')
|
22
|
-
assert_equal("<p>Is this the Payne residence?</p>\n", result)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_filter_with_params
|
27
|
-
if_have 'haml' do
|
28
|
-
# Create filter
|
29
|
-
filter = ::Nanoc3::Filters::Haml.new({ :foo => 'bar' })
|
30
|
-
|
31
|
-
# Check with HTML5
|
32
|
-
result = filter.run('%img', :format => :html5)
|
33
|
-
assert_match(/<img>/, result)
|
34
|
-
|
35
|
-
# Check with XHTML
|
36
|
-
result = filter.run('%img', :format => :xhtml)
|
37
|
-
assert_match(/<img\s*\/>/, result)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_filter_error
|
42
|
-
if_have 'haml' do
|
43
|
-
# Create filter
|
44
|
-
filter = ::Nanoc3::Filters::Haml.new({ :foo => 'bar' })
|
45
|
-
|
46
|
-
# Run filter
|
47
|
-
raised = false
|
48
|
-
begin
|
49
|
-
filter.run('%p= this isn\'t really ruby so it\'ll break, muahaha')
|
50
|
-
rescue SyntaxError => e
|
51
|
-
e.message =~ /(.+?):\d+: /
|
52
|
-
assert_match '?', $1
|
53
|
-
raised = true
|
54
|
-
end
|
55
|
-
assert raised
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_filter_with_yield
|
60
|
-
if_have 'haml' do
|
61
|
-
# Create filter
|
62
|
-
filter = ::Nanoc3::Filters::Haml.new({ :content => 'Is this the Payne residence?' })
|
63
|
-
|
64
|
-
# Run filter
|
65
|
-
result = filter.run('%p= yield')
|
66
|
-
assert_equal("<p>Is this the Payne residence?</p>\n", result)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_filter_with_yield_without_content
|
71
|
-
if_have 'haml' do
|
72
|
-
# Create filter
|
73
|
-
filter = ::Nanoc3::Filters::Haml.new({ :location => 'Is this the Payne residence?' })
|
74
|
-
|
75
|
-
# Run filter
|
76
|
-
assert_raises LocalJumpError do
|
77
|
-
filter.run('%p= yield')
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_filter_with_proper_indentation
|
83
|
-
if_have 'haml' do
|
84
|
-
# Create file to include
|
85
|
-
File.open('stuff', 'w') do |io|
|
86
|
-
io.write("<pre>Max Payne\nMona Sax</pre>")
|
87
|
-
end
|
88
|
-
|
89
|
-
# Run filter
|
90
|
-
filter = ::Nanoc3::Filters::Haml.new
|
91
|
-
result = filter.run("%body\n ~ File.read('stuff')")
|
92
|
-
assert_match(/Max Payne
Mona Sax/, result)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::KramdownTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter
|
8
|
-
if_have 'kramdown' do
|
9
|
-
# Create filter
|
10
|
-
filter = ::Nanoc3::Filters::Kramdown.new
|
11
|
-
|
12
|
-
# Run filter
|
13
|
-
result = filter.run("This is _so_ **cool**!")
|
14
|
-
assert_equal("<p>This is <em>so</em> <strong>cool</strong>!</p>\n", result)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
data/test/filters/test_less.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::LessTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter
|
8
|
-
if_have 'less' do
|
9
|
-
# Create item
|
10
|
-
@item = Nanoc3::Item.new("blah", { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
|
11
|
-
|
12
|
-
# Create filter
|
13
|
-
filter = ::Nanoc3::Filters::Less.new(:item => @item, :items => [ @item ])
|
14
|
-
|
15
|
-
# Run filter
|
16
|
-
result = filter.run('.foo { bar: 1 + 1 }')
|
17
|
-
assert_match /\.foo\s*\{\s*bar:\s*2;?\s*\}/, result
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_filter_with_paths_relative_to_site_directory
|
22
|
-
if_have 'less' do
|
23
|
-
# Create file to import
|
24
|
-
FileUtils.mkdir_p('content/foo/bar')
|
25
|
-
File.open('content/foo/bar/imported_file.less', 'w') { |io| io.write('p { color: red; }') }
|
26
|
-
|
27
|
-
# Create item
|
28
|
-
@item = Nanoc3::Item.new("blah", { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
|
29
|
-
|
30
|
-
# Create filter
|
31
|
-
filter = ::Nanoc3::Filters::Less.new(:item => @item, :items => [ @item ])
|
32
|
-
|
33
|
-
# Run filter
|
34
|
-
result = filter.run('@import "content/foo/bar/imported_file.less";')
|
35
|
-
assert_match /p\s*\{\s*color:\s*red;?\s*\}/, result
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_filter_with_paths_relative_to_current_file
|
40
|
-
if_have 'less' do
|
41
|
-
# Create file to import
|
42
|
-
FileUtils.mkdir_p('content/foo/bar')
|
43
|
-
File.open('content/foo/bar/imported_file.less', 'w') { |io| io.write('p { color: red; }') }
|
44
|
-
|
45
|
-
# Create item
|
46
|
-
File.open('content/foo/bar.txt', 'w') { |io| io.write('meh') }
|
47
|
-
@item = Nanoc3::Item.new("blah", { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
|
48
|
-
|
49
|
-
# Create filter
|
50
|
-
filter = ::Nanoc3::Filters::Less.new(:item => @item, :items => [ @item ])
|
51
|
-
|
52
|
-
# Run filter
|
53
|
-
result = filter.run('@import "bar/imported_file.less";')
|
54
|
-
assert_match /p\s*\{\s*color:\s*red;?\s*\}/, result
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_recompile_includes
|
59
|
-
if_have 'less' do
|
60
|
-
with_site do |site|
|
61
|
-
# Create two less files
|
62
|
-
Dir['content/*'].each { |i| FileUtils.rm(i) }
|
63
|
-
File.open('content/a.less', 'w') do |io|
|
64
|
-
io.write('@import "b.less";')
|
65
|
-
end
|
66
|
-
File.open('content/b.less', 'w') do |io|
|
67
|
-
io.write("p { color: red; }")
|
68
|
-
end
|
69
|
-
|
70
|
-
# Update rules
|
71
|
-
File.open('Rules', 'w') do |io|
|
72
|
-
io.write "compile '*' do\n"
|
73
|
-
io.write " filter :less\n"
|
74
|
-
io.write "end\n"
|
75
|
-
io.write "\n"
|
76
|
-
io.write "route '/a/' do\n"
|
77
|
-
io.write " item.identifier.chop + '.css'\n"
|
78
|
-
io.write "end\n"
|
79
|
-
io.write "\n"
|
80
|
-
io.write "route '/b/' do\n"
|
81
|
-
io.write " nil\n"
|
82
|
-
io.write "end\n"
|
83
|
-
end
|
84
|
-
|
85
|
-
# Compile
|
86
|
-
site = Nanoc3::Site.new('.')
|
87
|
-
site.compile
|
88
|
-
|
89
|
-
# Check
|
90
|
-
assert Dir['output/*'].size == 1
|
91
|
-
assert File.file?('output/a.css')
|
92
|
-
refute File.file?('output/b.css')
|
93
|
-
assert_match /^p\s*\{\s*color:\s*red;?\s*\}/, File.read('output/a.css')
|
94
|
-
|
95
|
-
# Update included file
|
96
|
-
File.open('content/b.less', 'w') do |io|
|
97
|
-
io.write("p { color: blue; }")
|
98
|
-
end
|
99
|
-
|
100
|
-
# Recompile
|
101
|
-
site = Nanoc3::Site.new('.')
|
102
|
-
site.compile
|
103
|
-
|
104
|
-
# Recheck
|
105
|
-
assert Dir['output/*'].size == 1
|
106
|
-
assert File.file?('output/a.css')
|
107
|
-
refute File.file?('output/b.css')
|
108
|
-
assert_match /^p\s*\{\s*color:\s*blue;?\s*\}/, File.read('output/a.css')
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::MarkabyTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter
|
8
|
-
# Don’t run this test on 1.9.x, because it breaks and it annoys me
|
9
|
-
if RUBY_VERSION >= '1.9'
|
10
|
-
skip "Markaby is not compatible with 1.9.x"
|
11
|
-
return
|
12
|
-
end
|
13
|
-
|
14
|
-
if_have 'markaby' do
|
15
|
-
# Create filter
|
16
|
-
filter = ::Nanoc3::Filters::Markaby.new
|
17
|
-
|
18
|
-
# Run filter
|
19
|
-
result = filter.run("html do\nend")
|
20
|
-
assert_equal("<html></html>", result)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
data/test/filters/test_maruku.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::MarukuTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter
|
8
|
-
if_have 'maruku' do
|
9
|
-
# Create filter
|
10
|
-
filter = ::Nanoc3::Filters::Maruku.new
|
11
|
-
|
12
|
-
# Run filter
|
13
|
-
result = filter.run("This is _so_ *cool*!")
|
14
|
-
assert_equal("<p>This is <em>so</em> <em>cool</em>!</p>", result)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc3::Filters::MustacheTest < MiniTest::Unit::TestCase
|
4
|
-
|
5
|
-
include Nanoc3::TestHelpers
|
6
|
-
|
7
|
-
def test_filter
|
8
|
-
if_have 'mustache' do
|
9
|
-
# Create item
|
10
|
-
item = Nanoc3::Item.new(
|
11
|
-
'content',
|
12
|
-
{ :title => 'Max Payne', :protagonist => 'Max Payne' },
|
13
|
-
'/games/max-payne/'
|
14
|
-
)
|
15
|
-
|
16
|
-
# Create filter
|
17
|
-
filter = ::Nanoc3::Filters::Mustache.new({ :item => item })
|
18
|
-
|
19
|
-
# Run filter
|
20
|
-
result = filter.run('The protagonist of {{title}} is {{protagonist}}.')
|
21
|
-
assert_equal('The protagonist of Max Payne is Max Payne.', result)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|