nanoc 3.7.3 → 3.7.4
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.lock +71 -46
- data/NEWS.md +14 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +11 -10
- data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
- data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -1
- data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
- data/lib/nanoc/base/context.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/date.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -1
- data/lib/nanoc/base/directed_graph.rb +3 -3
- data/lib/nanoc/base/memoization.rb +1 -1
- data/lib/nanoc/base/notification_center.rb +1 -1
- data/lib/nanoc/base/ordered_hash.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +3 -3
- data/lib/nanoc/base/result_data/item_rep.rb +13 -11
- data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
- data/lib/nanoc/base/source_data/data_source.rb +3 -3
- data/lib/nanoc/base/source_data/item.rb +8 -8
- data/lib/nanoc/base/source_data/item_array.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +27 -18
- data/lib/nanoc/base/store.rb +3 -3
- data/lib/nanoc/base/temp_filename_factory.rb +2 -2
- data/lib/nanoc/cli.rb +6 -6
- data/lib/nanoc/cli/cleaning_stream.rb +1 -1
- data/lib/nanoc/cli/command_runner.rb +4 -3
- data/lib/nanoc/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc/cli/commands/check.rb +3 -3
- data/lib/nanoc/cli/commands/compile.rb +23 -23
- data/lib/nanoc/cli/commands/create-item.rb +5 -5
- data/lib/nanoc/cli/commands/create-layout.rb +14 -14
- data/lib/nanoc/cli/commands/create-site.rb +6 -6
- data/lib/nanoc/cli/commands/deploy.rb +8 -8
- data/lib/nanoc/cli/commands/nanoc.rb +3 -3
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +4 -4
- data/lib/nanoc/cli/commands/show-data.rb +5 -5
- data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
- data/lib/nanoc/cli/commands/show-rules.rb +4 -4
- data/lib/nanoc/cli/commands/sync.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +13 -13
- data/lib/nanoc/cli/commands/validate-css.rb +3 -3
- data/lib/nanoc/cli/commands/validate-html.rb +3 -3
- data/lib/nanoc/cli/commands/validate-links.rb +6 -6
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/commands/watch.rb +11 -11
- data/lib/nanoc/cli/error_handler.rb +10 -10
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
- data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +16 -16
- data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
- data/lib/nanoc/data_sources/static.rb +1 -1
- data/lib/nanoc/extra/auto_compiler.rb +2 -2
- data/lib/nanoc/extra/checking/check.rb +11 -1
- data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
- data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
- data/lib/nanoc/extra/checking/runner.rb +10 -9
- data/lib/nanoc/extra/chick.rb +2 -2
- data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
- data/lib/nanoc/extra/deployers/fog.rb +2 -2
- data/lib/nanoc/extra/deployers/rsync.rb +3 -3
- data/lib/nanoc/extra/file_proxy.rb +3 -3
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/extra/link_collector.rb +3 -3
- data/lib/nanoc/extra/piper.rb +2 -2
- data/lib/nanoc/extra/pruner.rb +4 -3
- data/lib/nanoc/extra/validators/links.rb +2 -2
- data/lib/nanoc/extra/validators/w3c.rb +1 -1
- data/lib/nanoc/extra/vcs.rb +5 -5
- data/lib/nanoc/extra/vcses/dummy.rb +1 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -1
- data/lib/nanoc/filters/bluecloth.rb +1 -1
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +19 -21
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +1 -1
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rdoc.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +5 -5
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/filters/typogruby.rb +1 -1
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +12 -12
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/helpers/html_escape.rb +6 -6
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/tasks/clean.rb +1 -1
- data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +1 -0
- data/test/base/core_ext/array_spec.rb +7 -7
- data/test/base/core_ext/hash_spec.rb +1 -1
- data/test/base/test_checksum_store.rb +1 -1
- data/test/base/test_compiler.rb +14 -14
- data/test/base/test_compiler_dsl.rb +13 -13
- data/test/base/test_context.rb +2 -2
- data/test/base/test_dependency_tracker.rb +42 -42
- data/test/base/test_directed_graph.rb +102 -102
- data/test/base/test_item.rb +21 -21
- data/test/base/test_item_array.rb +19 -19
- data/test/base/test_item_rep.rb +50 -50
- data/test/base/test_layout.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +2 -2
- data/test/base/test_rule_context.rb +2 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +7 -7
- data/test/cli/commands/test_create_site.rb +2 -2
- data/test/cli/commands/test_deploy.rb +10 -10
- data/test/cli/commands/test_prune.rb +2 -2
- data/test/cli/commands/test_sync.rb +1 -1
- data/test/cli/commands/test_watch.rb +7 -7
- data/test/cli/test_cleaning_stream.rb +4 -4
- data/test/cli/test_cli.rb +3 -3
- data/test/cli/test_error_handler.rb +3 -3
- data/test/data_sources/test_filesystem.rb +19 -19
- data/test/data_sources/test_filesystem_unified.rb +30 -30
- data/test/data_sources/test_filesystem_verbose.rb +3 -3
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +8 -8
- data/test/extra/checking/test_check.rb +11 -1
- data/test/extra/checking/test_dsl.rb +1 -1
- data/test/extra/core_ext/test_enumerable.rb +2 -2
- data/test/extra/deployers/test_fog.rb +10 -10
- data/test/extra/deployers/test_rsync.rb +2 -2
- data/test/extra/test_auto_compiler.rb +28 -28
- data/test/extra/test_filesystem_tools.rb +3 -3
- data/test/extra/test_link_collector.rb +39 -20
- data/test/extra/validators/test_w3c.rb +5 -5
- data/test/filters/test_asciidoc.rb +2 -2
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -13
- data/test/filters/test_erb.rb +1 -1
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +10 -10
- data/test/filters/test_markaby.rb +2 -2
- data/test/filters/test_maruku.rb +2 -2
- data/test/filters/test_pandoc.rb +3 -3
- data/test/filters/test_rainpress.rb +4 -4
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +5 -5
- data/test/filters/test_redcloth.rb +5 -5
- data/test/filters/test_relativize_paths.rb +33 -31
- data/test/filters/test_rubypants.rb +2 -2
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +3 -3
- data/test/filters/test_uglify_js.rb +1 -1
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +14 -16
- data/test/helpers/test_blogging.rb +28 -28
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +7 -7
- data/test/helpers/test_filtering.rb +16 -16
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +1 -1
- data/test/helpers/test_tagging.rb +11 -11
- data/test/helpers/test_xml_sitemap.rb +18 -18
- data/test/tasks/test_clean.rb +8 -8
- metadata +2 -2
|
@@ -8,7 +8,7 @@ class Nanoc::Filters::RDiscountTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::RDiscount.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
result = filter.setup_and_run(
|
|
11
|
+
result = filter.setup_and_run('> Quote')
|
|
12
12
|
assert_match(/<blockquote>\s*<p>Quote<\/p>\s*<\/blockquote>/, result)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -21,7 +21,7 @@ class Nanoc::Filters::RDiscountTest < Nanoc::TestCase
|
|
|
21
21
|
# Run filter
|
|
22
22
|
input = "The quotation 'marks' sure make this look sarcastic!"
|
|
23
23
|
output_expected = /The quotation ‘marks’ sure make this look sarcastic!/
|
|
24
|
-
output_actual = filter.setup_and_run(input, :extensions => [
|
|
24
|
+
output_actual = filter.setup_and_run(input, :extensions => [:smart])
|
|
25
25
|
assert_match(output_expected, output_actual)
|
|
26
26
|
end
|
|
27
27
|
end
|
data/test/filters/test_rdoc.rb
CHANGED
|
@@ -7,7 +7,7 @@ class Nanoc::Filters::RDocTest < Nanoc::TestCase
|
|
|
7
7
|
filter = ::Nanoc::Filters::RDoc.new
|
|
8
8
|
|
|
9
9
|
# Run filter
|
|
10
|
-
result = filter.setup_and_run(
|
|
10
|
+
result = filter.setup_and_run('= Foo')
|
|
11
11
|
assert_match(%r{\A\s*<h1( id="label-Foo")?>Foo(<span>.*</span>)?</h1>\s*\Z}, result)
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -14,7 +14,7 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
14
14
|
filter = ::Nanoc::Filters::Redcarpet.new
|
|
15
15
|
|
|
16
16
|
# Run filter
|
|
17
|
-
result = filter.setup_and_run(
|
|
17
|
+
result = filter.setup_and_run('> Quote')
|
|
18
18
|
assert_match(/<blockquote>\s*<p>Quote<\/p>\s*<\/blockquote>/, result)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -26,13 +26,13 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
26
26
|
|
|
27
27
|
# Run filter
|
|
28
28
|
if ::Redcarpet::VERSION > '2'
|
|
29
|
-
input =
|
|
29
|
+
input = 'this is ~~good~~ bad'
|
|
30
30
|
output_expected = /this is <del>good<\/del> bad/
|
|
31
31
|
output_actual = filter.setup_and_run(input, :options => { :strikethrough => true })
|
|
32
32
|
else
|
|
33
33
|
input = "The quotation 'marks' sure make this look sarcastic!"
|
|
34
34
|
output_expected = /The quotation ‘marks’ sure make this look sarcastic!/
|
|
35
|
-
output_actual = filter.setup_and_run(input, :options => [
|
|
35
|
+
output_actual = filter.setup_and_run(input, :options => [:smart])
|
|
36
36
|
end
|
|
37
37
|
assert_match(output_expected, output_actual)
|
|
38
38
|
end
|
|
@@ -62,7 +62,7 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
62
62
|
if ::Redcarpet::VERSION > '2'
|
|
63
63
|
output_actual = filter.setup_and_run(input, :renderer_options => { :xhtml => true })
|
|
64
64
|
else
|
|
65
|
-
output_actual = filter.setup_and_run(input, :options => [
|
|
65
|
+
output_actual = filter.setup_and_run(input, :options => [:xhtml])
|
|
66
66
|
end
|
|
67
67
|
assert_match(output_expected, output_actual)
|
|
68
68
|
end
|
|
@@ -71,7 +71,7 @@ class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
|
|
|
71
71
|
def test_html_toc
|
|
72
72
|
if_have 'redcarpet' do
|
|
73
73
|
unless ::Redcarpet::VERSION > '2'
|
|
74
|
-
skip
|
|
74
|
+
skip 'Requires Redcarpet >= 2'
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
# Create filter
|
|
@@ -8,8 +8,8 @@ class Nanoc::Filters::RedClothTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::RedCloth.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
result = filter.setup_and_run(
|
|
12
|
-
assert_equal(
|
|
11
|
+
result = filter.setup_and_run('h1. Foo')
|
|
12
|
+
assert_equal('<h1>Foo</h1>', result)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -19,12 +19,12 @@ class Nanoc::Filters::RedClothTest < Nanoc::TestCase
|
|
|
19
19
|
filter = ::Nanoc::Filters::RedCloth.new
|
|
20
20
|
|
|
21
21
|
# Run filter without options
|
|
22
|
-
result = filter.setup_and_run(
|
|
22
|
+
result = filter.setup_and_run('I am a member of SPECTRE.')
|
|
23
23
|
assert_equal("<p>I am a member of <span class=\"caps\">SPECTRE</span>.</p>", result)
|
|
24
24
|
|
|
25
25
|
# Run filter with options
|
|
26
|
-
result = filter.setup_and_run(
|
|
27
|
-
assert_equal(
|
|
26
|
+
result = filter.setup_and_run('I am a member of SPECTRE.', :no_span_caps => true)
|
|
27
|
+
assert_equal('<p>I am a member of SPECTRE.</p>', result)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -19,8 +19,8 @@ class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
# Set content
|
|
22
|
-
raw_content = %
|
|
23
|
-
expected_content = %
|
|
22
|
+
raw_content = %(<a href="/foo">foo</a>)
|
|
23
|
+
expected_content = %(<a href="../..">foo</a>)
|
|
24
24
|
|
|
25
25
|
# Test
|
|
26
26
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -43,8 +43,8 @@ class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# Set content
|
|
46
|
-
raw_content = %
|
|
47
|
-
expected_content = %
|
|
46
|
+
raw_content = %(<a href='/foo'>foo</a>)
|
|
47
|
+
expected_content = %(<a href="../..">foo</a>)
|
|
48
48
|
|
|
49
49
|
# Test
|
|
50
50
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -67,8 +67,8 @@ class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# Set content
|
|
70
|
-
raw_content = %
|
|
71
|
-
expected_content = %
|
|
70
|
+
raw_content = %(<a href=/foo>foo</a>)
|
|
71
|
+
expected_content = %(<a href="../..">foo</a>)
|
|
72
72
|
|
|
73
73
|
# Test
|
|
74
74
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -127,8 +127,8 @@ EOS
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
# Set content
|
|
130
|
-
raw_content = %
|
|
131
|
-
expected_content = %
|
|
130
|
+
raw_content = %(<a href="/foo">foo</a> <a href="/bar">bar</a>)
|
|
131
|
+
expected_content = %(<a href="../..">foo</a> <a href="../../../bar">bar</a>)
|
|
132
132
|
|
|
133
133
|
# Test
|
|
134
134
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -151,8 +151,8 @@ EOS
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
# Set content
|
|
154
|
-
raw_content = %
|
|
155
|
-
expected_content = %
|
|
154
|
+
raw_content = %(<a href="/"><img src="/bar.png" /></a>)
|
|
155
|
+
expected_content = %(<a href="../../../"><img src="../../../bar.png"></a>)
|
|
156
156
|
|
|
157
157
|
# Test
|
|
158
158
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -175,8 +175,8 @@ EOS
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
# Set content
|
|
178
|
-
raw_content = %
|
|
179
|
-
expected_content = %
|
|
178
|
+
raw_content = %(stuff href="/foo" more stuff)
|
|
179
|
+
expected_content = %(stuff href="/foo" more stuff)
|
|
180
180
|
|
|
181
181
|
# Test
|
|
182
182
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -199,8 +199,8 @@ EOS
|
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
# Set content
|
|
202
|
-
raw_content = %
|
|
203
|
-
expected_content = %
|
|
202
|
+
raw_content = %(<a href="/">foo</a>)
|
|
203
|
+
expected_content = %(<a href="../../">foo</a>)
|
|
204
204
|
|
|
205
205
|
# Test
|
|
206
206
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -223,8 +223,8 @@ EOS
|
|
|
223
223
|
end
|
|
224
224
|
|
|
225
225
|
# Set content
|
|
226
|
-
raw_content = %
|
|
227
|
-
expected_content = %
|
|
226
|
+
raw_content = %(<a href="//example.com/">example.com</a>)
|
|
227
|
+
expected_content = %(<a href="//example.com/">example.com</a>)
|
|
228
228
|
|
|
229
229
|
# Test
|
|
230
230
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -247,8 +247,8 @@ EOS
|
|
|
247
247
|
end
|
|
248
248
|
|
|
249
249
|
# Set content
|
|
250
|
-
raw_content = %
|
|
251
|
-
expected_content = %
|
|
250
|
+
raw_content = %(<a href="#max-payne">Max Payne</a>)
|
|
251
|
+
expected_content = %(<a href="#max-payne">Max Payne</a>)
|
|
252
252
|
|
|
253
253
|
# Test
|
|
254
254
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -271,8 +271,8 @@ EOS
|
|
|
271
271
|
end
|
|
272
272
|
|
|
273
273
|
# Set content
|
|
274
|
-
raw_content = %
|
|
275
|
-
expected_content = %
|
|
274
|
+
raw_content = %(<a href="http://example.com/">Example</a>)
|
|
275
|
+
expected_content = %(<a href="http://example.com/">Example</a>)
|
|
276
276
|
|
|
277
277
|
# Test
|
|
278
278
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -295,8 +295,8 @@ EOS
|
|
|
295
295
|
end
|
|
296
296
|
|
|
297
297
|
# Set content
|
|
298
|
-
raw_content = %
|
|
299
|
-
expected_content = %
|
|
298
|
+
raw_content = %(<a href="example">Example</a>)
|
|
299
|
+
expected_content = %(<a href="example">Example</a>)
|
|
300
300
|
|
|
301
301
|
# Test
|
|
302
302
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -318,7 +318,7 @@ EOS
|
|
|
318
318
|
@item_rep.path = '/woof/meow/'
|
|
319
319
|
end
|
|
320
320
|
|
|
321
|
-
raw_content = %
|
|
321
|
+
raw_content = %(<object data="/example"><param name="movie" content="/example"></object>)
|
|
322
322
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
323
323
|
|
|
324
324
|
assert_match(/<object data="..\/..\/example">/, actual_content)
|
|
@@ -332,7 +332,7 @@ EOS
|
|
|
332
332
|
|
|
333
333
|
# Test
|
|
334
334
|
assert_raises(RuntimeError) do
|
|
335
|
-
filter.setup_and_run(
|
|
335
|
+
filter.setup_and_run('moo')
|
|
336
336
|
end
|
|
337
337
|
end
|
|
338
338
|
|
|
@@ -668,12 +668,13 @@ XML
|
|
|
668
668
|
end
|
|
669
669
|
|
|
670
670
|
# Set content
|
|
671
|
-
raw_content = %
|
|
671
|
+
raw_content = %(
|
|
672
672
|
<link rel="stylesheet" href="/foo.css" />
|
|
673
673
|
<!--[if lt IE 9]>
|
|
674
674
|
<script src="/js/lib/html5shiv.js"></script>
|
|
675
675
|
<![endif]-->
|
|
676
|
-
|
|
676
|
+
|
|
677
|
+
)
|
|
677
678
|
|
|
678
679
|
actual_content = filter.setup_and_run(raw_content.freeze, :type => :xhtml)
|
|
679
680
|
|
|
@@ -700,15 +701,16 @@ XML
|
|
|
700
701
|
end
|
|
701
702
|
|
|
702
703
|
# Set content
|
|
703
|
-
raw_content = %
|
|
704
|
+
raw_content = %(
|
|
704
705
|
<!--[if lt IE 9]>
|
|
705
706
|
<script src="/js/lib/html5shiv.js"></script>
|
|
706
707
|
<![endif]-->
|
|
707
|
-
|
|
708
|
+
|
|
709
|
+
)
|
|
708
710
|
|
|
709
711
|
# Test
|
|
710
712
|
actual_content = filter.setup_and_run(raw_content.freeze, :type => :html)
|
|
711
|
-
assert actual_content.include? %
|
|
713
|
+
assert actual_content.include? %(<script src="../../js/lib/html5shiv.js">)
|
|
712
714
|
end
|
|
713
715
|
end
|
|
714
716
|
|
|
@@ -728,8 +730,8 @@ XML
|
|
|
728
730
|
end
|
|
729
731
|
|
|
730
732
|
# Set content
|
|
731
|
-
raw_content = %
|
|
732
|
-
expected_content = %
|
|
733
|
+
raw_content = %(<!DOCTYPE html>)
|
|
734
|
+
expected_content = %(<!DOCTYPE html>)
|
|
733
735
|
|
|
734
736
|
# Test
|
|
735
737
|
actual_content = filter.setup_and_run(raw_content, :type => :html)
|
|
@@ -8,8 +8,8 @@ class Nanoc::Filters::RubyPantsTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::RubyPants.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
result = filter.setup_and_run(
|
|
12
|
-
assert_equal(
|
|
11
|
+
result = filter.setup_and_run('Wait---what?')
|
|
12
|
+
assert_equal('Wait—what?', result)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
data/test/filters/test_sass.rb
CHANGED
|
@@ -64,8 +64,8 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
|
|
|
64
64
|
filter = create_filter
|
|
65
65
|
|
|
66
66
|
# Create sample file
|
|
67
|
-
File.open('moo.sass', 'w') { |io| io.write %Q
|
|
68
|
-
FileUtils.mkdir_p(
|
|
67
|
+
File.open('moo.sass', 'w') { |io| io.write %Q(@import subdir/relative) }
|
|
68
|
+
FileUtils.mkdir_p('subdir')
|
|
69
69
|
File.open('subdir/relative.sass', 'w') { |io| io.write "body\n color: red" }
|
|
70
70
|
|
|
71
71
|
# Run filter
|
|
@@ -251,7 +251,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
|
|
|
251
251
|
|
|
252
252
|
# Check
|
|
253
253
|
output_files = Dir['output/**/*'].select { |f| File.file?(f) }
|
|
254
|
-
assert_equal [
|
|
254
|
+
assert_equal ['output/style/super/main.css'], output_files
|
|
255
255
|
assert_match(/^p\s*\{\s*color:\s*red;?\s*\}/, File.read('output/style/super/main.css'))
|
|
256
256
|
|
|
257
257
|
# Update included file
|
|
@@ -265,22 +265,22 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
|
|
|
265
265
|
|
|
266
266
|
# Recheck
|
|
267
267
|
output_files = Dir['output/**/*'].select { |f| File.file?(f) }
|
|
268
|
-
assert_equal [
|
|
268
|
+
assert_equal ['output/style/super/main.css'], output_files
|
|
269
269
|
assert_match(/^p\s*\{\s*color:\s*blue;?\s*\}/, File.read('output/style/super/main.css'))
|
|
270
270
|
end
|
|
271
271
|
end
|
|
272
272
|
end
|
|
273
273
|
|
|
274
|
-
private
|
|
274
|
+
private
|
|
275
275
|
|
|
276
|
-
def create_filter(params={})
|
|
276
|
+
def create_filter(params = {})
|
|
277
277
|
FileUtils.mkdir_p('content')
|
|
278
278
|
File.open('content/xyzzy.sass', 'w') { |io| io.write('p\n color: green')}
|
|
279
279
|
|
|
280
|
-
items = [
|
|
280
|
+
items = [Nanoc::Item.new(
|
|
281
281
|
'blah',
|
|
282
282
|
{ :content_filename => 'content/xyzzy.sass' },
|
|
283
|
-
'/blah/')
|
|
283
|
+
'/blah/')]
|
|
284
284
|
params = { :item => items[0], :items => items }.merge(params)
|
|
285
285
|
::Nanoc::Filters::Sass.new(params)
|
|
286
286
|
end
|
data/test/filters/test_slim.rb
CHANGED
|
@@ -13,11 +13,11 @@ class Nanoc::Filters::SlimTest < Nanoc::TestCase
|
|
|
13
13
|
|
|
14
14
|
# Run filter (assigns without @)
|
|
15
15
|
result = filter.setup_and_run('p = rabbit')
|
|
16
|
-
assert_equal(
|
|
16
|
+
assert_equal('<p>The rabbit is on the branch.</p>', result)
|
|
17
17
|
|
|
18
18
|
# Run filter (assigns with @)
|
|
19
19
|
result = filter.setup_and_run('p = @rabbit')
|
|
20
|
-
assert_equal(
|
|
20
|
+
assert_equal('<p>The rabbit is on the branch.</p>', result)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -26,7 +26,7 @@ class Nanoc::Filters::SlimTest < Nanoc::TestCase
|
|
|
26
26
|
filter = ::Nanoc::Filters::Slim.new({ :content => 'The rabbit is on the branch.' })
|
|
27
27
|
|
|
28
28
|
result = filter.setup_and_run('p = yield')
|
|
29
|
-
assert_equal(
|
|
29
|
+
assert_equal('<p>The rabbit is on the branch.</p>', result)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -8,7 +8,7 @@ class Nanoc::Filters::UglifyJSTest < Nanoc::TestCase
|
|
|
8
8
|
filter = ::Nanoc::Filters::UglifyJS.new
|
|
9
9
|
|
|
10
10
|
# Run filter
|
|
11
|
-
input =
|
|
11
|
+
input = 'foo = 1; (function(bar) { if (true) alert(bar); })(foo)'
|
|
12
12
|
result = filter.setup_and_run(input)
|
|
13
13
|
assert_match(/foo=1,function\((.)\)\{alert\(\1\)\}\(foo\);/, result)
|
|
14
14
|
end
|
|
@@ -17,10 +17,10 @@ class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
|
|
|
17
17
|
JAVASCRIPT
|
|
18
18
|
|
|
19
19
|
result = filter.setup_and_run(sample_js, { :type => 'js', :munge => true })
|
|
20
|
-
assert_match
|
|
20
|
+
assert_match 'function factorial(c){var a=1;for(var b=2;b<=c;b++){a*=b}return a};', result
|
|
21
21
|
|
|
22
22
|
result = filter.setup_and_run(sample_js, { :type => 'js', :munge => false })
|
|
23
|
-
assert_match
|
|
23
|
+
assert_match 'function factorial(n){var result=1;for(var i=2;i<=n;i++){result*=i}return result};', result
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -35,7 +35,7 @@ class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
|
|
|
35
35
|
CSS
|
|
36
36
|
|
|
37
37
|
result = filter.setup_and_run(sample_css, { :type => 'css' })
|
|
38
|
-
assert_match
|
|
38
|
+
assert_match '*{margin:0}', result
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
data/test/gem_loader.rb
CHANGED
data/test/helper.rb
CHANGED
|
@@ -40,7 +40,7 @@ module Nanoc::TestHelpers
|
|
|
40
40
|
def if_have(*libs)
|
|
41
41
|
libs.each do |lib|
|
|
42
42
|
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' && lib == 'nokogiri' && disable_nokogiri?
|
|
43
|
-
skip
|
|
43
|
+
skip 'Pure Java Nokogiri has issues that cause problems with nanoc (see https://github.com/nanoc/nanoc/pull/422) -- run without DISABLE_NOKOGIRI to enable Nokogiri tests'
|
|
44
44
|
return
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -56,15 +56,13 @@ module Nanoc::TestHelpers
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def if_implemented
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
end
|
|
59
|
+
yield
|
|
60
|
+
rescue NotImplementedError, NameError
|
|
61
|
+
skip $!
|
|
62
|
+
return
|
|
65
63
|
end
|
|
66
64
|
|
|
67
|
-
def with_site(params={})
|
|
65
|
+
def with_site(params = {})
|
|
68
66
|
# Build site name
|
|
69
67
|
site_name = params[:name]
|
|
70
68
|
if site_name.nil?
|
|
@@ -182,7 +180,7 @@ EOS
|
|
|
182
180
|
P(object).tags(:example).each do |example|
|
|
183
181
|
# Classify
|
|
184
182
|
lines = example.text.lines.map do |line|
|
|
185
|
-
[
|
|
183
|
+
[line =~ /^\s*# ?=>/ ? :result : :code, line]
|
|
186
184
|
end
|
|
187
185
|
|
|
188
186
|
# Join
|
|
@@ -237,12 +235,12 @@ EOS
|
|
|
237
235
|
Nanoc.on_windows?
|
|
238
236
|
end
|
|
239
237
|
|
|
240
|
-
def
|
|
241
|
-
which, null = on_windows? ? [
|
|
238
|
+
def command?(cmd)
|
|
239
|
+
which, null = on_windows? ? ['where', 'NUL'] : ['which', '/dev/null']
|
|
242
240
|
system("#{which} #{cmd} > #{null} 2>&1")
|
|
243
241
|
end
|
|
244
242
|
|
|
245
|
-
def
|
|
243
|
+
def symlinks_supported?
|
|
246
244
|
File.symlink nil, nil
|
|
247
245
|
rescue NotImplementedError
|
|
248
246
|
return false
|
|
@@ -251,11 +249,11 @@ EOS
|
|
|
251
249
|
end
|
|
252
250
|
|
|
253
251
|
def skip_unless_have_command(cmd)
|
|
254
|
-
skip "Could not find external command \"#{cmd}\"" unless
|
|
252
|
+
skip "Could not find external command \"#{cmd}\"" unless command?(cmd)
|
|
255
253
|
end
|
|
256
254
|
|
|
257
|
-
def
|
|
258
|
-
skip
|
|
255
|
+
def skip_unless_symlinks_supported
|
|
256
|
+
skip 'Symlinks are not supported by Ruby on Windows' unless symlinks_supported?
|
|
259
257
|
end
|
|
260
258
|
|
|
261
259
|
end
|
|
@@ -273,6 +271,6 @@ end
|
|
|
273
271
|
#
|
|
274
272
|
class Time
|
|
275
273
|
def inspect
|
|
276
|
-
strftime("%a %b %d %H:%M:%S.#{
|
|
274
|
+
strftime("%a %b %d %H:%M:%S.#{'%06d' % usec} %Z %Y")
|
|
277
275
|
end
|
|
278
276
|
end
|