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
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
4
4
 
5
- def new_data_source(params=nil)
5
+ def new_data_source(params = nil)
6
6
  # Mock site
7
7
  site = Nanoc::Site.new({})
8
8
 
@@ -102,7 +102,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
102
102
  assert_equal expected_out[i].stuff[1][:file].path, actual_out[i].stuff[1][:file].path, 'file paths must match'
103
103
  expected_out[i].stuff[1][:file].close;
104
104
  actual_out[i].stuff[1][:file].close
105
- [ 'num', :filename, :extension ].each do |key|
105
+ ['num', :filename, :extension].each do |key|
106
106
  assert_equal expected_out[i].stuff[1][key], actual_out[i].stuff[1][key], "attribute key #{key} must match"
107
107
  end
108
108
  end
@@ -114,7 +114,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
114
114
 
115
115
  # Create sample files
116
116
  FileUtils.mkdir_p('foo')
117
- File.open('foo/stuff.dat', 'w') { |io| io.write("random binary data") }
117
+ File.open('foo/stuff.dat', 'w') { |io| io.write('random binary data') }
118
118
 
119
119
  # Load
120
120
  items = data_source.send(:load_objects, 'foo', 'item', Nanoc::Item)
@@ -132,7 +132,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
132
132
 
133
133
  # Create sample files
134
134
  FileUtils.mkdir_p('foo')
135
- File.open('foo/stuff.dat', 'w') { |io| io.write("random binary data") }
135
+ File.open('foo/stuff.dat', 'w') { |io| io.write('random binary data') }
136
136
 
137
137
  # Load
138
138
  assert_raises(RuntimeError) do
@@ -201,7 +201,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
201
201
  data_source = new_data_source(:allow_periods_in_identifiers => true)
202
202
  expectations.each_pair do |meta_filename, expected_identifier|
203
203
  content_filename = meta_filename.sub(/yaml$/, 'html')
204
- [ meta_filename, content_filename ].each do |filename|
204
+ [meta_filename, content_filename].each do |filename|
205
205
  assert_equal(
206
206
  expected_identifier,
207
207
  data_source.instance_eval { identifier_for_filename(filename) }
@@ -227,7 +227,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
227
227
  data_source = new_data_source
228
228
  expectations.each_pair do |meta_filename, expected_identifier|
229
229
  content_filename = meta_filename.sub(/yaml$/, 'html')
230
- [ meta_filename, content_filename ].each do |filename|
230
+ [meta_filename, content_filename].each do |filename|
231
231
  assert_equal(
232
232
  expected_identifier,
233
233
  data_source.instance_eval { identifier_for_filename(filename) }
@@ -296,13 +296,13 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
296
296
  FileUtils.mkdir_p('foo/a/b')
297
297
  File.open('foo/a/b/c.yaml', 'w') { |io| io.write("---\nnum: 1\n") }
298
298
  File.open('foo/b.c.yaml', 'w') { |io| io.write("---\nnum: 2\n") }
299
- File.open('foo/b.c.html', 'w') { |io| io.write("test 2") }
300
- File.open('foo/car.html', 'w') { |io| io.write("test 3") }
301
- File.open('foo/ugly.yaml~', 'w') { |io| io.write("blah") }
302
- File.open('foo/ugly.html~', 'w') { |io| io.write("blah") }
303
- File.open('foo/ugly.html.orig', 'w') { |io| io.write("blah") }
304
- File.open('foo/ugly.html.rej', 'w') { |io| io.write("blah") }
305
- File.open('foo/ugly.html.bak', 'w') { |io| io.write("blah") }
299
+ File.open('foo/b.c.html', 'w') { |io| io.write('test 2') }
300
+ File.open('foo/car.html', 'w') { |io| io.write('test 3') }
301
+ File.open('foo/ugly.yaml~', 'w') { |io| io.write('blah') }
302
+ File.open('foo/ugly.html~', 'w') { |io| io.write('blah') }
303
+ File.open('foo/ugly.html.orig', 'w') { |io| io.write('blah') }
304
+ File.open('foo/ugly.html.rej', 'w') { |io| io.write('blah') }
305
+ File.open('foo/ugly.html.bak', 'w') { |io| io.write('blah') }
306
306
 
307
307
  # Get expected output
308
308
  expected_out = [
@@ -358,7 +358,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
358
358
  actual_file.close unless actual_file.nil?
359
359
  expected_file.close unless expected_file.nil?
360
360
 
361
- [ 'num', :content_filename, :meta_filename, :extension ].each do |key|
361
+ ['num', :content_filename, :meta_filename, :extension].each do |key|
362
362
  assert_equal expected_out[i].stuff[1][key], actual_out[i].stuff[1][key], "attribute key #{key} must match"
363
363
  end
364
364
  end
@@ -384,13 +384,13 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
384
384
  FileUtils.mkdir_p('foo/a/b')
385
385
  File.open('foo/a/b/c.yaml', 'w') { |io| io.write("---\nnum: 1\n") }
386
386
  File.open('foo/b.yaml', 'w') { |io| io.write("---\nnum: 2\n") }
387
- File.open('foo/b.html.erb', 'w') { |io| io.write("test 2") }
388
- File.open('foo/car.html', 'w') { |io| io.write("test 3") }
389
- File.open('foo/ugly.yaml~', 'w') { |io| io.write("blah") }
390
- File.open('foo/ugly.html~', 'w') { |io| io.write("blah") }
391
- File.open('foo/ugly.html.orig', 'w') { |io| io.write("blah") }
392
- File.open('foo/ugly.html.rej', 'w') { |io| io.write("blah") }
393
- File.open('foo/ugly.html.bak', 'w') { |io| io.write("blah") }
387
+ File.open('foo/b.html.erb', 'w') { |io| io.write('test 2') }
388
+ File.open('foo/car.html', 'w') { |io| io.write('test 3') }
389
+ File.open('foo/ugly.yaml~', 'w') { |io| io.write('blah') }
390
+ File.open('foo/ugly.html~', 'w') { |io| io.write('blah') }
391
+ File.open('foo/ugly.html.orig', 'w') { |io| io.write('blah') }
392
+ File.open('foo/ugly.html.rej', 'w') { |io| io.write('blah') }
393
+ File.open('foo/ugly.html.bak', 'w') { |io| io.write('blah') }
394
394
 
395
395
  # Get expected output
396
396
  expected_out = [
@@ -446,7 +446,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
446
446
  actual_file.close unless actual_file.nil?
447
447
  expected_file.close unless expected_file.nil?
448
448
 
449
- [ 'num', :content_filename, :meta_filename, :extension ].each do |key|
449
+ ['num', :content_filename, :meta_filename, :extension].each do |key|
450
450
  assert_equal expected_out[i].stuff[1][key], actual_out[i].stuff[1][key], "attribute key #{key} must match"
451
451
  end
452
452
  end
@@ -517,8 +517,8 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
517
517
 
518
518
  def test_compile_iso_8859_1_site
519
519
  # Check encoding
520
- if !''.respond_to?(:encode)
521
- skip "Test only works on 1.9.x"
520
+ unless ''.respond_to?(:encode)
521
+ skip 'Test only works on 1.9.x'
522
522
  return
523
523
  end
524
524
 
@@ -526,7 +526,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
526
526
  data_source = new_data_source
527
527
 
528
528
  # Create item
529
- data_source.create_item("Hëllö", {}, '/foo/')
529
+ data_source.create_item('Hëllö', {}, '/foo/')
530
530
 
531
531
  # Parse
532
532
  begin
@@ -536,7 +536,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
536
536
  items = data_source.items
537
537
 
538
538
  assert_equal 1, items.size
539
- assert_equal Encoding.find("UTF-8"), items[0].raw_content.encoding
539
+ assert_equal Encoding.find('UTF-8'), items[0].raw_content.encoding
540
540
  ensure
541
541
  Encoding.default_external = original_default_external_encoding
542
542
  end
@@ -544,8 +544,8 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
544
544
 
545
545
  def test_compile_iso_8859_1_site_with_explicit_encoding
546
546
  # Check encoding
547
- if !''.respond_to?(:encode)
548
- skip "Test only works on 1.9.x"
547
+ unless ''.respond_to?(:encode)
548
+ skip 'Test only works on 1.9.x'
549
549
  return
550
550
  end
551
551
 
@@ -558,7 +558,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
558
558
  original_default_external_encoding = Encoding.default_external
559
559
  Encoding.default_external = 'ISO-8859-1'
560
560
 
561
- data_source.create_item("Hëllö", {}, '/foo/')
561
+ data_source.create_item('Hëllö', {}, '/foo/')
562
562
  ensure
563
563
  Encoding.default_external = original_default_external_encoding
564
564
  end
@@ -566,7 +566,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
566
566
  # Parse
567
567
  items = data_source.items
568
568
  assert_equal 1, items.size
569
- assert_equal Encoding.find("UTF-8"), items[0].raw_content.encoding
569
+ assert_equal Encoding.find('UTF-8'), items[0].raw_content.encoding
570
570
  end
571
571
 
572
572
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
4
4
 
5
- def new_data_source(params=nil)
5
+ def new_data_source(params = nil)
6
6
  # Mock site
7
7
  site = Nanoc::Site.new({})
8
8
 
@@ -34,7 +34,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
34
34
  io.write("title: Bar\n")
35
35
  end
36
36
  File.open('content/bar/bar.xml', 'w') do |io|
37
- io.write("Lorem ipsum dolor sit amet...")
37
+ io.write('Lorem ipsum dolor sit amet...')
38
38
  end
39
39
 
40
40
  # Load items
@@ -268,7 +268,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
268
268
 
269
269
  # Create sample files
270
270
  FileUtils.mkdir_p('foo')
271
- File.open('foo/stuff.dat', 'w') { |io| io.write("random binary data") }
271
+ File.open('foo/stuff.dat', 'w') { |io| io.write('random binary data') }
272
272
 
273
273
  # Load
274
274
  items = data_source.send(:load_objects, 'foo', 'item', Nanoc::Item)
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Nanoc::DataSources::StaticTest < Nanoc::TestCase
4
4
 
5
- def new_data_source(params=nil)
5
+ def new_data_source(params = nil)
6
6
  # Mock site
7
7
  site = Nanoc::Site.new({})
8
8
 
@@ -14,7 +14,7 @@ class Nanoc::DataSources::StaticTest < Nanoc::TestCase
14
14
  end
15
15
 
16
16
  def test_items_with_symlinks
17
- skip_unless_have_symlink
17
+ skip_unless_symlinks_supported
18
18
 
19
19
  # Create data source
20
20
  data_source = new_data_source(:prefix => 'foo')
@@ -23,16 +23,16 @@ class Nanoc::DataSources::StaticTest < Nanoc::TestCase
23
23
  FileUtils.mkdir_p('foo')
24
24
  FileUtils.mkdir_p('foo-outside-1')
25
25
  FileUtils.mkdir_p('foo-outside-2')
26
- File.open('foo/a.png', 'w') { |io| io.write("random binary data") }
27
- File.open('foo-outside-1/b.png', 'w') { |io| io.write("more binary data") }
28
- File.open('foo-outside-2/c.png', 'w') { |io| io.write("yet more binary data") }
26
+ File.open('foo/a.png', 'w') { |io| io.write('random binary data') }
27
+ File.open('foo-outside-1/b.png', 'w') { |io| io.write('more binary data') }
28
+ File.open('foo-outside-2/c.png', 'w') { |io| io.write('yet more binary data') }
29
29
 
30
30
  # Create symlinks
31
31
  File.symlink('../foo-outside-1', 'foo/1')
32
32
  File.symlink('../foo-outside-2/c.png', 'foo/c.png')
33
33
 
34
34
  # Check all files
35
- expected_filenames = [ 'foo/a.png', 'foo/1/b.png', 'foo/c.png' ].sort
35
+ expected_filenames = ['foo/a.png', 'foo/1/b.png', 'foo/c.png'].sort
36
36
  actual_filenames = Nanoc::Extra::FilesystemTools.all_files_in('foo').sort
37
37
  assert_equal expected_filenames, actual_filenames
38
38
 
@@ -50,9 +50,9 @@ class Nanoc::DataSources::StaticTest < Nanoc::TestCase
50
50
  # Create sample files
51
51
  FileUtils.mkdir_p('foo')
52
52
  FileUtils.mkdir_p('foo/a/b')
53
- File.open('foo/bar.png', 'w') { |io| io.write("random binary data") }
54
- File.open('foo/b.c.css', 'w') { |io| io.write("more binary data") }
55
- File.open('foo/a/b/c.gif', 'w') { |io| io.write("yet more binary data") }
53
+ File.open('foo/bar.png', 'w') { |io| io.write('random binary data') }
54
+ File.open('foo/b.c.css', 'w') { |io| io.write('more binary data') }
55
+ File.open('foo/a/b/c.gif', 'w') { |io| io.write('yet more binary data') }
56
56
 
57
57
  # Get expected and actual output
58
58
  expected_out = [
@@ -20,12 +20,12 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
20
20
 
21
21
  # Empty
22
22
  FileUtils.mkdir_p('output')
23
- assert self.calc_issues.empty?
23
+ assert calc_issues.empty?
24
24
 
25
25
  # One OK file
26
26
  File.open('content/index.html', 'w') { |io| io.write('stuff') }
27
27
  File.open('output/index.html', 'w') { |io| io.write('stuff') }
28
- assert self.calc_issues.empty?
28
+ assert calc_issues.empty?
29
29
  end
30
30
  end
31
31
 
@@ -36,10 +36,10 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
36
36
 
37
37
  File.open('content/index.html', 'w') { |io| io.write('stuff') }
38
38
  File.open('output/WRONG.html', 'w') { |io| io.write('stuff') }
39
- assert_equal 1, self.calc_issues.count
40
- issue = self.calc_issues.to_a[0]
41
- assert_equal "file without matching item", issue.description
42
- assert_equal "output/WRONG.html", issue.subject
39
+ assert_equal 1, calc_issues.count
40
+ issue = calc_issues.to_a[0]
41
+ assert_equal 'file without matching item', issue.description
42
+ assert_equal 'output/WRONG.html', issue.subject
43
43
  end
44
44
  end
45
45
 
@@ -51,7 +51,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
51
51
  File.open('nanoc.yaml', 'w') { |io| io.write "prune:\n exclude: [ 'excluded.html' ]" }
52
52
  File.open('content/index.html', 'w') { |io| io.write('stuff') }
53
53
  File.open('output/excluded.html', 'w') { |io| io.write('stuff') }
54
- assert self.calc_issues.empty?
54
+ assert calc_issues.empty?
55
55
  end
56
56
  end
57
57
 
@@ -63,7 +63,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
63
63
  File.open('nanoc.yaml', 'w') { |io| io.write "prune:\n blah: meh" }
64
64
  File.open('content/index.html', 'w') { |io| io.write('stuff') }
65
65
  File.open('output/excluded.html', 'w') { |io| io.write('stuff') }
66
- refute self.calc_issues.empty?
66
+ refute calc_issues.empty?
67
67
  end
68
68
  end
69
69
 
@@ -7,7 +7,17 @@ class Nanoc::Extra::Checking::CheckTest < Nanoc::TestCase
7
7
  check = Nanoc::Extra::Checking::Check.new(site)
8
8
  assert check.output_filenames.empty?
9
9
  File.open('output/foo.html', 'w') { |io| io.write 'hello' }
10
- assert_equal [ 'output/foo.html' ], check.output_filenames
10
+ assert_equal ['output/foo.html'], check.output_filenames
11
+ end
12
+ end
13
+
14
+ def test_no_output_dir
15
+ with_site do |site|
16
+ site.config[:output_dir] = 'non-existent'
17
+ check = Nanoc::Extra::Checking::Check.new(site)
18
+ assert_raises Nanoc::Extra::Checking::OutputDirNotFoundError do
19
+ check.output_filenames
20
+ end
11
21
  end
12
22
  end
13
23
 
@@ -11,7 +11,7 @@ class Nanoc::Extra::Checking::DSLTest < Nanoc::TestCase
11
11
  refute Nanoc::Extra::Checking::Check.named(:foo).nil?
12
12
 
13
13
  # One check marked for deployment
14
- assert_equal [ :bar ], dsl.deploy_checks
14
+ assert_equal [:bar], dsl.deploy_checks
15
15
  end
16
16
  end
17
17
 
@@ -17,9 +17,9 @@ class Nanoc::ExtraCoreExtEnumerableTest < Nanoc::TestCase
17
17
  end
18
18
 
19
19
  def test_group_by
20
- input = MyCollection.new([ 'foo', 'bar', 'baz' ])
20
+ input = MyCollection.new(['foo', 'bar', 'baz'])
21
21
 
22
- output_expected = { ?f => [ 'foo' ], ?b => [ 'bar', 'baz' ] }
22
+ output_expected = { ?f => ['foo'], ?b => ['bar', 'baz'] }
23
23
  output_actual = input.group_by { |i| i[0] }
24
24
 
25
25
  assert_equal output_expected, output_actual
@@ -14,8 +14,8 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
14
14
 
15
15
  # Create site
16
16
  FileUtils.mkdir_p('output')
17
- File.open('output/meow', 'w') { |io| io.write "I am a cat!" }
18
- File.open('output/bark', 'w') { |io| io.write "I am a dog!" }
17
+ File.open('output/meow', 'w') { |io| io.write 'I am a cat!' }
18
+ File.open('output/bark', 'w') { |io| io.write 'I am a dog!' }
19
19
 
20
20
  # Create local cloud (but not bucket)
21
21
  FileUtils.mkdir_p('mylocalcloud')
@@ -26,8 +26,8 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
26
26
  # Check
27
27
  assert File.file?('mylocalcloud/mybucket/meow')
28
28
  assert File.file?('mylocalcloud/mybucket/bark')
29
- assert_equal "I am a cat!", File.read('mylocalcloud/mybucket/meow')
30
- assert_equal "I am a dog!", File.read('mylocalcloud/mybucket/bark')
29
+ assert_equal 'I am a cat!', File.read('mylocalcloud/mybucket/meow')
30
+ assert_equal 'I am a dog!', File.read('mylocalcloud/mybucket/bark')
31
31
  end
32
32
  end
33
33
 
@@ -47,8 +47,8 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
47
47
 
48
48
  # Create site
49
49
  FileUtils.mkdir_p('output')
50
- File.open('output/meow', 'w') { |io| io.write "I am a cat!" }
51
- File.open('output/bark', 'w') { |io| io.write "I am a dog!" }
50
+ File.open('output/meow', 'w') { |io| io.write 'I am a cat!' }
51
+ File.open('output/bark', 'w') { |io| io.write 'I am a dog!' }
52
52
 
53
53
  # Create local cloud (but not bucket)
54
54
  FileUtils.mkdir_p('mylocalcloud')
@@ -80,8 +80,8 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
80
80
 
81
81
  # Create site
82
82
  FileUtils.mkdir_p('output')
83
- File.open('output/meow', 'w') { |io| io.write "I am a cat!" }
84
- File.open('output/bark', 'w') { |io| io.write "I am a dog!" }
83
+ File.open('output/meow', 'w') { |io| io.write 'I am a cat!' }
84
+ File.open('output/bark', 'w') { |io| io.write 'I am a dog!' }
85
85
 
86
86
  # Create local cloud (but not bucket)
87
87
  FileUtils.mkdir_p('mylocalcloud')
@@ -93,8 +93,8 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
93
93
  refute File.file?('mylocalcloud/mybucket/etc')
94
94
  assert File.file?('mylocalcloud/mybucket/meow')
95
95
  assert File.file?('mylocalcloud/mybucket/bark')
96
- assert_equal "I am a cat!", File.read('mylocalcloud/mybucket/meow')
97
- assert_equal "I am a dog!", File.read('mylocalcloud/mybucket/bark')
96
+ assert_equal 'I am a cat!', File.read('mylocalcloud/mybucket/meow')
97
+ assert_equal 'I am a dog!', File.read('mylocalcloud/mybucket/bark')
98
98
  end
99
99
  end
100
100
 
@@ -59,7 +59,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
59
59
  # Check args
60
60
  opts = Nanoc::Extra::Deployers::Rsync::DEFAULT_OPTIONS
61
61
  assert_equal(
62
- [ 'rsync', opts, 'output/', 'asdf' ].flatten,
62
+ ['rsync', opts, 'output/', 'asdf'].flatten,
63
63
  rsync.instance_eval { @shell_cms_args }
64
64
  )
65
65
  end
@@ -82,7 +82,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
82
82
  # Check args
83
83
  opts = Nanoc::Extra::Deployers::Rsync::DEFAULT_OPTIONS
84
84
  assert_equal(
85
- [ 'echo', 'rsync', opts, 'output/', 'asdf' ].flatten,
85
+ ['echo', 'rsync', opts, 'output/', 'asdf'].flatten,
86
86
  rsync.instance_eval { @shell_cms_args }
87
87
  )
88
88
  end
@@ -11,13 +11,13 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
11
11
  # Create item
12
12
  FileUtils.mkdir_p('content/foo')
13
13
  File.open('content/foo/index.html', 'w') do |io|
14
- io.write "Moo!"
14
+ io.write 'Moo!'
15
15
  end
16
16
 
17
17
  # Create output file
18
18
  FileUtils.mkdir_p('output/foo')
19
19
  File.open('output/foo/index.html', 'w') do |io|
20
- io.write "Compiled moo!"
20
+ io.write 'Compiled moo!'
21
21
  end
22
22
 
23
23
  # Create site
@@ -36,7 +36,7 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
36
36
  assert_equal(200, status)
37
37
  assert_equal('text/html', headers['Content-Type'])
38
38
  body.each do |b|
39
- assert_equal "Compiled moo!", b
39
+ assert_equal 'Compiled moo!', b
40
40
  end
41
41
  end
42
42
  end
@@ -77,13 +77,13 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
77
77
  @expected_path_info = 'somefile.txt'
78
78
  @actual_path_info = env['PATH_INFO']
79
79
  end
80
- def file_server.expected_path_info ; @expected_path_info ; end
81
- def file_server.actual_path_info ; @actual_path_info ; end
80
+ def file_server.expected_path_info; @expected_path_info; end
81
+ def file_server.actual_path_info; @actual_path_info; end
82
82
 
83
83
  # Create site
84
84
  site = mock
85
85
  site.expects(:items).returns([])
86
- site.expects(:config).returns({ :output_dir => 'out', :index_filenames => [ 'index.html' ] })
86
+ site.expects(:config).returns({ :output_dir => 'out', :index_filenames => ['index.html'] })
87
87
 
88
88
  # Create autocompiler
89
89
  autocompiler = Nanoc::Extra::AutoCompiler.new('.')
@@ -111,13 +111,13 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
111
111
  @expected_path_info = '/foo/bar/index.html'
112
112
  @actual_path_info = env['PATH_INFO']
113
113
  end
114
- def file_server.expected_path_info ; @expected_path_info ; end
115
- def file_server.actual_path_info ; @actual_path_info ; end
114
+ def file_server.expected_path_info; @expected_path_info; end
115
+ def file_server.actual_path_info; @actual_path_info; end
116
116
 
117
117
  # Create site
118
118
  site = mock
119
119
  site.expects(:items).returns([])
120
- site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => [ 'index.html' ] })
120
+ site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => ['index.html'] })
121
121
 
122
122
  # Create autocompiler
123
123
  autocompiler = Nanoc::Extra::AutoCompiler.new('.')
@@ -145,13 +145,13 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
145
145
  @expected_path_info = 'foo/bar/'
146
146
  @actual_path_info = env['PATH_INFO']
147
147
  end
148
- def file_server.expected_path_info ; @expected_path_info ; end
149
- def file_server.actual_path_info ; @actual_path_info ; end
148
+ def file_server.expected_path_info; @expected_path_info; end
149
+ def file_server.actual_path_info; @actual_path_info; end
150
150
 
151
151
  # Create site
152
152
  site = mock
153
153
  site.expects(:items).returns([])
154
- site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => [ 'index.html' ] })
154
+ site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => ['index.html'] })
155
155
 
156
156
  # Create autocompiler
157
157
  autocompiler = Nanoc::Extra::AutoCompiler.new('.')
@@ -179,13 +179,13 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
179
179
  @expected_path_info = 'foo/bar'
180
180
  @actual_path_info = env['PATH_INFO']
181
181
  end
182
- def file_server.expected_path_info ; @expected_path_info ; end
183
- def file_server.actual_path_info ; @actual_path_info ; end
182
+ def file_server.expected_path_info; @expected_path_info; end
183
+ def file_server.actual_path_info; @actual_path_info; end
184
184
 
185
185
  # Create site
186
186
  site = mock
187
187
  site.expects(:items).returns([])
188
- site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => [ 'index.html' ] })
188
+ site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => ['index.html'] })
189
189
 
190
190
  # Create autocompiler
191
191
  autocompiler = Nanoc::Extra::AutoCompiler.new('.')
@@ -213,13 +213,13 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
213
213
  @expected_path_info = 'foo/bar'
214
214
  @actual_path_info = env['PATH_INFO']
215
215
  end
216
- def file_server.expected_path_info ; @expected_path_info ; end
217
- def file_server.actual_path_info ; @actual_path_info ; end
216
+ def file_server.expected_path_info; @expected_path_info; end
217
+ def file_server.actual_path_info; @actual_path_info; end
218
218
 
219
219
  # Create site
220
220
  site = mock
221
221
  site.expects(:items).returns([])
222
- site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => [ 'index.html' ] })
222
+ site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => ['index.html'] })
223
223
 
224
224
  # Create autocompiler
225
225
  autocompiler = Nanoc::Extra::AutoCompiler.new('.')
@@ -243,13 +243,13 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
243
243
  @expected_path_info = 'four-oh-four.txt'
244
244
  @actual_path_info = env['PATH_INFO']
245
245
  end
246
- def file_server.expected_path_info ; @expected_path_info ; end
247
- def file_server.actual_path_info ; @actual_path_info ; end
246
+ def file_server.expected_path_info; @expected_path_info; end
247
+ def file_server.actual_path_info; @actual_path_info; end
248
248
 
249
249
  # Create site
250
250
  site = mock
251
251
  site.expects(:items).returns([])
252
- site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => [ 'index.html' ] })
252
+ site.expects(:config).at_least_once.returns({ :output_dir => 'out', :index_filenames => ['index.html'] })
253
253
 
254
254
  # Create autocompiler
255
255
  autocompiler = Nanoc::Extra::AutoCompiler.new('.')
@@ -294,12 +294,12 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
294
294
  FileUtils.cd('bar') do
295
295
  # Create item
296
296
  File.open('content/index.html', 'w') do |io|
297
- io.write "Moo!"
297
+ io.write 'Moo!'
298
298
  end
299
299
 
300
300
  # Create output file
301
301
  File.open('output/index.html', 'w') do |io|
302
- io.write "Compiled moo!"
302
+ io.write 'Compiled moo!'
303
303
  end
304
304
 
305
305
  # Create site
@@ -318,7 +318,7 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
318
318
  assert_equal(200, status)
319
319
  assert_equal('text/html', headers['Content-Type'])
320
320
  body.each do |b|
321
- assert_equal "Compiled moo!", b
321
+ assert_equal 'Compiled moo!', b
322
322
  end
323
323
  end
324
324
  end
@@ -332,7 +332,7 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
332
332
  FileUtils.cd('bar') do
333
333
  # Create item
334
334
  File.open('content/whatever.html', 'w') do |io|
335
- io.write "Whatever!"
335
+ io.write 'Whatever!'
336
336
  end
337
337
 
338
338
  # Create site
@@ -360,7 +360,7 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
360
360
  FileUtils.cd('foo') do
361
361
  # Create item that outputs config elements
362
362
  File.open('content/index.html', 'w') do |io|
363
- io.write "The Grand Value of Configuration is <%= @config[:value] %>!"
363
+ io.write 'The Grand Value of Configuration is <%= @config[:value] %>!'
364
364
  end
365
365
 
366
366
  # Create autocompiler
@@ -368,7 +368,7 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
368
368
 
369
369
  # Set config to 1st value
370
370
  File.open('nanoc.yaml', 'w') do |io|
371
- io.write "value: Foo"
371
+ io.write 'value: Foo'
372
372
  end
373
373
  File.utime(Time.now+5, Time.now+5, 'nanoc.yaml')
374
374
 
@@ -380,7 +380,7 @@ class Nanoc::Extra::AutoCompilerTest < Nanoc::TestCase
380
380
 
381
381
  # Set config to 2nd value
382
382
  File.open('nanoc.yaml', 'w') do |io|
383
- io.write "value: Bar"
383
+ io.write 'value: Bar'
384
384
  end
385
385
  File.utime(Time.now+5, Time.now+5, 'nanoc.yaml')
386
386