nanoc 3.7.3 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -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
|
-
[
|
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(
|
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(
|
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
|
-
[
|
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
|
-
[
|
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(
|
300
|
-
File.open('foo/car.html', 'w') { |io| io.write(
|
301
|
-
File.open('foo/ugly.yaml~', 'w') { |io| io.write(
|
302
|
-
File.open('foo/ugly.html~', 'w') { |io| io.write(
|
303
|
-
File.open('foo/ugly.html.orig', 'w') { |io| io.write(
|
304
|
-
File.open('foo/ugly.html.rej', 'w') { |io| io.write(
|
305
|
-
File.open('foo/ugly.html.bak', 'w') { |io| io.write(
|
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
|
-
[
|
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(
|
388
|
-
File.open('foo/car.html', 'w') { |io| io.write(
|
389
|
-
File.open('foo/ugly.yaml~', 'w') { |io| io.write(
|
390
|
-
File.open('foo/ugly.html~', 'w') { |io| io.write(
|
391
|
-
File.open('foo/ugly.html.orig', 'w') { |io| io.write(
|
392
|
-
File.open('foo/ugly.html.rej', 'w') { |io| io.write(
|
393
|
-
File.open('foo/ugly.html.bak', 'w') { |io| io.write(
|
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
|
-
[
|
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
|
-
|
521
|
-
skip
|
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(
|
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(
|
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
|
-
|
548
|
-
skip
|
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(
|
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(
|
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(
|
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(
|
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
|
-
|
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(
|
27
|
-
File.open('foo-outside-1/b.png', 'w') { |io| io.write(
|
28
|
-
File.open('foo-outside-2/c.png', 'w') { |io| io.write(
|
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 = [
|
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(
|
54
|
-
File.open('foo/b.c.css', 'w') { |io| io.write(
|
55
|
-
File.open('foo/a/b/c.gif', 'w') { |io| io.write(
|
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
|
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
|
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,
|
40
|
-
issue =
|
41
|
-
assert_equal
|
42
|
-
assert_equal
|
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
|
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
|
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 [
|
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
|
|
@@ -17,9 +17,9 @@ class Nanoc::ExtraCoreExtEnumerableTest < Nanoc::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_group_by
|
20
|
-
input = MyCollection.new([
|
20
|
+
input = MyCollection.new(['foo', 'bar', 'baz'])
|
21
21
|
|
22
|
-
output_expected = { ?f => [
|
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
|
18
|
-
File.open('output/bark', 'w') { |io| io.write
|
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
|
30
|
-
assert_equal
|
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
|
51
|
-
File.open('output/bark', 'w') { |io| io.write
|
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
|
84
|
-
File.open('output/bark', 'w') { |io| io.write
|
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
|
97
|
-
assert_equal
|
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
|
-
[
|
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
|
-
[
|
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
|
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
|
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
|
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
|
81
|
-
def file_server.actual_path_info
|
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 => [
|
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
|
115
|
-
def file_server.actual_path_info
|
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 => [
|
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
|
149
|
-
def file_server.actual_path_info
|
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 => [
|
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
|
183
|
-
def file_server.actual_path_info
|
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 => [
|
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
|
217
|
-
def file_server.actual_path_info
|
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 => [
|
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
|
247
|
-
def file_server.actual_path_info
|
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 => [
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
383
|
+
io.write 'value: Bar'
|
384
384
|
end
|
385
385
|
File.utime(Time.now+5, Time.now+5, 'nanoc.yaml')
|
386
386
|
|