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.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +71 -46
  3. data/NEWS.md +14 -0
  4. data/lib/nanoc.rb +1 -1
  5. data/lib/nanoc/base/checksummer.rb +1 -1
  6. data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
  7. data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
  8. data/lib/nanoc/base/compilation/compiler.rb +11 -10
  9. data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
  10. data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
  11. data/lib/nanoc/base/compilation/filter.rb +1 -1
  12. data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
  13. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
  14. data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
  15. data/lib/nanoc/base/compilation/rule.rb +1 -1
  16. data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
  17. data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
  18. data/lib/nanoc/base/context.rb +1 -1
  19. data/lib/nanoc/base/core_ext/array.rb +1 -1
  20. data/lib/nanoc/base/core_ext/date.rb +1 -1
  21. data/lib/nanoc/base/core_ext/hash.rb +1 -1
  22. data/lib/nanoc/base/directed_graph.rb +3 -3
  23. data/lib/nanoc/base/memoization.rb +1 -1
  24. data/lib/nanoc/base/notification_center.rb +1 -1
  25. data/lib/nanoc/base/ordered_hash.rb +1 -1
  26. data/lib/nanoc/base/plugin_registry.rb +3 -3
  27. data/lib/nanoc/base/result_data/item_rep.rb +13 -11
  28. data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
  29. data/lib/nanoc/base/source_data/data_source.rb +3 -3
  30. data/lib/nanoc/base/source_data/item.rb +8 -8
  31. data/lib/nanoc/base/source_data/item_array.rb +1 -1
  32. data/lib/nanoc/base/source_data/layout.rb +1 -1
  33. data/lib/nanoc/base/source_data/site.rb +27 -18
  34. data/lib/nanoc/base/store.rb +3 -3
  35. data/lib/nanoc/base/temp_filename_factory.rb +2 -2
  36. data/lib/nanoc/cli.rb +6 -6
  37. data/lib/nanoc/cli/cleaning_stream.rb +1 -1
  38. data/lib/nanoc/cli/command_runner.rb +4 -3
  39. data/lib/nanoc/cli/commands/autocompile.rb +3 -3
  40. data/lib/nanoc/cli/commands/check.rb +3 -3
  41. data/lib/nanoc/cli/commands/compile.rb +23 -23
  42. data/lib/nanoc/cli/commands/create-item.rb +5 -5
  43. data/lib/nanoc/cli/commands/create-layout.rb +14 -14
  44. data/lib/nanoc/cli/commands/create-site.rb +6 -6
  45. data/lib/nanoc/cli/commands/deploy.rb +8 -8
  46. data/lib/nanoc/cli/commands/nanoc.rb +3 -3
  47. data/lib/nanoc/cli/commands/prune.rb +3 -3
  48. data/lib/nanoc/cli/commands/shell.rb +4 -4
  49. data/lib/nanoc/cli/commands/show-data.rb +5 -5
  50. data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
  51. data/lib/nanoc/cli/commands/show-rules.rb +4 -4
  52. data/lib/nanoc/cli/commands/sync.rb +1 -1
  53. data/lib/nanoc/cli/commands/update.rb +13 -13
  54. data/lib/nanoc/cli/commands/validate-css.rb +3 -3
  55. data/lib/nanoc/cli/commands/validate-html.rb +3 -3
  56. data/lib/nanoc/cli/commands/validate-links.rb +6 -6
  57. data/lib/nanoc/cli/commands/view.rb +4 -4
  58. data/lib/nanoc/cli/commands/watch.rb +11 -11
  59. data/lib/nanoc/cli/error_handler.rb +10 -10
  60. data/lib/nanoc/cli/logger.rb +1 -1
  61. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
  62. data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
  63. data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
  64. data/lib/nanoc/data_sources/filesystem.rb +16 -16
  65. data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
  66. data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
  67. data/lib/nanoc/data_sources/static.rb +1 -1
  68. data/lib/nanoc/extra/auto_compiler.rb +2 -2
  69. data/lib/nanoc/extra/checking/check.rb +11 -1
  70. data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
  71. data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
  72. data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
  73. data/lib/nanoc/extra/checking/runner.rb +10 -9
  74. data/lib/nanoc/extra/chick.rb +2 -2
  75. data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
  76. data/lib/nanoc/extra/deployers/fog.rb +2 -2
  77. data/lib/nanoc/extra/deployers/rsync.rb +3 -3
  78. data/lib/nanoc/extra/file_proxy.rb +3 -3
  79. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
  80. data/lib/nanoc/extra/link_collector.rb +3 -3
  81. data/lib/nanoc/extra/piper.rb +2 -2
  82. data/lib/nanoc/extra/pruner.rb +4 -3
  83. data/lib/nanoc/extra/validators/links.rb +2 -2
  84. data/lib/nanoc/extra/validators/w3c.rb +1 -1
  85. data/lib/nanoc/extra/vcs.rb +5 -5
  86. data/lib/nanoc/extra/vcses/dummy.rb +1 -1
  87. data/lib/nanoc/filters/asciidoc.rb +1 -1
  88. data/lib/nanoc/filters/bluecloth.rb +1 -1
  89. data/lib/nanoc/filters/coffeescript.rb +1 -1
  90. data/lib/nanoc/filters/colorize_syntax.rb +19 -21
  91. data/lib/nanoc/filters/erubis.rb +1 -1
  92. data/lib/nanoc/filters/handlebars.rb +1 -1
  93. data/lib/nanoc/filters/less.rb +2 -2
  94. data/lib/nanoc/filters/markaby.rb +1 -1
  95. data/lib/nanoc/filters/mustache.rb +1 -1
  96. data/lib/nanoc/filters/rdoc.rb +1 -1
  97. data/lib/nanoc/filters/relativize_paths.rb +5 -5
  98. data/lib/nanoc/filters/rubypants.rb +1 -1
  99. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
  100. data/lib/nanoc/filters/typogruby.rb +1 -1
  101. data/lib/nanoc/filters/xsl.rb +1 -1
  102. data/lib/nanoc/helpers/blogging.rb +12 -12
  103. data/lib/nanoc/helpers/capturing.rb +3 -3
  104. data/lib/nanoc/helpers/html_escape.rb +6 -6
  105. data/lib/nanoc/helpers/tagging.rb +1 -1
  106. data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
  107. data/lib/nanoc/tasks/clean.rake +1 -1
  108. data/lib/nanoc/tasks/clean.rb +1 -1
  109. data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
  110. data/lib/nanoc/version.rb +1 -1
  111. data/tasks/rubocop.rake +1 -0
  112. data/test/base/core_ext/array_spec.rb +7 -7
  113. data/test/base/core_ext/hash_spec.rb +1 -1
  114. data/test/base/test_checksum_store.rb +1 -1
  115. data/test/base/test_compiler.rb +14 -14
  116. data/test/base/test_compiler_dsl.rb +13 -13
  117. data/test/base/test_context.rb +2 -2
  118. data/test/base/test_dependency_tracker.rb +42 -42
  119. data/test/base/test_directed_graph.rb +102 -102
  120. data/test/base/test_item.rb +21 -21
  121. data/test/base/test_item_array.rb +19 -19
  122. data/test/base/test_item_rep.rb +50 -50
  123. data/test/base/test_layout.rb +6 -6
  124. data/test/base/test_outdatedness_checker.rb +2 -2
  125. data/test/base/test_rule_context.rb +2 -2
  126. data/test/base/test_site.rb +5 -5
  127. data/test/cli/commands/test_compile.rb +7 -7
  128. data/test/cli/commands/test_create_site.rb +2 -2
  129. data/test/cli/commands/test_deploy.rb +10 -10
  130. data/test/cli/commands/test_prune.rb +2 -2
  131. data/test/cli/commands/test_sync.rb +1 -1
  132. data/test/cli/commands/test_watch.rb +7 -7
  133. data/test/cli/test_cleaning_stream.rb +4 -4
  134. data/test/cli/test_cli.rb +3 -3
  135. data/test/cli/test_error_handler.rb +3 -3
  136. data/test/data_sources/test_filesystem.rb +19 -19
  137. data/test/data_sources/test_filesystem_unified.rb +30 -30
  138. data/test/data_sources/test_filesystem_verbose.rb +3 -3
  139. data/test/data_sources/test_static.rb +9 -9
  140. data/test/extra/checking/checks/test_stale.rb +8 -8
  141. data/test/extra/checking/test_check.rb +11 -1
  142. data/test/extra/checking/test_dsl.rb +1 -1
  143. data/test/extra/core_ext/test_enumerable.rb +2 -2
  144. data/test/extra/deployers/test_fog.rb +10 -10
  145. data/test/extra/deployers/test_rsync.rb +2 -2
  146. data/test/extra/test_auto_compiler.rb +28 -28
  147. data/test/extra/test_filesystem_tools.rb +3 -3
  148. data/test/extra/test_link_collector.rb +39 -20
  149. data/test/extra/validators/test_w3c.rb +5 -5
  150. data/test/filters/test_asciidoc.rb +2 -2
  151. data/test/filters/test_bluecloth.rb +1 -1
  152. data/test/filters/test_coffeescript.rb +1 -1
  153. data/test/filters/test_colorize_syntax.rb +20 -13
  154. data/test/filters/test_erb.rb +1 -1
  155. data/test/filters/test_kramdown.rb +1 -1
  156. data/test/filters/test_less.rb +10 -10
  157. data/test/filters/test_markaby.rb +2 -2
  158. data/test/filters/test_maruku.rb +2 -2
  159. data/test/filters/test_pandoc.rb +3 -3
  160. data/test/filters/test_rainpress.rb +4 -4
  161. data/test/filters/test_rdiscount.rb +2 -2
  162. data/test/filters/test_rdoc.rb +1 -1
  163. data/test/filters/test_redcarpet.rb +5 -5
  164. data/test/filters/test_redcloth.rb +5 -5
  165. data/test/filters/test_relativize_paths.rb +33 -31
  166. data/test/filters/test_rubypants.rb +2 -2
  167. data/test/filters/test_sass.rb +8 -8
  168. data/test/filters/test_slim.rb +3 -3
  169. data/test/filters/test_uglify_js.rb +1 -1
  170. data/test/filters/test_yui_compressor.rb +3 -3
  171. data/test/gem_loader.rb +1 -1
  172. data/test/helper.rb +14 -16
  173. data/test/helpers/test_blogging.rb +28 -28
  174. data/test/helpers/test_breadcrumbs.rb +12 -12
  175. data/test/helpers/test_capturing.rb +7 -7
  176. data/test/helpers/test_filtering.rb +16 -16
  177. data/test/helpers/test_link_to.rb +3 -3
  178. data/test/helpers/test_rendering.rb +1 -1
  179. data/test/helpers/test_tagging.rb +11 -11
  180. data/test/helpers/test_xml_sitemap.rb +18 -18
  181. data/test/tasks/test_clean.rb +8 -8
  182. metadata +2 -2
@@ -3,7 +3,7 @@
3
3
  class Nanoc::Extra::FilesystemToolsTest < Nanoc::TestCase
4
4
  def setup
5
5
  super
6
- skip_unless_have_symlink
6
+ skip_unless_symlinks_supported
7
7
  end
8
8
 
9
9
  def test_all_files_in_follows_symlinks_to_dirs
@@ -60,7 +60,7 @@ class Nanoc::Extra::FilesystemToolsTest < Nanoc::TestCase
60
60
 
61
61
  File.symlink('../bar', 'foo/barlink')
62
62
 
63
- expected_files = [ 'foo/barlink/y.md', 'foo/x.md' ]
63
+ expected_files = ['foo/barlink/y.md', 'foo/x.md']
64
64
  actual_files = Nanoc::Extra::FilesystemTools.all_files_in('foo').sort
65
65
  assert_equal expected_files, actual_files
66
66
  end
@@ -73,7 +73,7 @@ class Nanoc::Extra::FilesystemToolsTest < Nanoc::TestCase
73
73
  File.symlink('../bar', 'dir/bar-link')
74
74
 
75
75
  # Check
76
- expected_files = [ 'dir/bar-link', 'dir/foo' ]
76
+ expected_files = ['dir/bar-link', 'dir/foo']
77
77
  actual_files = Nanoc::Extra::FilesystemTools.all_files_in('dir').sort
78
78
  assert_equal expected_files, actual_files
79
79
  end
@@ -5,16 +5,23 @@ class Nanoc::Extra::LinkCollectorTest < Nanoc::TestCase
5
5
  def test_all
6
6
  # Create dummy data
7
7
  File.open('file-a.html', 'w') do |io|
8
- io << %[<a href="http://example.com/">A 1</a>\n]
9
- io << %[<a href="https://example.com/">A 2</a>\n]
10
- io << %[<a href="stuff/"A 3></a>\n]
11
- io << %[<a name="href-less-anchor">A 4</a>]
12
- io << %[<a href="https://example.com/with-fragment#moo">A 5</a>\n]
8
+ io << %(<a href="http://example.com/">A 1</a>
9
+ )
10
+ io << %(<a href="https://example.com/">A 2</a>
11
+ )
12
+ io << %(<a href="stuff/"A 3></a>
13
+ )
14
+ io << %(<a name="href-less-anchor">A 4</a>)
15
+ io << %(<a href="https://example.com/with-fragment#moo">A 5</a>
16
+ )
13
17
  end
14
18
  File.open('file-b.html', 'w') do |io|
15
- io << %[<a href="mailto:bob@example.com">B 1</a>\n]
16
- io << %[<a href="../stuff">B 2</a>\n]
17
- io << %[<a href="/stuff">B 3</a>\n]
19
+ io << %(<a href="mailto:bob@example.com">B 1</a>
20
+ )
21
+ io << %(<a href="../stuff">B 2</a>
22
+ )
23
+ io << %(<a href="/stuff">B 3</a>
24
+ )
18
25
  end
19
26
 
20
27
  # Create validator
@@ -37,14 +44,20 @@ class Nanoc::Extra::LinkCollectorTest < Nanoc::TestCase
37
44
  def test_external
38
45
  # Create dummy data
39
46
  File.open('file-a.html', 'w') do |io|
40
- io << %[<a href="http://example.com/">A 1</a>\n]
41
- io << %[<a href="https://example.com/">A 2</a>\n]
42
- io << %[<a href="stuff/"A 3></a>\n]
47
+ io << %(<a href="http://example.com/">A 1</a>
48
+ )
49
+ io << %(<a href="https://example.com/">A 2</a>
50
+ )
51
+ io << %(<a href="stuff/"A 3></a>
52
+ )
43
53
  end
44
54
  File.open('file-b.html', 'w') do |io|
45
- io << %[<a href="mailto:bob@example.com">B 1</a>\n]
46
- io << %[<a href="../stuff">B 2</a>\n]
47
- io << %[<a href="/stuff">B 3</a>\n]
55
+ io << %(<a href="mailto:bob@example.com">B 1</a>
56
+ )
57
+ io << %(<a href="../stuff">B 2</a>
58
+ )
59
+ io << %(<a href="/stuff">B 3</a>
60
+ )
48
61
  end
49
62
 
50
63
  # Create validator
@@ -64,14 +77,20 @@ class Nanoc::Extra::LinkCollectorTest < Nanoc::TestCase
64
77
  def test_internal
65
78
  # Create dummy data
66
79
  File.open('file-a.html', 'w') do |io|
67
- io << %[<a href="http://example.com/">A 1</a>\n]
68
- io << %[<a href="https://example.com/">A 2</a>\n]
69
- io << %[<a href="stuff/"A 3></a>\n]
80
+ io << %(<a href="http://example.com/">A 1</a>
81
+ )
82
+ io << %(<a href="https://example.com/">A 2</a>
83
+ )
84
+ io << %(<a href="stuff/"A 3></a>
85
+ )
70
86
  end
71
87
  File.open('file-b.html', 'w') do |io|
72
- io << %[<a href="mailto:bob@example.com">B 1</a>\n]
73
- io << %[<a href="../stuff">B 2</a>\n]
74
- io << %[<a href="/stuff">B 3</a>\n]
88
+ io << %(<a href="mailto:bob@example.com">B 1</a>
89
+ )
90
+ io << %(<a href="../stuff">B 2</a>
91
+ )
92
+ io << %(<a href="/stuff">B 3</a>
93
+ )
75
94
  end
76
95
 
77
96
  # Create validator
@@ -6,14 +6,14 @@ class Nanoc::Extra::Validators::W3CTest < Nanoc::TestCase
6
6
  if_have 'w3c_validators' do
7
7
  with_site do |site|
8
8
  # Create some sample files
9
- %w{ foo bar baz }.each do |filename|
10
- %w{ xxx yyy }.each do |extension|
11
- File.open("output/#{filename}.#{extension}", 'w') { |io| io.write("hello") }
9
+ %w(foo bar baz).each do |filename|
10
+ %w(xxx yyy).each do |extension|
11
+ File.open("output/#{filename}.#{extension}", 'w') { |io| io.write('hello') }
12
12
  end
13
13
  end
14
14
 
15
15
  # Create validator
16
- w3c = Nanoc::Extra::Validators::W3C.new('.', [ :html ])
16
+ w3c = Nanoc::Extra::Validators::W3C.new('.', [:html])
17
17
 
18
18
  # Run
19
19
  w3c.run
@@ -25,7 +25,7 @@ class Nanoc::Extra::Validators::W3CTest < Nanoc::TestCase
25
25
  if_have 'w3c_validators' do
26
26
  with_site do |site|
27
27
  # Create validator
28
- w3c = Nanoc::Extra::Validators::W3C.new('.', [ :foo ])
28
+ w3c = Nanoc::Extra::Validators::W3C.new('.', [:foo])
29
29
 
30
30
  # Test
31
31
  exception = assert_raises Nanoc::Errors::GenericTrivial do
@@ -3,13 +3,13 @@
3
3
  class Nanoc::Filters::AsciiDocTest < Nanoc::TestCase
4
4
 
5
5
  def test_filter
6
- skip_unless_have_command "asciidoc"
6
+ skip_unless_have_command 'asciidoc'
7
7
 
8
8
  # Create filter
9
9
  filter = ::Nanoc::Filters::AsciiDoc.new
10
10
 
11
11
  # Run filter
12
- result = filter.setup_and_run("== Blah blah")
12
+ result = filter.setup_and_run('== Blah blah')
13
13
  assert_match %r{<h2 id="_blah_blah">Blah blah</h2>}, result
14
14
  end
15
15
 
@@ -8,7 +8,7 @@ class Nanoc::Filters::BlueClothTest < Nanoc::TestCase
8
8
  filter = ::Nanoc::Filters::BlueCloth.new
9
9
 
10
10
  # Run filter
11
- result = filter.setup_and_run("> Quote")
11
+ result = filter.setup_and_run('> Quote')
12
12
  assert_match %r{<blockquote>\s*<p>Quote</p>\s*</blockquote>}, result
13
13
  end
14
14
  end
@@ -9,7 +9,7 @@ class Nanoc::Filters::CoffeeScriptTest < Nanoc::TestCase
9
9
 
10
10
  # Run filter (no assigns)
11
11
  result = filter.setup_and_run('alert 42')
12
- assert_equal("(function() { alert(42); }).call(this); ", result.gsub(/\s+/, ' '))
12
+ assert_equal('(function() { alert(42); }).call(this); ', result.gsub(/\s+/, ' '))
13
13
  end
14
14
  end
15
15
 
@@ -62,7 +62,7 @@ class Nanoc::Filters::ColorizeSyntaxTest < Nanoc::TestCase
62
62
  </body>
63
63
  </html>
64
64
  EOS
65
- expected_output_regex = %r[^<!DOCTYPE html>\s*<html>\s*<head>\s*<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\s*<title>Foo</title>\s*</head>\s*<body>\s*<pre title="moo"><code class="language-ruby"># comment</code></pre>\s*</body>\s*</html>]
65
+ expected_output_regex = %r{^<!DOCTYPE html>\s*<html>\s*<head>\s*<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\s*<title>Foo</title>\s*</head>\s*<body>\s*<pre title="moo"><code class="language-ruby"># comment</code></pre>\s*</body>\s*</html>}
66
66
 
67
67
  # Run filter
68
68
  actual_output = filter.setup_and_run(input, :default_colorizer => :dummy, :is_fullpage => true)
@@ -76,7 +76,8 @@ EOS
76
76
  filter = ::Nanoc::Filters::ColorizeSyntax.new
77
77
 
78
78
  # Get input and expected output
79
- input = %[<pre title="moo"><code>#!ruby\n# comment</code></pre>]
79
+ input = %(<pre title="moo"><code>#!ruby
80
+ # comment</code></pre>)
80
81
  expected_output = CODERAY_PRE + '<pre title="moo"><code class="language-ruby"><span class="comment"># comment</span></code></pre>' + CODERAY_POST
81
82
 
82
83
  # Run filter
@@ -91,7 +92,9 @@ EOS
91
92
  filter = ::Nanoc::Filters::ColorizeSyntax.new
92
93
 
93
94
  # Get input and expected output
94
- input = %[<pre title="moo"><code>def moo ; end\n#!ruby\n# comment</code></pre>]
95
+ input = %(<pre title="moo"><code>def moo ; end
96
+ #!ruby
97
+ # comment</code></pre>)
95
98
  expected_output = "<pre title=\"moo\"><code>def moo ; end\n#!ruby\n# comment</code></pre>"
96
99
 
97
100
  # Run filter
@@ -106,8 +109,10 @@ EOS
106
109
  filter = ::Nanoc::Filters::ColorizeSyntax.new
107
110
 
108
111
  # Get input and expected output
109
- input = %[<pre title="moo"><code class="language-ruby">#!ruby\n# comment</code></pre>]
110
- expected_output = CODERAY_PRE + %[<pre title="moo"><code class="language-ruby"><span class="doctype">#!ruby</span>\n<span class="comment"># comment</span></code></pre>] + CODERAY_POST
112
+ input = %(<pre title="moo"><code class="language-ruby">#!ruby
113
+ # comment</code></pre>)
114
+ expected_output = CODERAY_PRE + %(<pre title="moo"><code class="language-ruby"><span class="doctype">#!ruby</span>
115
+ <span class="comment"># comment</span></code></pre>) + CODERAY_POST
111
116
 
112
117
  # Run filter
113
118
  actual_output = filter.setup_and_run(input)
@@ -132,7 +137,7 @@ EOS
132
137
 
133
138
  def test_pygmentize
134
139
  if_have 'nokogiri' do
135
- skip_unless_have_command "pygmentize"
140
+ skip_unless_have_command 'pygmentize'
136
141
 
137
142
  # Create filter
138
143
  filter = ::Nanoc::Filters::ColorizeSyntax.new
@@ -148,7 +153,7 @@ EOS
148
153
  end
149
154
 
150
155
  def test_pygmentsrb
151
- skip "pygments.rb does not support Windows" if on_windows?
156
+ skip 'pygments.rb does not support Windows' if on_windows?
152
157
  if_have 'pygments', 'nokogiri' do
153
158
  # Create filter
154
159
  filter = ::Nanoc::Filters::ColorizeSyntax.new
@@ -165,13 +170,15 @@ EOS
165
170
 
166
171
  def test_simon_highlight
167
172
  if_have 'nokogiri' do
168
- skip_unless_have_command "highlight"
173
+ skip_unless_have_command 'highlight'
169
174
 
170
175
  # Create filter
171
176
  filter = ::Nanoc::Filters::ColorizeSyntax.new
172
177
 
173
178
  # Get input and expected output
174
- input = %Q[<pre title="moo"><code class="language-ruby">\n# comment\n</code></pre>]
179
+ input = %Q(<pre title="moo"><code class="language-ruby">
180
+ # comment
181
+ </code></pre>)
175
182
  expected_output = '<pre title="moo"><code class="language-ruby"><span class="hl slc"># comment</span></code></pre>'
176
183
 
177
184
  # Run filter
@@ -223,7 +230,7 @@ EOS
223
230
  end
224
231
 
225
232
  def test_colorize_syntax_with_default_colorizer
226
- skip_unless_have_command "pygmentize"
233
+ skip_unless_have_command 'pygmentize'
227
234
 
228
235
  if_have 'nokogiri' do
229
236
  # Create filter
@@ -252,13 +259,13 @@ EOS
252
259
  input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
253
260
 
254
261
  # Run filter
255
- [ :albino, :pygmentize, :simon_highlight ].each do |colorizer|
262
+ [:albino, :pygmentize, :simon_highlight].each do |colorizer|
256
263
  begin
257
264
  input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
258
265
  filter.setup_and_run(
259
266
  input,
260
267
  :colorizers => { :ruby => colorizer })
261
- flunk "expected colorizer to raise if no executable is available"
268
+ flunk 'expected colorizer to raise if no executable is available'
262
269
  rescue
263
270
  end
264
271
  end
@@ -361,7 +368,7 @@ EOS
361
368
  filter = ::Nanoc::Filters::ColorizeSyntax.new
362
369
 
363
370
  # Simple test
364
- assert_equal " bar", filter.send(:strip, "\n bar")
371
+ assert_equal ' bar', filter.send(:strip, "\n bar")
365
372
 
366
373
  # Get input and expected output
367
374
  input = <<EOS
@@ -72,7 +72,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
72
72
 
73
73
  # Set up
74
74
  filter = ::Nanoc::Filters::ERB.new
75
- File.open('moo', 'w') { |io| io.write("one miiillion dollars") }
75
+ File.open('moo', 'w') { |io| io.write('one miiillion dollars') }
76
76
 
77
77
  # Without
78
78
  res = filter.setup_and_run('<%= File.read("moo") %>', :safe_level => nil)
@@ -8,7 +8,7 @@ class Nanoc::Filters::KramdownTest < Nanoc::TestCase
8
8
  filter = ::Nanoc::Filters::Kramdown.new
9
9
 
10
10
  # Run filter
11
- result = filter.setup_and_run("This is _so_ **cool**!")
11
+ result = filter.setup_and_run('This is _so_ **cool**!')
12
12
  assert_equal("<p>This is <em>so</em> <strong>cool</strong>!</p>\n", result)
13
13
  end
14
14
  end
@@ -5,10 +5,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
5
5
  def test_filter
6
6
  if_have 'less' do
7
7
  # Create item
8
- @item = Nanoc::Item.new("blah", { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
8
+ @item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
9
9
 
10
10
  # Create filter
11
- filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [ @item ])
11
+ filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
12
12
 
13
13
  # Run filter
14
14
  result = filter.setup_and_run('.foo { bar: 1 + 1 }')
@@ -23,10 +23,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
23
23
  File.open('content/foo/bar/imported_file.less', 'w') { |io| io.write('p { color: red; }') }
24
24
 
25
25
  # Create item
26
- @item = Nanoc::Item.new("blah", { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
26
+ @item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
27
27
 
28
28
  # Create filter
29
- filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [ @item ])
29
+ filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
30
30
 
31
31
  # Run filter
32
32
  result = filter.setup_and_run('@import "content/foo/bar/imported_file.less";')
@@ -42,10 +42,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
42
42
 
43
43
  # Create item
44
44
  File.open('content/foo/bar.txt', 'w') { |io| io.write('meh') }
45
- @item = Nanoc::Item.new("blah", { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
45
+ @item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
46
46
 
47
47
  # Create filter
48
- filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [ @item ])
48
+ filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
49
49
 
50
50
  # Run filter
51
51
  result = filter.setup_and_run('@import "bar/imported_file.less";')
@@ -62,7 +62,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
62
62
  io.write('@import "b.less";')
63
63
  end
64
64
  File.open('content/b.less', 'w') do |io|
65
- io.write("p { color: red; }")
65
+ io.write('p { color: red; }')
66
66
  end
67
67
 
68
68
  # Update rules
@@ -92,7 +92,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
92
92
 
93
93
  # Update included file
94
94
  File.open('content/b.less', 'w') do |io|
95
- io.write("p { color: blue; }")
95
+ io.write('p { color: blue; }')
96
96
  end
97
97
 
98
98
  # Recompile
@@ -111,10 +111,10 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
111
111
  def test_compression
112
112
  if_have 'less' do
113
113
  # Create item
114
- @item = Nanoc::Item.new("blah", { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
114
+ @item = Nanoc::Item.new('blah', { :content_filename => 'content/foo/bar.txt' }, '/foo/bar/')
115
115
 
116
116
  # Create filter
117
- filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [ @item ])
117
+ filter = ::Nanoc::Filters::Less.new(:item => @item, :items => [@item])
118
118
 
119
119
  # Run filter with compress option
120
120
  result = filter.setup_and_run('.foo { bar: a; } .bar { foo: b; }', :compress => true)
@@ -5,7 +5,7 @@ class Nanoc::Filters::MarkabyTest < Nanoc::TestCase
5
5
  def test_filter
6
6
  # Don’t run this test on 1.9.x, because it breaks and it annoys me
7
7
  if RUBY_VERSION >= '1.9'
8
- skip "Markaby is not compatible with 1.9.x"
8
+ skip 'Markaby is not compatible with 1.9.x'
9
9
  return
10
10
  end
11
11
 
@@ -15,7 +15,7 @@ class Nanoc::Filters::MarkabyTest < Nanoc::TestCase
15
15
 
16
16
  # Run filter
17
17
  result = filter.setup_and_run("html do\nend")
18
- assert_equal("<html></html>", result)
18
+ assert_equal('<html></html>', result)
19
19
  end
20
20
  end
21
21
 
@@ -8,8 +8,8 @@ class Nanoc::Filters::MarukuTest < Nanoc::TestCase
8
8
  filter = ::Nanoc::Filters::Maruku.new
9
9
 
10
10
  # Run filter
11
- result = filter.setup_and_run("This is _so_ *cool*!")
12
- assert_equal("<p>This is <em>so</em> <em>cool</em>!</p>", result.strip)
11
+ result = filter.setup_and_run('This is _so_ *cool*!')
12
+ assert_equal('<p>This is <em>so</em> <em>cool</em>!</p>', result.strip)
13
13
  end
14
14
  end
15
15
 
@@ -4,7 +4,7 @@ class Nanoc::Filters::PandocTest < Nanoc::TestCase
4
4
 
5
5
  def test_filter
6
6
  if_have 'pandoc-ruby' do
7
- skip_unless_have_command "pandoc"
7
+ skip_unless_have_command 'pandoc'
8
8
 
9
9
  # Create filter
10
10
  filter = ::Nanoc::Filters::Pandoc.new
@@ -17,13 +17,13 @@ class Nanoc::Filters::PandocTest < Nanoc::TestCase
17
17
 
18
18
  def test_params
19
19
  if_have 'pandoc-ruby' do
20
- skip_unless_have_command "pandoc"
20
+ skip_unless_have_command 'pandoc'
21
21
 
22
22
  # Create filter
23
23
  filter = ::Nanoc::Filters::Pandoc.new
24
24
 
25
25
  # Run filter
26
- opts = [ :s, {:f => :markdown, :to => :html}, 'no-wrap', :toc ]
26
+ opts = [:s, {:f => :markdown, :to => :html}, 'no-wrap', :toc]
27
27
  result = filter.setup_and_run("# Heading\n", *opts)
28
28
  assert_match '<div id="TOC">', result
29
29
  assert_match(%r{<h1 id=\"heading\">Heading</h1>\s*}, result)
@@ -8,8 +8,8 @@ class Nanoc::Filters::RainpressTest < Nanoc::TestCase
8
8
  filter = ::Nanoc::Filters::Rainpress.new
9
9
 
10
10
  # Run filter
11
- result = filter.setup_and_run("body { color: black; }")
12
- assert_equal("body{color:#000}", result)
11
+ result = filter.setup_and_run('body { color: black; }')
12
+ assert_equal('body{color:#000}', result)
13
13
  end
14
14
  end
15
15
 
@@ -19,8 +19,8 @@ class Nanoc::Filters::RainpressTest < Nanoc::TestCase
19
19
  filter = ::Nanoc::Filters::Rainpress.new
20
20
 
21
21
  # Run filter
22
- result = filter.setup_and_run("body { color: #aabbcc; }", :colors => false)
23
- assert_equal("body{color:#aabbcc}", result)
22
+ result = filter.setup_and_run('body { color: #aabbcc; }', :colors => false)
23
+ assert_equal('body{color:#aabbcc}', result)
24
24
  end
25
25
  end
26
26