nanoc 4.0.0b4 → 4.0.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +31 -32
  4. data/NEWS.md +7 -0
  5. data/README.md +1 -2
  6. data/Rakefile +2 -11
  7. data/TODO.md +0 -1
  8. data/bin/nanoc +4 -0
  9. data/lib/nanoc/base/checksummer.rb +1 -1
  10. data/lib/nanoc/base/compilation/compiler.rb +7 -13
  11. data/lib/nanoc/base/compilation/dependency_tracker.rb +1 -1
  12. data/lib/nanoc/base/compilation/rule.rb +2 -0
  13. data/lib/nanoc/base/compilation/rules_collection.rb +2 -2
  14. data/lib/nanoc/base/entities/identifier.rb +45 -15
  15. data/lib/nanoc/base/entities/pattern.rb +8 -0
  16. data/lib/nanoc/base/entities/snapshot_def.rb +16 -0
  17. data/lib/nanoc/base/entities.rb +1 -0
  18. data/lib/nanoc/base/plugin_registry.rb +1 -1
  19. data/lib/nanoc/base/{compilation → repos}/checksum_store.rb +0 -0
  20. data/lib/nanoc/base/{compilation → repos}/compiled_content_cache.rb +0 -0
  21. data/lib/nanoc/base/repos/config_loader.rb +67 -0
  22. data/lib/nanoc/base/{compilation → repos}/rule_memory_store.rb +0 -0
  23. data/lib/nanoc/base/repos/site_loader.rb +118 -0
  24. data/lib/nanoc/base/{store.rb → repos/store.rb} +0 -0
  25. data/lib/nanoc/base/repos.rb +7 -0
  26. data/lib/nanoc/base/result_data/item_rep.rb +37 -66
  27. data/lib/nanoc/base/services/executor.rb +15 -9
  28. data/lib/nanoc/base/services/item_rep_writer.rb +1 -1
  29. data/lib/nanoc/base/services/recording_executor.rb +4 -4
  30. data/lib/nanoc/base/source_data/configuration.rb +89 -3
  31. data/lib/nanoc/base/source_data/data_source.rb +2 -15
  32. data/lib/nanoc/base/source_data/site.rb +14 -378
  33. data/lib/nanoc/base/views/{config.rb → config_view.rb} +0 -0
  34. data/lib/nanoc/base/views/{identifiable_collection.rb → identifiable_collection_view.rb} +0 -0
  35. data/lib/nanoc/base/views/{item_collection.rb → item_collection_view.rb} +0 -0
  36. data/lib/nanoc/base/views/{item_rep_collection.rb → item_rep_collection_view.rb} +7 -1
  37. data/lib/nanoc/base/views/{item_rep.rb → item_rep_view.rb} +0 -0
  38. data/lib/nanoc/base/views/{item.rb → item_view.rb} +0 -0
  39. data/lib/nanoc/base/views/{layout_collection.rb → layout_collection_view.rb} +0 -0
  40. data/lib/nanoc/base/views/{layout.rb → layout_view.rb} +0 -0
  41. data/lib/nanoc/base/views/mixins/{document.rb → document_view_mixin.rb} +0 -0
  42. data/lib/nanoc/base/views/mixins/{mutable_document.rb → mutable_document_view_mixin.rb} +0 -0
  43. data/lib/nanoc/base/views/{mutable_config.rb → mutable_config_view.rb} +0 -0
  44. data/lib/nanoc/base/views/{mutable_identifiable_collection.rb → mutable_identifiable_collection_view.rb} +0 -0
  45. data/lib/nanoc/base/views/{mutable_item_collection.rb → mutable_item_collection_view.rb} +0 -0
  46. data/lib/nanoc/base/views/{mutable_item.rb → mutable_item_view.rb} +0 -0
  47. data/lib/nanoc/base/views/{mutable_layout_collection.rb → mutable_layout_collection_view.rb} +0 -0
  48. data/lib/nanoc/base/views/{mutable_layout.rb → mutable_layout_view.rb} +0 -0
  49. data/lib/nanoc/base/views/{site.rb → site_view.rb} +0 -0
  50. data/lib/nanoc/base/views.rb +17 -17
  51. data/lib/nanoc/base.rb +1 -4
  52. data/lib/nanoc/cli/ansi_string_colorizer.rb +1 -1
  53. data/lib/nanoc/cli/cleaning_stream.rb +5 -0
  54. data/lib/nanoc/cli/command_runner.rb +10 -4
  55. data/lib/nanoc/cli/commands/compile.rb +1 -1
  56. data/lib/nanoc/cli/commands/create-site.rb +12 -11
  57. data/lib/nanoc/cli/commands/prune.rb +1 -0
  58. data/lib/nanoc/cli/commands/show-plugins.rb +4 -4
  59. data/lib/nanoc/cli/commands/show-rules.rb +21 -30
  60. data/lib/nanoc/cli/commands/view.rb +1 -1
  61. data/lib/nanoc/cli/error_handler.rb +1 -1
  62. data/lib/nanoc/cli.rb +3 -3
  63. data/lib/nanoc/data_sources/filesystem.rb +4 -4
  64. data/lib/nanoc/extra/checking/runner.rb +3 -2
  65. data/lib/nanoc/extra/deployers/rsync.rb +1 -1
  66. data/lib/nanoc/extra/link_collector.rb +1 -1
  67. data/lib/nanoc/helpers/capturing.rb +1 -1
  68. data/lib/nanoc/helpers/rendering.rb +2 -2
  69. data/lib/nanoc/version.rb +1 -1
  70. data/nanoc.gemspec +3 -4
  71. data/tasks/doc.rake +1 -1
  72. data/tasks/rubocop.rake +4 -8
  73. data/tasks/test.rake +11 -27
  74. data/test/base/test_compiler.rb +21 -16
  75. data/test/base/test_compiler_dsl.rb +8 -8
  76. data/test/base/test_item.rb +1 -1
  77. data/test/base/test_item_rep.rb +16 -14
  78. data/test/base/test_memoization.rb +1 -38
  79. data/test/base/test_outdatedness_checker.rb +38 -6
  80. data/test/base/test_site.rb +19 -121
  81. data/test/cli/commands/test_compile.rb +1 -1
  82. data/test/cli/commands/test_create_site.rb +7 -8
  83. data/test/data_sources/test_filesystem.rb +7 -7
  84. data/test/data_sources/test_filesystem_unified.rb +17 -17
  85. data/test/extra/checking/checks/test_mixed_content.rb +8 -8
  86. data/test/extra/checking/checks/test_stale.rb +3 -4
  87. data/test/extra/deployers/test_fog.rb +1 -1
  88. data/test/extra/deployers/test_rsync.rb +2 -2
  89. data/test/extra/test_filesystem_tools.rb +1 -1
  90. data/test/filters/test_erb.rb +1 -1
  91. data/test/filters/test_handlebars.rb +2 -2
  92. data/test/filters/test_less.rb +2 -2
  93. data/test/filters/test_mustache.rb +2 -2
  94. data/test/filters/test_relativize_paths.rb +1 -1
  95. data/test/filters/test_sass.rb +6 -6
  96. data/test/filters/test_xsl.rb +3 -3
  97. data/test/helper.rb +10 -15
  98. data/test/helpers/test_blogging.rb +16 -16
  99. data/test/helpers/test_capturing.rb +6 -6
  100. data/test/helpers/test_link_to.rb +13 -13
  101. data/test/helpers/test_rendering.rb +33 -0
  102. data/test/helpers/test_tagging.rb +8 -8
  103. metadata +32 -30
  104. data/test/gem_loader.rb +0 -9
@@ -10,7 +10,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
10
10
  Nanoc::CLI.run %w( create_site foo )
11
11
 
12
12
  FileUtils.cd('foo') do
13
- site = Nanoc::Int::Site.new('.')
13
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
14
14
  site.compile
15
15
  end
16
16
  end
@@ -20,7 +20,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
20
20
 
21
21
  FileUtils.cd('foo') do
22
22
  Nanoc::CLI.run %w( create_site ./ )
23
- site = Nanoc::Int::Site.new('.')
23
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
24
24
  site.compile
25
25
  end
26
26
  end
@@ -30,7 +30,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
30
30
 
31
31
  FileUtils.cd('foo') do
32
32
  File.open('content/blah', 'w') { |io| io << 'asdf' }
33
- site = Nanoc::Int::Site.new('.')
33
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
34
34
  site.compile
35
35
 
36
36
  assert File.file?('output/blah')
@@ -43,7 +43,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
43
43
  Nanoc::CLI.run %w( create_site foo --force )
44
44
 
45
45
  FileUtils.cd('foo') do
46
- site = Nanoc::Int::Site.new('.')
46
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
47
47
  site.compile
48
48
  end
49
49
  end
@@ -54,7 +54,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
54
54
  Nanoc::CLI.run %w( create_site foo --force )
55
55
 
56
56
  FileUtils.cd('foo') do
57
- site = Nanoc::Int::Site.new('.')
57
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
58
58
  site.compile
59
59
 
60
60
  assert File.file?('output/index.html')
@@ -75,9 +75,8 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
75
75
  FileUtils.cd('foo') do
76
76
  # Try with encoding = default encoding = utf-8
77
77
  File.open('content/index.html', 'w') { |io| io.write("Hello <\xD6>!\n") }
78
- site = Nanoc::Int::Site.new('.')
79
78
  exception = assert_raises(RuntimeError) do
80
- site.compile
79
+ Nanoc::Int::SiteLoader.new.new_from_cwd
81
80
  end
82
81
  assert_equal 'Could not read content/index.html because the file is not valid UTF-8.', exception.message
83
82
 
@@ -89,7 +88,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
89
88
  io.write(" type: filesystem\n")
90
89
  io.write(" identifier_type: full\n")
91
90
  end
92
- site = Nanoc::Int::Site.new('.')
91
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
93
92
  site.compile
94
93
  end
95
94
  FileUtils
@@ -40,7 +40,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
40
40
  output_expected = {
41
41
  './foo' => ['yaml', ['html']],
42
42
  './bar.entry' => [nil, ['html']],
43
- './foo/qux' => ['yaml', [nil]]
43
+ './foo/qux' => ['yaml', [nil]],
44
44
  }
45
45
  output_actual = data_source.send :all_split_files_in, '.'
46
46
 
@@ -67,7 +67,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
67
67
  output_expected = {
68
68
  './foo' => ['yaml', ['html']],
69
69
  './bar' => [nil, ['html.erb']],
70
- './foo/qux' => ['yaml', [nil]]
70
+ './foo/qux' => ['yaml', [nil]],
71
71
  }
72
72
  output_actual = data_source.send :all_split_files_in, '.'
73
73
 
@@ -89,7 +89,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
89
89
  expected = {
90
90
  './aaa/foo' => [nil, ['html']],
91
91
  './bbb/foo' => [nil, ['html']],
92
- './ccc/foo' => [nil, ['html']]
92
+ './ccc/foo' => [nil, ['html']],
93
93
  }
94
94
  assert_equal expected, data_source.send(:all_split_files_in, '.')
95
95
  end
@@ -146,7 +146,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
146
146
  '/foo/bar.xyz.html' => '/foo/bar.xyz',
147
147
  '/foo/bar/' => '/foo/bar/',
148
148
  '/foo/bar.xyz/' => '/foo/bar.xyz/',
149
- '/foo.xyz/bar.xyz/' => '/foo.xyz/bar.xyz/'
149
+ '/foo.xyz/bar.xyz/' => '/foo.xyz/bar.xyz/',
150
150
  }
151
151
 
152
152
  # Check
@@ -176,7 +176,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
176
176
  '/foo/bar.xyz.html' => '/foo/bar',
177
177
  '/foo/bar/' => '/foo/bar/',
178
178
  '/foo/bar.xyz/' => '/foo/bar.xyz/',
179
- '/foo.xyz/bar.xyz/' => '/foo.xyz/bar.xyz/'
179
+ '/foo.xyz/bar.xyz/' => '/foo.xyz/bar.xyz/',
180
180
  }
181
181
 
182
182
  # Check
@@ -206,7 +206,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
206
206
  '/foo/bar.xyz.html' => '.html',
207
207
  '/foo/bar/' => '',
208
208
  '/foo/bar.xyz/' => '',
209
- '/foo.xyz/bar.xyz/' => ''
209
+ '/foo.xyz/bar.xyz/' => '',
210
210
  }
211
211
 
212
212
  # Check
@@ -236,7 +236,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
236
236
  '/foo/bar.xyz.html' => '.xyz.html',
237
237
  '/foo/bar/' => '',
238
238
  '/foo/bar.xyz/' => '',
239
- '/foo.xyz/bar.xyz/' => ''
239
+ '/foo.xyz/bar.xyz/' => '',
240
240
  }
241
241
 
242
242
  # Check
@@ -1,10 +1,10 @@
1
1
  class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
2
2
  def new_data_source(params = nil)
3
3
  # Mock site
4
- site = Nanoc::Int::Site.new({})
4
+ site = Nanoc::Int::SiteLoader.new.new_empty
5
5
 
6
6
  # Create data source
7
- data_source = Nanoc::DataSources::FilesystemUnified.new(site, nil, nil, params)
7
+ data_source = Nanoc::DataSources::FilesystemUnified.new(site.config, nil, nil, params)
8
8
 
9
9
  # Done
10
10
  data_source
@@ -53,7 +53,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
53
53
  'test 3',
54
54
  { 'num' => 3, :filename => 'foo/a/b/c.html', :extension => 'html', mtime: File.mtime('foo/a/b/c.html') },
55
55
  '/a/b/c/',
56
- )
56
+ ),
57
57
  ]
58
58
  actual_out = data_source.send(:load_objects, 'foo', 'The Foo', klass).sort_by { |i| i.stuff[0].string }
59
59
 
@@ -171,7 +171,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
171
171
  '/foo' => '/foo/',
172
172
  '/foo.html' => '/foo/',
173
173
  '/foo/index.html' => '/foo/',
174
- '/foo.entry.html' => '/foo.entry/'
174
+ '/foo.entry.html' => '/foo.entry/',
175
175
  }
176
176
 
177
177
  # Check
@@ -193,7 +193,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
193
193
  '/foo' => '/foo/',
194
194
  '/foo.html' => '/foo/',
195
195
  '/foo/index.html' => '/foo/',
196
- '/foo.html.erb' => '/foo/'
196
+ '/foo.html.erb' => '/foo/',
197
197
  }
198
198
 
199
199
  # Check
@@ -217,7 +217,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
217
217
  'foo/qux.bar.qux.yaml' => '/foo/qux.bar.qux/',
218
218
  'foo/index.yaml' => '/foo/',
219
219
  'index.yaml' => '/',
220
- 'foo/blah_index.yaml' => '/foo/blah_index/'
220
+ 'foo/blah_index.yaml' => '/foo/blah_index/',
221
221
  }
222
222
 
223
223
  data_source = new_data_source(allow_periods_in_identifiers: true)
@@ -226,7 +226,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
226
226
  [meta_filename, content_filename].each do |filename|
227
227
  assert_equal(
228
228
  expected_identifier,
229
- data_source.instance_eval { identifier_for_filename(filename) }
229
+ data_source.instance_eval { identifier_for_filename(filename) },
230
230
  )
231
231
  end
232
232
  end
@@ -243,7 +243,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
243
243
  'foo/qux.bar.qux.yaml' => '/foo/qux/',
244
244
  'foo/index.yaml' => '/foo/',
245
245
  'index.yaml' => '/',
246
- 'foo/blah_index.yaml' => '/foo/blah_index/'
246
+ 'foo/blah_index.yaml' => '/foo/blah_index/',
247
247
  }
248
248
 
249
249
  data_source = new_data_source
@@ -252,7 +252,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
252
252
  [meta_filename, content_filename].each do |filename|
253
253
  assert_equal(
254
254
  expected_identifier,
255
- data_source.instance_eval { identifier_for_filename(filename) }
255
+ data_source.instance_eval { identifier_for_filename(filename) },
256
256
  )
257
257
  end
258
258
  end
@@ -337,7 +337,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
337
337
  :meta_filename => 'foo/a/b/c.yaml',
338
338
  :extension => nil,
339
339
  :file => nil,
340
- mtime: File.mtime('foo/a/b/c.yaml')
340
+ mtime: File.mtime('foo/a/b/c.yaml'),
341
341
  },
342
342
  '/a/b/c/',
343
343
  ),
@@ -349,7 +349,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
349
349
  :meta_filename => 'foo/b.c.yaml',
350
350
  :extension => 'html',
351
351
  :file => File.open('foo/b.c.html'),
352
- mtime: File.mtime('foo/b.c.html') > File.mtime('foo/b.c.yaml') ? File.mtime('foo/b.c.html') : File.mtime('foo/b.c.yaml')
352
+ mtime: File.mtime('foo/b.c.html') > File.mtime('foo/b.c.yaml') ? File.mtime('foo/b.c.html') : File.mtime('foo/b.c.yaml'),
353
353
  },
354
354
  '/b.c/',
355
355
  ),
@@ -360,10 +360,10 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
360
360
  meta_filename: nil,
361
361
  extension: 'html',
362
362
  file: File.open('foo/car.html'),
363
- mtime: File.mtime('foo/car.html')
363
+ mtime: File.mtime('foo/car.html'),
364
364
  },
365
365
  '/car/',
366
- )
366
+ ),
367
367
  ]
368
368
 
369
369
  # Get actual output ordered by identifier
@@ -419,7 +419,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
419
419
  :meta_filename => 'foo/a/b/c.yaml',
420
420
  :extension => nil,
421
421
  :file => nil,
422
- mtime: File.mtime('foo/a/b/c.yaml')
422
+ mtime: File.mtime('foo/a/b/c.yaml'),
423
423
  },
424
424
  '/a/b/c/',
425
425
  ),
@@ -431,7 +431,7 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
431
431
  :meta_filename => 'foo/b.yaml',
432
432
  :extension => 'html.erb',
433
433
  :file => File.open('foo/b.html.erb'),
434
- mtime: File.mtime('foo/b.html.erb') > File.mtime('foo/b.yaml') ? File.mtime('foo/b.html.erb') : File.mtime('foo/b.yaml')
434
+ mtime: File.mtime('foo/b.html.erb') > File.mtime('foo/b.yaml') ? File.mtime('foo/b.html.erb') : File.mtime('foo/b.yaml'),
435
435
  },
436
436
  '/b/',
437
437
  ),
@@ -442,10 +442,10 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
442
442
  meta_filename: nil,
443
443
  extension: 'html',
444
444
  file: File.open('foo/car.html'),
445
- mtime: File.mtime('foo/car.html')
445
+ mtime: File.mtime('foo/car.html'),
446
446
  },
447
447
  '/car/',
448
- )
448
+ ),
449
449
  ]
450
450
 
451
451
  # Get actual output ordered by identifier
@@ -20,7 +20,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
20
20
  '<form action="https://nanoc.ws/process.cgi"></form>',
21
21
  '<iframe src="https://nanoc.ws/preview.html"></iframe>',
22
22
  '<audio src="https://nanoc.ws/theme-song.flac"></audio>',
23
- '<video src="https://nanoc.ws/screen-cast.mkv"></video>'
23
+ '<video src="https://nanoc.ws/screen-cast.mkv"></video>',
24
24
  ])
25
25
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
26
26
  check.run
@@ -38,7 +38,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
38
38
  '<form action="/process.cgi"></form>',
39
39
  '<iframe src="/preview.html"></iframe>',
40
40
  '<audio src="/theme-song.flac"></audio>',
41
- '<video src="/screen-cast.mkv"></video>'
41
+ '<video src="/screen-cast.mkv"></video>',
42
42
  ])
43
43
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
44
44
  check.run
@@ -56,7 +56,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
56
56
  '<form action="//nanoc.ws/process.cgi"></form>',
57
57
  '<iframe src="//nanoc.ws/preview.html"></iframe>',
58
58
  '<audio src="//nanoc.ws/theme-song.flac"></audio>',
59
- '<video src="//nanoc.ws/screen-cast.mkv"></video>'
59
+ '<video src="//nanoc.ws/screen-cast.mkv"></video>',
60
60
  ])
61
61
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
62
62
  check.run
@@ -74,7 +74,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
74
74
  '<form action="process.cgi"></form>',
75
75
  '<iframe src="preview.html"></iframe>',
76
76
  '<audio src="theme-song.flac"></audio>',
77
- '<video src="screen-cast.mkv"></video>'
77
+ '<video src="screen-cast.mkv"></video>',
78
78
  ])
79
79
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
80
80
  check.run
@@ -92,7 +92,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
92
92
  '<form action="?query-string"></form>',
93
93
  '<iframe src="?query-string"></iframe>',
94
94
  '<audio src="?query-string"></audio>',
95
- '<video src="?query-string"></video>'
95
+ '<video src="?query-string"></video>',
96
96
  ])
97
97
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
98
98
  check.run
@@ -110,7 +110,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
110
110
  '<form action="#fragment"></form>',
111
111
  '<iframe src="#fragment"></iframe>',
112
112
  '<audio src="#fragment"></audio>',
113
- '<video src="#fragment"></video>'
113
+ '<video src="#fragment"></video>',
114
114
  ])
115
115
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
116
116
  check.run
@@ -129,7 +129,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
129
129
  '<form action="http://nanoc.ws/process.cgi"></form>',
130
130
  '<iframe src="http://nanoc.ws/preview.html"></iframe>',
131
131
  '<audio src="http://nanoc.ws/theme-song.flac"></audio>',
132
- '<video src="http://nanoc.ws/screencast.mkv"></video>'
132
+ '<video src="http://nanoc.ws/screencast.mkv"></video>',
133
133
  ])
134
134
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
135
135
  check.run
@@ -175,7 +175,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
175
175
  '<iframe href="http://nanoc.ws/preview.html"></iframe>',
176
176
  '<audio href="http://nanoc.ws/theme-song.flac"></audio>',
177
177
  '<video target="http://nanoc.ws/screen-cast.mkv"></video>',
178
- '<p>http://nanoc.ws/harmless-text</p>'
178
+ '<p>http://nanoc.ws/harmless-text</p>',
179
179
  ])
180
180
  check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
181
181
  check.run
@@ -4,10 +4,9 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
4
4
  end
5
5
 
6
6
  def calc_issues
7
- site = Nanoc::Int::Site.new('.')
8
- check = check_class.create(site)
9
- check.run
10
- check.issues
7
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
8
+ runner = Nanoc::Extra::Checking::Runner.new(site)
9
+ issues = runner.run_checks([check_class])
11
10
  end
12
11
 
13
12
  def test_run_ok
@@ -85,7 +85,7 @@ class Nanoc::Extra::Deployers::FogTest < Nanoc::TestCase
85
85
  # Run
86
86
  fog.run
87
87
  ensure
88
- # HACK :(
88
+ # HACK: (
89
89
  ::Fog.instance_eval { @mocking = false }
90
90
  end
91
91
  end
@@ -57,7 +57,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
57
57
  opts = Nanoc::Extra::Deployers::Rsync::DEFAULT_OPTIONS
58
58
  assert_equal(
59
59
  ['rsync', opts, 'output/', 'asdf'].flatten,
60
- rsync.instance_eval { @shell_cms_args }
60
+ rsync.instance_eval { @shell_cms_args },
61
61
  )
62
62
  end
63
63
 
@@ -80,7 +80,7 @@ class Nanoc::Extra::Deployers::RsyncTest < Nanoc::TestCase
80
80
  opts = Nanoc::Extra::Deployers::Rsync::DEFAULT_OPTIONS
81
81
  assert_equal(
82
82
  ['echo', 'rsync', opts, 'output/', 'asdf'].flatten,
83
- rsync.instance_eval { @shell_cms_args }
83
+ rsync.instance_eval { @shell_cms_args },
84
84
  )
85
85
  end
86
86
  end
@@ -28,7 +28,7 @@ class Nanoc::Extra::FilesystemToolsTest < Nanoc::TestCase
28
28
  'dir0/sub/sub/sub/sub/sub/sub/sub/foo.md',
29
29
  'dir0/sub/sub/sub/sub/sub/sub/sub/sub/foo.md',
30
30
  'dir0/sub/sub/sub/sub/sub/sub/sub/sub/sub/foo.md',
31
- 'dir0/sub/sub/sub/sub/sub/sub/sub/sub/sub/sub/foo.md'
31
+ 'dir0/sub/sub/sub/sub/sub/sub/sub/sub/sub/sub/foo.md',
32
32
  ]
33
33
  actual_files = Nanoc::Extra::FilesystemTools.all_files_in('dir0', nil).sort
34
34
  assert_equal expected_files, actual_files
@@ -28,7 +28,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
28
28
  filter = ::Nanoc::Filters::ERB.new({
29
29
  item: item,
30
30
  item_rep: item_rep,
31
- location: 'a cheap motel'
31
+ location: 'a cheap motel',
32
32
  })
33
33
 
34
34
  # Run filter
@@ -17,7 +17,7 @@ class Nanoc::Filters::HandlebarsTest < Nanoc::TestCase
17
17
  item: item,
18
18
  layout: layout,
19
19
  config: config,
20
- content: 'No Payne No Gayne'
20
+ content: 'No Payne No Gayne',
21
21
  }
22
22
  filter = ::Nanoc::Filters::Handlebars.new(assigns)
23
23
 
@@ -42,7 +42,7 @@ class Nanoc::Filters::HandlebarsTest < Nanoc::TestCase
42
42
  # Create filter
43
43
  assigns = {
44
44
  item: item,
45
- content: 'No Payne No Gayne'
45
+ content: 'No Payne No Gayne',
46
46
  }
47
47
  filter = ::Nanoc::Filters::Handlebars.new(assigns)
48
48
 
@@ -78,7 +78,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
78
78
  end
79
79
 
80
80
  # Compile
81
- site = Nanoc::Int::Site.new('.')
81
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
82
82
  site.compile
83
83
 
84
84
  # Check
@@ -93,7 +93,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
93
93
  end
94
94
 
95
95
  # Recompile
96
- site = Nanoc::Int::Site.new('.')
96
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
97
97
  site.compile
98
98
 
99
99
  # Recheck
@@ -5,7 +5,7 @@ class Nanoc::Filters::MustacheTest < Nanoc::TestCase
5
5
  item = Nanoc::Int::Item.new(
6
6
  'content',
7
7
  { title: 'Max Payne', protagonist: 'Max Payne' },
8
- '/games/max-payne/'
8
+ '/games/max-payne/',
9
9
  )
10
10
 
11
11
  # Create filter
@@ -23,7 +23,7 @@ class Nanoc::Filters::MustacheTest < Nanoc::TestCase
23
23
  item = Nanoc::Int::Item.new(
24
24
  'content',
25
25
  { title: 'Max Payne', protagonist: 'Max Payne' },
26
- '/games/max-payne/'
26
+ '/games/max-payne/',
27
27
  )
28
28
 
29
29
  # Create filter
@@ -565,7 +565,7 @@ XML
565
565
  actual_content = filter.setup_and_run(raw_content, {
566
566
  type: :xml,
567
567
  namespaces: { ex: 'http://example.org' },
568
- select: ['ex:a/@href']
568
+ select: ['ex:a/@href'],
569
569
  })
570
570
 
571
571
  assert_match(/<foo xmlns="http:\/\/example.org">/, actual_content)
@@ -121,7 +121,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
121
121
  end
122
122
 
123
123
  # Compile
124
- site = Nanoc::Int::Site.new('.')
124
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
125
125
  site.compile
126
126
 
127
127
  # Check
@@ -136,7 +136,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
136
136
  end
137
137
 
138
138
  # Recompile
139
- site = Nanoc::Int::Site.new('.')
139
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
140
140
  site.compile
141
141
 
142
142
  # Recheck
@@ -176,7 +176,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
176
176
  end
177
177
 
178
178
  # Compile
179
- site = Nanoc::Int::Site.new('.')
179
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
180
180
  site.compile
181
181
 
182
182
  # Check
@@ -191,7 +191,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
191
191
  end
192
192
 
193
193
  # Recompile
194
- site = Nanoc::Int::Site.new('.')
194
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
195
195
  site.compile
196
196
 
197
197
  # Recheck
@@ -243,7 +243,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
243
243
  end
244
244
 
245
245
  # Compile
246
- site = Nanoc::Int::Site.new('.')
246
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
247
247
  site.compile
248
248
 
249
249
  # Check
@@ -257,7 +257,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
257
257
  end
258
258
 
259
259
  # Recompile
260
- site = Nanoc::Int::Site.new('.')
260
+ site = Nanoc::Int::SiteLoader.new.new_from_cwd
261
261
  site.compile
262
262
 
263
263
  # Recheck
@@ -97,7 +97,7 @@ EOS
97
97
  assigns = {
98
98
  item: item,
99
99
  layout: layout,
100
- content: item.raw_content
100
+ content: item.raw_content,
101
101
  }
102
102
  filter = ::Nanoc::Filters::XSL.new(assigns)
103
103
 
@@ -123,7 +123,7 @@ EOS
123
123
  assigns = {
124
124
  item: item,
125
125
  layout: layout,
126
- content: item.raw_content
126
+ content: item.raw_content,
127
127
  }
128
128
  filter = ::Nanoc::Filters::XSL.new(assigns)
129
129
 
@@ -150,7 +150,7 @@ EOS
150
150
  assigns = {
151
151
  item: item,
152
152
  layout: layout,
153
- content: item.raw_content
153
+ content: item.raw_content,
154
154
  }
155
155
  filter = ::Nanoc::Filters::XSL.new(assigns)
156
156
 
data/test/helper.rb CHANGED
@@ -1,32 +1,27 @@
1
- # Set up gem loading (necessary for cri dependency)
2
- require File.dirname(__FILE__) + '/gem_loader.rb'
1
+ require 'simplecov'
2
+ SimpleCov.start
3
3
 
4
- # Load unit testing stuff
5
4
  require 'minitest/test'
6
5
  require 'minitest/spec'
7
6
  require 'minitest/mock'
7
+ require 'minitest/autorun'
8
8
  require 'mocha/setup'
9
9
  require 'vcr'
10
10
 
11
- # Setup coverage
12
- require 'coveralls'
13
- Coveralls.wear!
14
-
15
- # Load nanoc
16
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
17
- require 'nanoc'
18
- require 'nanoc/cli'
19
- Nanoc::CLI.setup
20
-
21
- # Load miscellaneous requirements
22
11
  require 'tmpdir'
23
12
  require 'stringio'
13
+ require 'yard'
24
14
 
25
15
  VCR.configure do |c|
26
16
  c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
27
17
  c.hook_into :webmock
28
18
  end
29
19
 
20
+ require 'nanoc'
21
+ require 'nanoc/cli'
22
+
23
+ Nanoc::CLI.setup
24
+
30
25
  module Nanoc::TestHelpers
31
26
  LIB_DIR = File.expand_path(File.dirname(__FILE__) + '/../lib')
32
27
 
@@ -115,7 +110,7 @@ EOS
115
110
 
116
111
  # Yield site
117
112
  FileUtils.cd(site_name) do
118
- yield Nanoc::Int::Site.new('.')
113
+ yield Nanoc::Int::SiteLoader.new.new_from_cwd
119
114
  end
120
115
  end
121
116