nanoc 3.7.4 → 3.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +19 -18
- data/LICENSE +1 -1
- data/NEWS.md +14 -0
- data/Rakefile +1 -1
- data/doc/yardoc_handlers/identifier.rb +1 -5
- data/lib/nanoc.rb +1 -3
- data/lib/nanoc/base.rb +1 -4
- data/lib/nanoc/base/checksummer.rb +10 -12
- data/lib/nanoc/base/compilation/checksum_store.rb +0 -4
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -4
- data/lib/nanoc/base/compilation/compiler.rb +27 -31
- data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -7
- data/lib/nanoc/base/compilation/dependency_tracker.rb +2 -6
- data/lib/nanoc/base/compilation/filter.rb +1 -7
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -5
- data/lib/nanoc/base/compilation/rule_context.rb +7 -11
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -4
- data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -4
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -9
- data/lib/nanoc/base/context.rb +0 -3
- data/lib/nanoc/base/core_ext.rb +0 -1
- data/lib/nanoc/base/core_ext/array.rb +0 -2
- data/lib/nanoc/base/core_ext/hash.rb +0 -2
- data/lib/nanoc/base/core_ext/pathname.rb +0 -2
- data/lib/nanoc/base/core_ext/string.rb +0 -2
- data/lib/nanoc/base/directed_graph.rb +0 -4
- data/lib/nanoc/base/errors.rb +1 -39
- data/lib/nanoc/base/memoization.rb +0 -4
- data/lib/nanoc/base/notification_center.rb +1 -7
- data/lib/nanoc/base/plugin_registry.rb +4 -10
- data/lib/nanoc/base/result_data/item_rep.rb +8 -16
- data/lib/nanoc/base/source_data/code_snippet.rb +1 -5
- data/lib/nanoc/base/source_data/configuration.rb +0 -4
- data/lib/nanoc/base/source_data/data_source.rb +2 -5
- data/lib/nanoc/base/source_data/item.rb +3 -7
- data/lib/nanoc/base/source_data/item_array.rb +1 -5
- data/lib/nanoc/base/source_data/layout.rb +2 -6
- data/lib/nanoc/base/source_data/site.rb +20 -23
- data/lib/nanoc/base/store.rb +1 -5
- data/lib/nanoc/base/temp_filename_factory.rb +0 -4
- data/lib/nanoc/cli.rb +3 -5
- data/lib/nanoc/cli/ansi_string_colorizer.rb +6 -10
- data/lib/nanoc/cli/cleaning_stream.rb +2 -6
- data/lib/nanoc/cli/command_runner.rb +1 -5
- data/lib/nanoc/cli/commands/autocompile.rb +2 -6
- data/lib/nanoc/cli/commands/check.rb +0 -4
- data/lib/nanoc/cli/commands/compile.rb +12 -27
- data/lib/nanoc/cli/commands/create-item.rb +1 -5
- data/lib/nanoc/cli/commands/create-layout.rb +0 -4
- data/lib/nanoc/cli/commands/create-site.rb +2 -8
- data/lib/nanoc/cli/commands/deploy.rb +3 -7
- data/lib/nanoc/cli/commands/prune.rb +2 -6
- data/lib/nanoc/cli/commands/shell.rb +4 -8
- data/lib/nanoc/cli/commands/show-data.rb +3 -7
- data/lib/nanoc/cli/commands/show-plugins.rb +3 -7
- data/lib/nanoc/cli/commands/show-rules.rb +11 -15
- data/lib/nanoc/cli/commands/sync.rb +0 -4
- data/lib/nanoc/cli/commands/update.rb +1 -7
- data/lib/nanoc/cli/commands/validate-css.rb +0 -4
- data/lib/nanoc/cli/commands/validate-html.rb +0 -4
- data/lib/nanoc/cli/commands/validate-links.rb +0 -4
- data/lib/nanoc/cli/commands/view.rb +3 -7
- data/lib/nanoc/cli/commands/watch.rb +4 -10
- data/lib/nanoc/cli/error_handler.rb +9 -13
- data/lib/nanoc/cli/logger.rb +8 -12
- data/lib/nanoc/cli/stream_cleaners.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -5
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +1 -5
- data/lib/nanoc/data_sources.rb +2 -4
- data/lib/nanoc/data_sources/deprecated/delicious.rb +6 -10
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +7 -11
- data/lib/nanoc/data_sources/deprecated/twitter.rb +2 -6
- data/lib/nanoc/data_sources/filesystem.rb +10 -13
- data/lib/nanoc/data_sources/filesystem_unified.rb +0 -4
- data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -4
- data/lib/nanoc/data_sources/static.rb +4 -8
- data/lib/nanoc/extra.rb +2 -4
- data/lib/nanoc/extra/auto_compiler.rb +2 -6
- data/lib/nanoc/extra/checking.rb +0 -4
- data/lib/nanoc/extra/checking/check.rb +0 -4
- data/lib/nanoc/extra/checking/checks.rb +0 -2
- data/lib/nanoc/extra/checking/checks/css.rb +6 -6
- data/lib/nanoc/extra/checking/checks/external_links.rb +3 -11
- data/lib/nanoc/extra/checking/checks/html.rb +6 -6
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -7
- data/lib/nanoc/extra/checking/checks/stale.rb +3 -7
- data/lib/nanoc/extra/checking/dsl.rb +0 -4
- data/lib/nanoc/extra/checking/issue.rb +0 -4
- data/lib/nanoc/extra/checking/runner.rb +4 -7
- data/lib/nanoc/extra/chick.rb +7 -17
- data/lib/nanoc/extra/core_ext.rb +0 -1
- data/lib/nanoc/extra/core_ext/pathname.rb +0 -4
- data/lib/nanoc/extra/core_ext/time.rb +0 -2
- data/lib/nanoc/extra/deployer.rb +0 -4
- data/lib/nanoc/extra/deployers.rb +0 -4
- data/lib/nanoc/extra/deployers/fog.rb +7 -11
- data/lib/nanoc/extra/deployers/rsync.rb +1 -5
- data/lib/nanoc/extra/file_proxy.rb +1 -5
- data/lib/nanoc/extra/filesystem_tools.rb +37 -12
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -4
- data/lib/nanoc/extra/link_collector.rb +3 -7
- data/lib/nanoc/extra/piper.rb +0 -6
- data/lib/nanoc/extra/pruner.rb +1 -7
- data/lib/nanoc/extra/validators.rb +0 -4
- data/lib/nanoc/extra/validators/links.rb +0 -4
- data/lib/nanoc/extra/validators/w3c.rb +0 -4
- data/lib/nanoc/extra/vcs.rb +3 -7
- data/lib/nanoc/extra/vcses.rb +0 -2
- data/lib/nanoc/extra/vcses/bazaar.rb +0 -4
- data/lib/nanoc/extra/vcses/dummy.rb +0 -4
- data/lib/nanoc/extra/vcses/git.rb +0 -4
- data/lib/nanoc/extra/vcses/mercurial.rb +0 -4
- data/lib/nanoc/extra/vcses/subversion.rb +0 -4
- data/lib/nanoc/filters.rb +0 -2
- data/lib/nanoc/filters/asciidoc.rb +1 -5
- data/lib/nanoc/filters/bluecloth.rb +0 -2
- data/lib/nanoc/filters/coderay.rb +0 -2
- data/lib/nanoc/filters/coffeescript.rb +0 -4
- data/lib/nanoc/filters/colorize_syntax.rb +17 -15
- data/lib/nanoc/filters/erb.rb +1 -3
- data/lib/nanoc/filters/erubis.rb +2 -4
- data/lib/nanoc/filters/haml.rb +2 -4
- data/lib/nanoc/filters/handlebars.rb +0 -4
- data/lib/nanoc/filters/kramdown.rb +7 -4
- data/lib/nanoc/filters/less.rb +1 -3
- data/lib/nanoc/filters/markaby.rb +0 -2
- data/lib/nanoc/filters/maruku.rb +0 -2
- data/lib/nanoc/filters/mustache.rb +1 -5
- data/lib/nanoc/filters/pandoc.rb +0 -2
- data/lib/nanoc/filters/rainpress.rb +0 -2
- data/lib/nanoc/filters/rdiscount.rb +0 -2
- data/lib/nanoc/filters/rdoc.rb +0 -2
- data/lib/nanoc/filters/redcarpet.rb +0 -4
- data/lib/nanoc/filters/redcloth.rb +0 -2
- data/lib/nanoc/filters/relativize_paths.rb +2 -4
- data/lib/nanoc/filters/rubypants.rb +0 -2
- data/lib/nanoc/filters/sass.rb +2 -4
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
- data/lib/nanoc/filters/slim.rb +2 -6
- data/lib/nanoc/filters/typogruby.rb +0 -4
- data/lib/nanoc/filters/uglify_js.rb +0 -2
- data/lib/nanoc/filters/xsl.rb +1 -5
- data/lib/nanoc/filters/yui_compressor.rb +0 -4
- data/lib/nanoc/helpers.rb +0 -2
- data/lib/nanoc/helpers/blogging.rb +12 -20
- data/lib/nanoc/helpers/breadcrumbs.rb +0 -4
- data/lib/nanoc/helpers/capturing.rb +2 -10
- data/lib/nanoc/helpers/filtering.rb +0 -4
- data/lib/nanoc/helpers/html_escape.rb +3 -7
- data/lib/nanoc/helpers/link_to.rb +0 -4
- data/lib/nanoc/helpers/rendering.rb +8 -12
- data/lib/nanoc/helpers/tagging.rb +0 -4
- data/lib/nanoc/helpers/text.rb +1 -5
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -7
- data/lib/nanoc/tasks/clean.rb +1 -7
- data/lib/nanoc/tasks/deploy/rsync.rake +0 -2
- data/lib/nanoc/tasks/validate.rake +0 -4
- data/lib/nanoc/version.rb +1 -3
- data/nanoc.gemspec +12 -9
- data/tasks/rubocop.rake +1 -1
- data/tasks/test.rake +6 -7
- data/test/base/checksummer_spec.rb +28 -44
- data/test/base/core_ext/array_spec.rb +1 -9
- data/test/base/core_ext/hash_spec.rb +7 -19
- data/test/base/core_ext/pathname_spec.rb +2 -4
- data/test/base/core_ext/string_spec.rb +0 -4
- data/test/base/temp_filename_factory_spec.rb +0 -8
- data/test/base/test_checksum_store.rb +0 -2
- data/test/base/test_code_snippet.rb +0 -2
- data/test/base/test_compiler.rb +15 -17
- data/test/base/test_compiler_dsl.rb +7 -9
- data/test/base/test_context.rb +2 -4
- data/test/base/test_data_source.rb +0 -2
- data/test/base/test_dependency_tracker.rb +0 -2
- data/test/base/test_directed_graph.rb +2 -4
- data/test/base/test_filter.rb +5 -7
- data/test/base/test_item.rb +17 -13
- data/test/base/test_item_array.rb +2 -4
- data/test/base/test_item_rep.rb +79 -73
- data/test/base/test_layout.rb +3 -5
- data/test/base/test_memoization.rb +13 -21
- data/test/base/test_notification_center.rb +0 -2
- data/test/base/test_outdatedness_checker.rb +34 -36
- data/test/base/test_plugin.rb +0 -2
- data/test/base/test_rule.rb +3 -5
- data/test/base/test_rule_context.rb +4 -6
- data/test/base/test_site.rb +9 -17
- data/test/base/test_store.rb +2 -6
- data/test/cli/commands/test_check.rb +1 -3
- data/test/cli/commands/test_compile.rb +24 -15
- data/test/cli/commands/test_create_item.rb +1 -3
- data/test/cli/commands/test_create_layout.rb +0 -2
- data/test/cli/commands/test_create_site.rb +0 -3
- data/test/cli/commands/test_deploy.rb +9 -11
- data/test/cli/commands/test_help.rb +0 -2
- data/test/cli/commands/test_info.rb +0 -2
- data/test/cli/commands/test_prune.rb +6 -8
- data/test/cli/commands/test_sync.rb +0 -2
- data/test/cli/commands/test_update.rb +0 -2
- data/test/cli/commands/test_watch.rb +4 -6
- data/test/cli/test_cleaning_stream.rb +4 -6
- data/test/cli/test_cli.rb +9 -5
- data/test/cli/test_error_handler.rb +9 -7
- data/test/cli/test_logger.rb +0 -2
- data/test/data_sources/test_filesystem.rb +8 -10
- data/test/data_sources/test_filesystem_unified.rb +35 -34
- data/test/data_sources/test_filesystem_verbose.rb +31 -33
- data/test/data_sources/test_static.rb +20 -21
- data/test/extra/checking/checks/test_css.rb +23 -2
- data/test/extra/checking/checks/test_external_links.rb +2 -4
- data/test/extra/checking/checks/test_html.rb +4 -3
- data/test/extra/checking/checks/test_internal_links.rb +1 -3
- data/test/extra/checking/checks/test_stale.rb +4 -6
- data/test/extra/checking/test_check.rb +0 -2
- data/test/extra/checking/test_dsl.rb +1 -3
- data/test/extra/checking/test_runner.rb +0 -2
- data/test/extra/core_ext/test_pathname.rb +0 -3
- data/test/extra/core_ext/test_time.rb +0 -2
- data/test/extra/deployers/test_fog.rb +13 -15
- data/test/extra/deployers/test_rsync.rb +4 -6
- data/test/extra/test_auto_compiler.rb +47 -25
- data/test/extra/test_file_proxy.rb +1 -3
- data/test/extra/test_filesystem_tools.rb +47 -7
- data/test/extra/test_link_collector.rb +0 -2
- data/test/extra/test_piper.rb +3 -5
- data/test/extra/test_vcs.rb +0 -2
- data/test/extra/validators/test_links.rb +0 -1
- data/test/extra/validators/test_w3c.rb +2 -4
- data/test/filters/test_asciidoc.rb +0 -2
- data/test/filters/test_bluecloth.rb +0 -2
- data/test/filters/test_coderay.rb +2 -4
- data/test/filters/test_coffeescript.rb +0 -2
- data/test/filters/test_colorize_syntax.rb +16 -18
- data/test/filters/test_erb.rb +12 -14
- data/test/filters/test_erubis.rb +4 -6
- data/test/filters/test_haml.rb +7 -9
- data/test/filters/test_handlebars.rb +10 -12
- data/test/filters/test_kramdown.rb +13 -1
- data/test/filters/test_less.rb +9 -11
- data/test/filters/test_markaby.rb +0 -2
- data/test/filters/test_maruku.rb +0 -2
- data/test/filters/test_mustache.rb +4 -6
- data/test/filters/test_pandoc.rb +1 -3
- data/test/filters/test_rainpress.rb +1 -3
- data/test/filters/test_rdiscount.rb +1 -3
- data/test/filters/test_rdoc.rb +0 -2
- data/test/filters/test_redcarpet.rb +6 -8
- data/test/filters/test_redcloth.rb +1 -3
- data/test/filters/test_relativize_paths.rb +29 -34
- data/test/filters/test_rubypants.rb +0 -2
- data/test/filters/test_sass.rb +8 -10
- data/test/filters/test_slim.rb +2 -4
- data/test/filters/test_typogruby.rb +0 -3
- data/test/filters/test_uglify_js.rb +2 -4
- data/test/filters/test_xsl.rb +16 -18
- data/test/filters/test_yui_compressor.rb +3 -5
- data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +65 -0
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +11 -15
- data/test/helpers/test_blogging.rb +61 -63
- data/test/helpers/test_breadcrumbs.rb +0 -2
- data/test/helpers/test_capturing.rb +4 -6
- data/test/helpers/test_filtering.rb +2 -4
- data/test/helpers/test_html_escape.rb +0 -2
- data/test/helpers/test_link_to.rb +5 -6
- data/test/helpers/test_rendering.rb +2 -4
- data/test/helpers/test_tagging.rb +9 -11
- data/test/helpers/test_text.rb +6 -8
- data/test/helpers/test_xml_sitemap.rb +11 -13
- data/test/tasks/test_clean.rb +0 -2
- data/test/test_gem.rb +1 -3
- metadata +15 -14
- data/Gemfile.lock +0 -252
- data/lib/nanoc/base/core_ext/date.rb +0 -29
- data/lib/nanoc/base/ordered_hash.rb +0 -228
- data/lib/nanoc/extra/core_ext/enumerable.rb +0 -33
- data/test/base/core_ext/date_spec.rb +0 -15
- data/test/extra/core_ext/test_enumerable.rb +0 -28
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
describe 'Array#symbolize_keys_recursively' do
|
|
4
|
-
|
|
5
4
|
it 'should convert keys to symbols' do
|
|
6
5
|
array_old = [:abc, 'xyz', { 'foo' => 'bar', :baz => :qux }]
|
|
7
|
-
array_new = [:abc, 'xyz', { :
|
|
6
|
+
array_new = [:abc, 'xyz', { foo: 'bar', baz: :qux }]
|
|
8
7
|
array_old.symbolize_keys_recursively.must_equal array_new
|
|
9
8
|
end
|
|
10
|
-
|
|
11
9
|
end
|
|
12
10
|
|
|
13
11
|
describe 'Array#stringify_keys_recursively' do
|
|
14
|
-
|
|
15
12
|
it 'should convert keys to strings' do
|
|
16
13
|
array_old = [:abc, 'xyz', { :foo => 'bar', 'baz' => :qux }]
|
|
17
14
|
array_new = [:abc, 'xyz', { 'foo' => 'bar', 'baz' => :qux }]
|
|
18
15
|
array_old.stringify_keys_recursively.must_equal array_new
|
|
19
16
|
end
|
|
20
|
-
|
|
21
17
|
end
|
|
22
18
|
|
|
23
19
|
describe 'Array#freeze_recursively' do
|
|
24
|
-
|
|
25
20
|
include Nanoc::TestHelpers
|
|
26
21
|
|
|
27
22
|
it 'should prevent first-level elements from being modified' do
|
|
@@ -52,14 +47,11 @@ describe 'Array#freeze_recursively' do
|
|
|
52
47
|
assert a[0].frozen?
|
|
53
48
|
assert_equal a, a[0]
|
|
54
49
|
end
|
|
55
|
-
|
|
56
50
|
end
|
|
57
51
|
|
|
58
52
|
describe 'Array#checksum' do
|
|
59
|
-
|
|
60
53
|
it 'should work' do
|
|
61
54
|
expectation = 'CEUlNvu/3DUmlbtpFRiLHU8oHA0='
|
|
62
55
|
[[:foo, 123]].checksum.must_equal expectation
|
|
63
56
|
end
|
|
64
|
-
|
|
65
57
|
end
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
describe 'Hash#symbolize_keys_recursively' do
|
|
4
|
-
|
|
5
4
|
it 'should convert keys to symbols' do
|
|
6
5
|
hash_old = { 'foo' => 'bar' }
|
|
7
|
-
hash_new = { :
|
|
6
|
+
hash_new = { foo: 'bar' }
|
|
8
7
|
hash_old.symbolize_keys_recursively.must_equal hash_new
|
|
9
8
|
end
|
|
10
9
|
|
|
@@ -13,11 +12,9 @@ describe 'Hash#symbolize_keys_recursively' do
|
|
|
13
12
|
hash_new = hash_old
|
|
14
13
|
hash_old.symbolize_keys_recursively.must_equal hash_new
|
|
15
14
|
end
|
|
16
|
-
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
describe 'Hash#stringify_keys_recursively' do
|
|
20
|
-
|
|
21
18
|
it 'should leave strings as strings' do
|
|
22
19
|
hash_old = { 'foo' => 'bar' }
|
|
23
20
|
hash_new = { 'foo' => 'bar' }
|
|
@@ -25,7 +22,7 @@ describe 'Hash#stringify_keys_recursively' do
|
|
|
25
22
|
end
|
|
26
23
|
|
|
27
24
|
it 'should convert symbols to strings' do
|
|
28
|
-
hash_old = { :
|
|
25
|
+
hash_old = { foo: 'bar' }
|
|
29
26
|
hash_new = { 'foo' => 'bar' }
|
|
30
27
|
hash_old.stringify_keys_recursively.must_equal hash_new
|
|
31
28
|
end
|
|
@@ -41,15 +38,13 @@ describe 'Hash#stringify_keys_recursively' do
|
|
|
41
38
|
hash_new = { '' => 'bar' }
|
|
42
39
|
hash_old.stringify_keys_recursively.must_equal hash_new
|
|
43
40
|
end
|
|
44
|
-
|
|
45
41
|
end
|
|
46
42
|
|
|
47
43
|
describe 'Hash#freeze_recursively' do
|
|
48
|
-
|
|
49
44
|
include Nanoc::TestHelpers
|
|
50
45
|
|
|
51
46
|
it 'should prevent first-level elements from being modified' do
|
|
52
|
-
hash = { :
|
|
47
|
+
hash = { a: { b: :c } }
|
|
53
48
|
hash.freeze_recursively
|
|
54
49
|
|
|
55
50
|
assert_raises_frozen_error do
|
|
@@ -58,7 +53,7 @@ describe 'Hash#freeze_recursively' do
|
|
|
58
53
|
end
|
|
59
54
|
|
|
60
55
|
it 'should prevent second-level elements from being modified' do
|
|
61
|
-
hash = { :
|
|
56
|
+
hash = { a: { b: :c } }
|
|
62
57
|
hash.freeze_recursively
|
|
63
58
|
|
|
64
59
|
assert_raises_frozen_error do
|
|
@@ -76,24 +71,17 @@ describe 'Hash#freeze_recursively' do
|
|
|
76
71
|
assert a[:x].frozen?
|
|
77
72
|
assert_equal a, a[:x]
|
|
78
73
|
end
|
|
79
|
-
|
|
80
74
|
end
|
|
81
75
|
|
|
82
76
|
describe 'Hash#checksum' do
|
|
83
|
-
|
|
84
77
|
it 'should work' do
|
|
85
78
|
expectation = 'wy7gHokc700tqJ/BmJ+EK6/F0bc='
|
|
86
|
-
{ :
|
|
79
|
+
{ foo: 123 }.checksum.must_equal expectation
|
|
87
80
|
end
|
|
88
81
|
|
|
89
82
|
it 'should not sort keys' do
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
a = { :a => 1, :c => 2, :b => 3 }.checksum
|
|
95
|
-
b = { :a => 1, :b => 3, :c => 2 }.checksum
|
|
83
|
+
a = { a: 1, c: 2, b: 3 }.checksum
|
|
84
|
+
b = { a: 1, b: 3, c: 2 }.checksum
|
|
96
85
|
a.wont_equal b
|
|
97
86
|
end
|
|
98
|
-
|
|
99
87
|
end
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
describe 'Pathname#checksum' do
|
|
4
|
-
|
|
5
4
|
it 'should work on empty files' do
|
|
6
5
|
begin
|
|
7
6
|
# Create file
|
|
8
7
|
FileUtils.mkdir_p('tmp')
|
|
9
8
|
File.open('tmp/myfile', 'w') { |io| io.write('') }
|
|
10
|
-
timestamp = Time.at(
|
|
9
|
+
timestamp = Time.at(1_234_569)
|
|
11
10
|
File.utime(timestamp, timestamp, 'tmp/myfile')
|
|
12
11
|
|
|
13
12
|
# Create checksum
|
|
@@ -23,7 +22,7 @@ describe 'Pathname#checksum' do
|
|
|
23
22
|
# Create file
|
|
24
23
|
FileUtils.mkdir_p('tmp')
|
|
25
24
|
File.open('tmp/myfile', 'w') { |io| io.write('abc') }
|
|
26
|
-
timestamp = Time.at(
|
|
25
|
+
timestamp = Time.at(1_234_569)
|
|
27
26
|
File.utime(timestamp, timestamp, 'tmp/myfile')
|
|
28
27
|
|
|
29
28
|
# Create checksum
|
|
@@ -33,5 +32,4 @@ describe 'Pathname#checksum' do
|
|
|
33
32
|
FileUtils.rm_rf('tmp')
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
|
-
|
|
37
35
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
describe 'String#cleaned_identifier' do
|
|
4
|
-
|
|
5
4
|
it 'should not convert already clean paths' do
|
|
6
5
|
'/foo/bar/'.cleaned_identifier.must_equal '/foo/bar/'
|
|
7
6
|
end
|
|
@@ -21,11 +20,9 @@ describe 'String#cleaned_identifier' do
|
|
|
21
20
|
it 'should remove double slashes at end' do
|
|
22
21
|
'/foo/bar//'.cleaned_identifier.must_equal '/foo/bar/'
|
|
23
22
|
end
|
|
24
|
-
|
|
25
23
|
end
|
|
26
24
|
|
|
27
25
|
describe 'String#checksum' do
|
|
28
|
-
|
|
29
26
|
it 'should work on empty strings' do
|
|
30
27
|
''.checksum.must_equal 'PfY7essFItpoXa1f6EuB/deyUmQ='
|
|
31
28
|
end
|
|
@@ -33,5 +30,4 @@ describe 'String#checksum' do
|
|
|
33
30
|
it 'should work on all strings' do
|
|
34
31
|
'abc'.checksum.must_equal 'NkkYRO+25f6psNSeCYykXKCg3C0='
|
|
35
32
|
end
|
|
36
|
-
|
|
37
33
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
describe Nanoc::TempFilenameFactory do
|
|
4
|
-
|
|
5
4
|
subject do
|
|
6
5
|
Nanoc::TempFilenameFactory.instance
|
|
7
6
|
end
|
|
@@ -13,7 +12,6 @@ describe Nanoc::TempFilenameFactory do
|
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
describe '#create' do
|
|
16
|
-
|
|
17
15
|
it 'should create unique paths' do
|
|
18
16
|
path_a = subject.create(prefix)
|
|
19
17
|
path_b = subject.create(prefix)
|
|
@@ -37,11 +35,9 @@ describe Nanoc::TempFilenameFactory do
|
|
|
37
35
|
path_b = subject.create(prefix)
|
|
38
36
|
path_a.must_equal(path_b)
|
|
39
37
|
end
|
|
40
|
-
|
|
41
38
|
end
|
|
42
39
|
|
|
43
40
|
describe '#cleanup' do
|
|
44
|
-
|
|
45
41
|
it 'should remove generated files' do
|
|
46
42
|
path_a = subject.create(prefix)
|
|
47
43
|
File.file?(path_a).wont_equal(true) # not yet used
|
|
@@ -60,11 +56,9 @@ describe Nanoc::TempFilenameFactory do
|
|
|
60
56
|
subject.cleanup(prefix)
|
|
61
57
|
File.directory?(subject.root_dir).wont_equal(true)
|
|
62
58
|
end
|
|
63
|
-
|
|
64
59
|
end
|
|
65
60
|
|
|
66
61
|
describe 'other instance' do
|
|
67
|
-
|
|
68
62
|
let(:other_instance) do
|
|
69
63
|
Nanoc::TempFilenameFactory.new
|
|
70
64
|
end
|
|
@@ -74,7 +68,5 @@ describe Nanoc::TempFilenameFactory do
|
|
|
74
68
|
path_b = other_instance.create(prefix)
|
|
75
69
|
path_a.wont_equal(path_b)
|
|
76
70
|
end
|
|
77
|
-
|
|
78
71
|
end
|
|
79
|
-
|
|
80
72
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::ChecksumStoreTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_get_with_existing_object
|
|
6
5
|
require 'pstore'
|
|
7
6
|
|
|
@@ -28,5 +27,4 @@ class Nanoc::ChecksumStoreTest < Nanoc::TestCase
|
|
|
28
27
|
obj = Nanoc::Item.new('Moo?', {}, '/animals/cow/')
|
|
29
28
|
assert_equal nil, store[obj]
|
|
30
29
|
end
|
|
31
|
-
|
|
32
30
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::CodeSnippetTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_load
|
|
6
5
|
# Initialize
|
|
7
6
|
$complete_insane_parrot = 'meow'
|
|
@@ -25,5 +24,4 @@ class Nanoc::CodeSnippetTest < Nanoc::TestCase
|
|
|
25
24
|
# Ensure binding is correct
|
|
26
25
|
assert_equal('meow', @foo)
|
|
27
26
|
end
|
|
28
|
-
|
|
29
27
|
end
|
data/test/base/test_compiler.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::CompilerTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_compilation_rule_for
|
|
6
5
|
# Mock rules
|
|
7
6
|
rules = [mock, mock, mock]
|
|
@@ -54,14 +53,14 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
54
53
|
|
|
55
54
|
# Create compiler
|
|
56
55
|
compiler = Nanoc::Compiler.new(site)
|
|
57
|
-
compiler.rules_collection.layout_filter_mapping[/.*/] = [:erb, { :
|
|
56
|
+
compiler.rules_collection.layout_filter_mapping[/.*/] = [:erb, { foo: 'bar' }]
|
|
58
57
|
|
|
59
58
|
# Mock layout
|
|
60
59
|
layout = MiniTest::Mock.new
|
|
61
60
|
layout.expect(:identifier, '/some_layout/')
|
|
62
61
|
|
|
63
62
|
# Check
|
|
64
|
-
assert_equal([:erb, { :
|
|
63
|
+
assert_equal([:erb, { foo: 'bar' }], compiler.rules_collection.filter_for_layout(layout))
|
|
65
64
|
end
|
|
66
65
|
|
|
67
66
|
def test_filter_for_layout_with_existant_layout_and_unknown_filter
|
|
@@ -70,14 +69,14 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
70
69
|
|
|
71
70
|
# Create compiler
|
|
72
71
|
compiler = Nanoc::Compiler.new(site)
|
|
73
|
-
compiler.rules_collection.layout_filter_mapping[/.*/] = [:some_unknown_filter, { :
|
|
72
|
+
compiler.rules_collection.layout_filter_mapping[/.*/] = [:some_unknown_filter, { foo: 'bar' }]
|
|
74
73
|
|
|
75
74
|
# Mock layout
|
|
76
75
|
layout = MiniTest::Mock.new
|
|
77
76
|
layout.expect(:identifier, '/some_layout/')
|
|
78
77
|
|
|
79
78
|
# Check
|
|
80
|
-
assert_equal([:some_unknown_filter, { :
|
|
79
|
+
assert_equal([:some_unknown_filter, { foo: 'bar' }], compiler.rules_collection.filter_for_layout(layout))
|
|
81
80
|
end
|
|
82
81
|
|
|
83
82
|
def test_filter_for_layout_with_nonexistant_layout
|
|
@@ -86,7 +85,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
86
85
|
|
|
87
86
|
# Create compiler
|
|
88
87
|
compiler = Nanoc::Compiler.new(site)
|
|
89
|
-
compiler.rules_collection.layout_filter_mapping[%r{^/foo/$}] = [:erb, { :
|
|
88
|
+
compiler.rules_collection.layout_filter_mapping[%r{^/foo/$}] = [:erb, { foo: 'bar' }]
|
|
90
89
|
|
|
91
90
|
# Mock layout
|
|
92
91
|
layout = MiniTest::Mock.new
|
|
@@ -102,10 +101,10 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
102
101
|
|
|
103
102
|
# Create compiler
|
|
104
103
|
compiler = Nanoc::Compiler.new(site)
|
|
105
|
-
compiler.rules_collection.layout_filter_mapping[%r{^/a/b/c/.*/$}] = [:erb, { :
|
|
106
|
-
compiler.rules_collection.layout_filter_mapping[%r{^/a/.*/$}] = [:erb, { :
|
|
107
|
-
compiler.rules_collection.layout_filter_mapping[%r{^/a/b/.*/$}] = [:erb, { :
|
|
108
|
-
compiler.rules_collection.layout_filter_mapping[%r{^/.*/$}] = [:erb, { :
|
|
104
|
+
compiler.rules_collection.layout_filter_mapping[%r{^/a/b/c/.*/$}] = [:erb, { char: 'd' }]
|
|
105
|
+
compiler.rules_collection.layout_filter_mapping[%r{^/a/.*/$}] = [:erb, { char: 'b' }]
|
|
106
|
+
compiler.rules_collection.layout_filter_mapping[%r{^/a/b/.*/$}] = [:erb, { char: 'c' }] # never used!
|
|
107
|
+
compiler.rules_collection.layout_filter_mapping[%r{^/.*/$}] = [:erb, { char: 'a' }]
|
|
109
108
|
|
|
110
109
|
# Mock layout
|
|
111
110
|
layouts = [mock, mock, mock, mock]
|
|
@@ -137,10 +136,10 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
137
136
|
|
|
138
137
|
# Set snapshot filenames
|
|
139
138
|
rep.raw_paths = {
|
|
140
|
-
:
|
|
141
|
-
:
|
|
142
|
-
:
|
|
143
|
-
:
|
|
139
|
+
raw: 'raw.txt',
|
|
140
|
+
pre: 'pre.txt',
|
|
141
|
+
post: 'post.txt',
|
|
142
|
+
last: 'last.txt'
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
# Create rule
|
|
@@ -217,7 +216,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
217
216
|
end
|
|
218
217
|
|
|
219
218
|
def test_compile_with_two_dependent_reps
|
|
220
|
-
with_site(:
|
|
219
|
+
with_site(compilation_rule_content: 'filter :erb') do |site|
|
|
221
220
|
File.open('content/foo.html', 'w') do |io|
|
|
222
221
|
io.write('<%= @items.find { |i| i.identifier == "/bar/" }.compiled_content %>!!!')
|
|
223
222
|
end
|
|
@@ -236,7 +235,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
236
235
|
end
|
|
237
236
|
|
|
238
237
|
def test_compile_with_two_mutually_dependent_reps
|
|
239
|
-
with_site(:
|
|
238
|
+
with_site(compilation_rule_content: 'filter :erb') do |site|
|
|
240
239
|
File.open('content/foo.html', 'w') do |io|
|
|
241
240
|
io.write('<%= @items.find { |i| i.identifier == "/bar/" }.compiled_content %>')
|
|
242
241
|
end
|
|
@@ -589,5 +588,4 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
|
589
588
|
assert_empty stack
|
|
590
589
|
end
|
|
591
590
|
end
|
|
592
|
-
|
|
593
591
|
end
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::CompilerDSLTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_compile
|
|
6
|
-
# TODO implement
|
|
5
|
+
# TODO: implement
|
|
7
6
|
end
|
|
8
7
|
|
|
9
8
|
def test_route
|
|
10
|
-
# TODO implement
|
|
9
|
+
# TODO: implement
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
def test_layout
|
|
14
|
-
# TODO implement
|
|
13
|
+
# TODO: implement
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
def test_preprocess_twice
|
|
@@ -38,7 +37,7 @@ class Nanoc::CompilerDSLTest < Nanoc::TestCase
|
|
|
38
37
|
Nanoc::CLI.run %w( create_site per-rules-file-preprocessor )
|
|
39
38
|
FileUtils.cd('per-rules-file-preprocessor') do
|
|
40
39
|
# Create rep
|
|
41
|
-
item = Nanoc::Item.new('foo', { :
|
|
40
|
+
item = Nanoc::Item.new('foo', { extension: 'bar' }, '/foo/')
|
|
42
41
|
|
|
43
42
|
# Create a bonus rules file
|
|
44
43
|
File.open('more_rules.rb', 'w') { |io| io.write "preprocess { @items['/foo/'][:preprocessed] = true }" }
|
|
@@ -59,7 +58,7 @@ class Nanoc::CompilerDSLTest < Nanoc::TestCase
|
|
|
59
58
|
# Check that the two preprocess blocks have been added
|
|
60
59
|
assert_equal 2, site.compiler.rules_collection.preprocessors.size
|
|
61
60
|
refute_nil site.compiler.rules_collection.preprocessors.first
|
|
62
|
-
refute_nil site.compiler.rules_collection.preprocessors.last
|
|
61
|
+
refute_nil site.compiler.rules_collection.preprocessors.to_a.last
|
|
63
62
|
|
|
64
63
|
# Apply preprocess blocks
|
|
65
64
|
site.compiler.preprocess
|
|
@@ -72,7 +71,7 @@ class Nanoc::CompilerDSLTest < Nanoc::TestCase
|
|
|
72
71
|
Nanoc::CLI.run %w( create_site with_bonus_rules )
|
|
73
72
|
FileUtils.cd('with_bonus_rules') do
|
|
74
73
|
# Create rep
|
|
75
|
-
item = Nanoc::Item.new('foo', { :
|
|
74
|
+
item = Nanoc::Item.new('foo', { extension: 'bar' }, '/foo/')
|
|
76
75
|
rep = Nanoc::ItemRep.new(item, :default)
|
|
77
76
|
|
|
78
77
|
# Create a bonus rules file
|
|
@@ -377,9 +376,8 @@ EOS
|
|
|
377
376
|
|
|
378
377
|
def test_config
|
|
379
378
|
$venetian = 'unsnares'
|
|
380
|
-
compiler_dsl = Nanoc::CompilerDSL.new(nil, { :
|
|
379
|
+
compiler_dsl = Nanoc::CompilerDSL.new(nil, { venetian: 'snares' })
|
|
381
380
|
compiler_dsl.instance_eval { $venetian = @config[:venetian] }
|
|
382
381
|
assert_equal 'snares', $venetian
|
|
383
382
|
end
|
|
384
|
-
|
|
385
383
|
end
|
data/test/base/test_context.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::ContextTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_context_with_instance_variable
|
|
6
5
|
# Create context
|
|
7
|
-
context = Nanoc::Context.new({ :
|
|
6
|
+
context = Nanoc::Context.new({ foo: 'bar', baz: 'quux' })
|
|
8
7
|
|
|
9
8
|
# Ensure correct evaluation
|
|
10
9
|
assert_equal('bar', eval('@foo', context.get_binding))
|
|
@@ -12,7 +11,7 @@ class Nanoc::ContextTest < Nanoc::TestCase
|
|
|
12
11
|
|
|
13
12
|
def test_context_with_instance_method
|
|
14
13
|
# Create context
|
|
15
|
-
context = Nanoc::Context.new({ :
|
|
14
|
+
context = Nanoc::Context.new({ foo: 'bar', baz: 'quux' })
|
|
16
15
|
|
|
17
16
|
# Ensure correct evaluation
|
|
18
17
|
assert_equal('bar', eval('foo', context.get_binding))
|
|
@@ -25,5 +24,4 @@ class Nanoc::ContextTest < Nanoc::TestCase
|
|
|
25
24
|
# Run
|
|
26
25
|
assert_examples_correct 'Nanoc::Context#initialize'
|
|
27
26
|
end
|
|
28
|
-
|
|
29
27
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::DataSourceTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_loading
|
|
6
5
|
# Create data source
|
|
7
6
|
data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
|
|
@@ -40,5 +39,4 @@ class Nanoc::DataSourceTest < Nanoc::TestCase
|
|
|
40
39
|
assert_raises(NotImplementedError) { data_source.create_item(nil, nil, nil) }
|
|
41
40
|
assert_raises(NotImplementedError) { data_source.create_layout(nil, nil, nil) }
|
|
42
41
|
end
|
|
43
|
-
|
|
44
42
|
end
|