nanoc 3.7.4 → 3.7.5
Sign up to get free protection for your applications and to get access to all the features.
- 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,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_initialize
|
6
5
|
# Mock items
|
7
6
|
items = [mock, mock]
|
@@ -256,5 +255,4 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
256
255
|
tracker.forget_dependencies_for(items[0])
|
257
256
|
assert_empty tracker.objects_causing_outdatedness_of(items[0])
|
258
257
|
end
|
259
|
-
|
260
258
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_direct_predecessors
|
6
5
|
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
7
6
|
graph.add_edge(1, 2)
|
@@ -63,7 +62,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
63
62
|
|
64
63
|
def test_add_edge
|
65
64
|
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
66
|
-
|
65
|
+
|
67
66
|
assert_equal [], graph.successors_of(1)
|
68
67
|
assert_equal [], graph.predecessors_of(2)
|
69
68
|
|
@@ -84,7 +83,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
84
83
|
|
85
84
|
def test_delete_edge
|
86
85
|
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
87
|
-
graph.add_edge(1,2)
|
86
|
+
graph.add_edge(1, 2)
|
88
87
|
|
89
88
|
assert_equal [2], graph.successors_of(1)
|
90
89
|
assert_equal [1], graph.predecessors_of(2)
|
@@ -285,5 +284,4 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
285
284
|
YARD.parse(LIB_DIR + '/nanoc/base/directed_graph.rb')
|
286
285
|
assert_examples_correct 'Nanoc::DirectedGraph'
|
287
286
|
end
|
288
|
-
|
289
287
|
end
|
data/test/base/test_filter.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::FilterTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_initialize
|
6
5
|
# Create filter
|
7
6
|
filter = Nanoc::Filter.new
|
@@ -12,7 +11,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
|
|
12
11
|
|
13
12
|
def test_assigns
|
14
13
|
# Create filter
|
15
|
-
filter = Nanoc::Filter.new({ :
|
14
|
+
filter = Nanoc::Filter.new({ foo: 'bar' })
|
16
15
|
|
17
16
|
# Check assigns
|
18
17
|
assert_equal('bar', filter.assigns[:foo])
|
@@ -20,7 +19,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
|
|
20
19
|
|
21
20
|
def test_assigns_with_instance_variables
|
22
21
|
# Create filter
|
23
|
-
filter = Nanoc::Filter.new({ :
|
22
|
+
filter = Nanoc::Filter.new({ foo: 'bar' })
|
24
23
|
|
25
24
|
# Check assigns
|
26
25
|
assert_equal('bar', filter.instance_eval { @foo })
|
@@ -28,7 +27,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
|
|
28
27
|
|
29
28
|
def test_assigns_with_instance_methods
|
30
29
|
# Create filter
|
31
|
-
filter = Nanoc::Filter.new({ :
|
30
|
+
filter = Nanoc::Filter.new({ foo: 'bar' })
|
32
31
|
|
33
32
|
# Check assigns
|
34
33
|
assert_equal('bar', filter.instance_eval { foo })
|
@@ -52,7 +51,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
|
|
52
51
|
item_rep.expects(:name).returns(:quux)
|
53
52
|
|
54
53
|
# Create filter
|
55
|
-
filter = Nanoc::Filter.new({ :
|
54
|
+
filter = Nanoc::Filter.new({ item: item, item_rep: item_rep })
|
56
55
|
|
57
56
|
# Check filename
|
58
57
|
assert_equal('item /foo/bar/baz/ (rep quux)', filter.filename)
|
@@ -64,7 +63,7 @@ class Nanoc::FilterTest < Nanoc::TestCase
|
|
64
63
|
layout.expects(:identifier).returns('/wohba/')
|
65
64
|
|
66
65
|
# Create filter
|
67
|
-
filter = Nanoc::Filter.new({ :
|
66
|
+
filter = Nanoc::Filter.new({ item: mock, item_rep: mock, layout: layout })
|
68
67
|
|
69
68
|
# Check filename
|
70
69
|
assert_equal('layout /wohba/', filter.filename)
|
@@ -77,5 +76,4 @@ class Nanoc::FilterTest < Nanoc::TestCase
|
|
77
76
|
# Check filename
|
78
77
|
assert_equal('?', filter.filename)
|
79
78
|
end
|
80
|
-
|
81
79
|
end
|
data/test/base/test_item.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::ItemTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_initialize_with_attributes_with_string_keys
|
6
5
|
item = Nanoc::Item.new('foo', { 'abc' => 'xyz' }, '/foo/')
|
7
6
|
|
@@ -27,7 +26,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
27
26
|
# Create item
|
28
27
|
item = Nanoc::Item.new(
|
29
28
|
'content',
|
30
|
-
{ :
|
29
|
+
{ one: 'one in item' },
|
31
30
|
'/path/'
|
32
31
|
)
|
33
32
|
|
@@ -49,7 +48,9 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
49
48
|
def test_compiled_content_with_default_rep_and_default_snapshot
|
50
49
|
# Mock rep
|
51
50
|
rep = Object.new
|
52
|
-
def rep.name
|
51
|
+
def rep.name
|
52
|
+
:default
|
53
|
+
end
|
53
54
|
def rep.compiled_content(params)
|
54
55
|
"content at #{params[:snapshot].inspect}"
|
55
56
|
end
|
@@ -65,7 +66,9 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
65
66
|
def test_compiled_content_with_custom_rep_and_default_snapshot
|
66
67
|
# Mock reps
|
67
68
|
rep = Object.new
|
68
|
-
def rep.name
|
69
|
+
def rep.name
|
70
|
+
:foo
|
71
|
+
end
|
69
72
|
def rep.compiled_content(params)
|
70
73
|
"content at #{params[:snapshot].inspect}"
|
71
74
|
end
|
@@ -75,13 +78,15 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
75
78
|
item.expects(:reps).returns([rep])
|
76
79
|
|
77
80
|
# Check
|
78
|
-
assert_equal 'content at nil', item.compiled_content(:
|
81
|
+
assert_equal 'content at nil', item.compiled_content(rep: :foo)
|
79
82
|
end
|
80
83
|
|
81
84
|
def test_compiled_content_with_default_rep_and_custom_snapshot
|
82
85
|
# Mock reps
|
83
86
|
rep = Object.new
|
84
|
-
def rep.name
|
87
|
+
def rep.name
|
88
|
+
:default
|
89
|
+
end
|
85
90
|
def rep.compiled_content(params)
|
86
91
|
"content at #{params[:snapshot].inspect}"
|
87
92
|
end
|
@@ -91,7 +96,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
91
96
|
item.expects(:reps).returns([rep])
|
92
97
|
|
93
98
|
# Check
|
94
|
-
assert_equal 'content at :blah', item.compiled_content(:
|
99
|
+
assert_equal 'content at :blah', item.compiled_content(snapshot: :blah)
|
95
100
|
end
|
96
101
|
|
97
102
|
def test_compiled_content_with_custom_nonexistant_rep
|
@@ -101,7 +106,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
101
106
|
|
102
107
|
# Check
|
103
108
|
assert_raises(Nanoc::Errors::Generic) do
|
104
|
-
item.compiled_content(:
|
109
|
+
item.compiled_content(rep: :lkasdhflahgwfe)
|
105
110
|
end
|
106
111
|
end
|
107
112
|
|
@@ -130,11 +135,11 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
130
135
|
item.expects(:reps).returns([rep])
|
131
136
|
|
132
137
|
# Check
|
133
|
-
assert_equal 'the correct path', item.path(:
|
138
|
+
assert_equal 'the correct path', item.path(rep: :moo)
|
134
139
|
end
|
135
140
|
|
136
141
|
def test_freeze_should_disallow_changes
|
137
|
-
item = Nanoc::Item.new('foo', { :
|
142
|
+
item = Nanoc::Item.new('foo', { a: { b: 123 } }, '/foo/')
|
138
143
|
item.freeze
|
139
144
|
|
140
145
|
assert_raises_frozen_error do
|
@@ -149,14 +154,13 @@ class Nanoc::ItemTest < Nanoc::TestCase
|
|
149
154
|
def test_dump_and_load
|
150
155
|
item = Nanoc::Item.new(
|
151
156
|
'foobar',
|
152
|
-
{ :
|
157
|
+
{ a: { b: 123 } },
|
153
158
|
'/foo/')
|
154
159
|
|
155
160
|
item = Marshal.load(Marshal.dump(item))
|
156
161
|
|
157
162
|
assert_equal '/foo/', item.identifier
|
158
163
|
assert_equal 'foobar', item.raw_content
|
159
|
-
assert_equal({ :
|
164
|
+
assert_equal({ a: { b: 123 } }, item.attributes)
|
160
165
|
end
|
161
|
-
|
162
166
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::ItemArrayTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def setup
|
6
5
|
super
|
7
6
|
|
@@ -229,7 +228,7 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
229
228
|
assert_equal 'Item 1', @items['/new/1/'].raw_content
|
230
229
|
end
|
231
230
|
|
232
|
-
if
|
231
|
+
if [].respond_to?(:keep_if)
|
233
232
|
def test_keep_if
|
234
233
|
assert_equal @two, @items[1]
|
235
234
|
assert_equal @two, @items['/two/']
|
@@ -289,7 +288,7 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
289
288
|
assert_equal mona, @items['/mona/']
|
290
289
|
end
|
291
290
|
|
292
|
-
if
|
291
|
+
if [].respond_to?(:select!)
|
293
292
|
def test_select_bang
|
294
293
|
assert_equal @two, @items[1]
|
295
294
|
assert_equal @two, @items['/two/']
|
@@ -330,5 +329,4 @@ class Nanoc::ItemArrayTest < Nanoc::TestCase
|
|
330
329
|
assert_equal @two, @items[2]
|
331
330
|
assert_equal @two, @items['/two/']
|
332
331
|
end
|
333
|
-
|
334
332
|
end
|
data/test/base/test_item_rep.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::ItemRepTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_created_modified_compiled
|
6
|
-
# TODO implement
|
5
|
+
# TODO: implement
|
7
6
|
end
|
8
7
|
|
9
8
|
def test_compiled_content_with_only_last_available
|
10
9
|
# Create rep
|
11
10
|
item = Nanoc::Item.new(
|
12
11
|
'blah blah blah', {}, '/',
|
13
|
-
:
|
12
|
+
binary: false, mtime: Time.now - 500
|
14
13
|
)
|
15
14
|
rep = Nanoc::ItemRep.new(item, nil)
|
16
|
-
rep.instance_eval { @content = { :
|
15
|
+
rep.instance_eval { @content = { last: 'last content' } }
|
17
16
|
rep.expects(:compiled?).returns(true)
|
18
17
|
|
19
18
|
# Check
|
@@ -24,10 +23,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
24
23
|
# Create rep
|
25
24
|
item = Nanoc::Item.new(
|
26
25
|
'blah blah blah', {}, '/',
|
27
|
-
:
|
26
|
+
binary: false, mtime: Time.now - 500
|
28
27
|
)
|
29
28
|
rep = Nanoc::ItemRep.new(item, nil)
|
30
|
-
rep.instance_eval { @content = { :
|
29
|
+
rep.instance_eval { @content = { pre: 'pre content', last: 'last content' } }
|
31
30
|
rep.expects(:compiled?).returns(true)
|
32
31
|
|
33
32
|
# Check
|
@@ -38,28 +37,28 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
38
37
|
# Create rep
|
39
38
|
item = Nanoc::Item.new(
|
40
39
|
'blah blah blah', {}, '/',
|
41
|
-
:
|
40
|
+
binary: false, mtime: Time.now - 500
|
42
41
|
)
|
43
42
|
rep = Nanoc::ItemRep.new(item, nil)
|
44
|
-
rep.instance_eval { @content = { :
|
43
|
+
rep.instance_eval { @content = { pre: 'pre content', last: 'last content' } }
|
45
44
|
rep.expects(:compiled?).returns(true)
|
46
45
|
|
47
46
|
# Check
|
48
|
-
assert_equal 'last content', rep.compiled_content(:
|
47
|
+
assert_equal 'last content', rep.compiled_content(snapshot: :last)
|
49
48
|
end
|
50
49
|
|
51
50
|
def test_compiled_content_with_invalid_snapshot
|
52
51
|
# Create rep
|
53
52
|
item = Nanoc::Item.new(
|
54
53
|
'blah blah blah', {}, '/',
|
55
|
-
:
|
54
|
+
binary: false, mtime: Time.now - 500
|
56
55
|
)
|
57
56
|
rep = Nanoc::ItemRep.new(item, nil)
|
58
|
-
rep.instance_eval { @content = { :
|
57
|
+
rep.instance_eval { @content = { pre: 'pre content', last: 'last content' } }
|
59
58
|
|
60
59
|
# Check
|
61
60
|
assert_raises Nanoc::Errors::NoSuchSnapshot do
|
62
|
-
rep.compiled_content(:
|
61
|
+
rep.compiled_content(snapshot: :klsjflkasdfl)
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
@@ -67,7 +66,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
67
66
|
# Create rep
|
68
67
|
item = Nanoc::Item.new(
|
69
68
|
'blah blah', {}, '/',
|
70
|
-
:
|
69
|
+
binary: false
|
71
70
|
)
|
72
71
|
rep = Nanoc::ItemRep.new(item, nil)
|
73
72
|
rep.expects(:compiled?).returns(false)
|
@@ -88,7 +87,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
88
87
|
# Mock item
|
89
88
|
item = Nanoc::Item.new(
|
90
89
|
%(<%= '<%= "blah" %' + '>' %>), {}, '/',
|
91
|
-
:
|
90
|
+
binary: false
|
92
91
|
)
|
93
92
|
|
94
93
|
# Create item rep
|
@@ -116,7 +115,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
116
115
|
# Mock item
|
117
116
|
item = Nanoc::Item.new(
|
118
117
|
'blah blah', {}, '/',
|
119
|
-
:
|
118
|
+
binary: false
|
120
119
|
)
|
121
120
|
|
122
121
|
# Create item rep
|
@@ -142,7 +141,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
142
141
|
# Mock item
|
143
142
|
item = Nanoc::Item.new(
|
144
143
|
%(<%= '<%= "blah" %' + '>' %>), {}, '/foobar/',
|
145
|
-
:
|
144
|
+
binary: false
|
146
145
|
)
|
147
146
|
|
148
147
|
# Create item rep
|
@@ -170,36 +169,36 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
170
169
|
# Mock item
|
171
170
|
item = Nanoc::Item.new(
|
172
171
|
'blah blah', {}, '/',
|
173
|
-
:
|
172
|
+
binary: false
|
174
173
|
)
|
175
174
|
|
176
175
|
# Create rep
|
177
176
|
item_rep = Nanoc::ItemRep.new(item, :foo)
|
178
177
|
item_rep.instance_eval { @content[:last] = 'Lorem ipsum, etc.' }
|
179
|
-
item_rep.raw_paths = { :
|
178
|
+
item_rep.raw_paths = { moo: 'foo-moo.txt' }
|
180
179
|
|
181
180
|
# Test non-final
|
182
|
-
refute File.file?(item_rep.raw_path(:
|
183
|
-
item_rep.snapshot(:moo, :
|
184
|
-
refute File.file?(item_rep.raw_path(:
|
181
|
+
refute File.file?(item_rep.raw_path(snapshot: :moo))
|
182
|
+
item_rep.snapshot(:moo, final: false)
|
183
|
+
refute File.file?(item_rep.raw_path(snapshot: :moo))
|
185
184
|
|
186
185
|
# Test final 1
|
187
|
-
item_rep.snapshot(:moo, :
|
188
|
-
assert File.file?(item_rep.raw_path(:
|
189
|
-
assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(:
|
190
|
-
FileUtils.rm_f(item_rep.raw_path(:
|
186
|
+
item_rep.snapshot(:moo, final: true)
|
187
|
+
assert File.file?(item_rep.raw_path(snapshot: :moo))
|
188
|
+
assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(snapshot: :moo))
|
189
|
+
FileUtils.rm_f(item_rep.raw_path(snapshot: :moo))
|
191
190
|
|
192
191
|
# Test final 2
|
193
192
|
item_rep.snapshot(:moo)
|
194
|
-
assert File.file?(item_rep.raw_path(:
|
195
|
-
assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(:
|
193
|
+
assert File.file?(item_rep.raw_path(snapshot: :moo))
|
194
|
+
assert_equal 'Lorem ipsum, etc.', File.read(item_rep.raw_path(snapshot: :moo))
|
196
195
|
end
|
197
196
|
|
198
197
|
def test_write_should_not_touch_identical_textual_files
|
199
198
|
# Mock item
|
200
199
|
item = Nanoc::Item.new(
|
201
200
|
'blah blah', {}, '/',
|
202
|
-
:
|
201
|
+
binary: false
|
203
202
|
)
|
204
203
|
|
205
204
|
# Create rep
|
@@ -210,7 +209,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
210
209
|
|
211
210
|
# Write once
|
212
211
|
item_rep.write
|
213
|
-
a_long_time_ago = Time.now-1_000_000
|
212
|
+
a_long_time_ago = Time.now - 1_000_000
|
214
213
|
File.utime(a_long_time_ago, a_long_time_ago, item_rep.raw_path)
|
215
214
|
|
216
215
|
# Write again
|
@@ -223,7 +222,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
223
222
|
# Mock item
|
224
223
|
item = Nanoc::Item.new(
|
225
224
|
'blah blah', {}, '/',
|
226
|
-
:
|
225
|
+
binary: false
|
227
226
|
)
|
228
227
|
|
229
228
|
# Create rep
|
@@ -243,18 +242,20 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
243
242
|
# Mock item
|
244
243
|
item = Nanoc::Item.new(
|
245
244
|
'blah blah', {}, '/',
|
246
|
-
:
|
245
|
+
binary: false
|
247
246
|
)
|
248
247
|
|
249
248
|
# Create rep
|
250
249
|
rep = Nanoc::ItemRep.new(item, :foo)
|
251
|
-
def rep.assigns
|
250
|
+
def rep.assigns
|
251
|
+
{}
|
252
|
+
end
|
252
253
|
|
253
254
|
# Create fake filter
|
254
|
-
def rep.filter_named(
|
255
|
+
def rep.filter_named(_name)
|
255
256
|
@filter ||= Class.new(::Nanoc::Filter) do
|
256
|
-
type :
|
257
|
-
def run(content,
|
257
|
+
type text: :binary
|
258
|
+
def run(content, _params = {})
|
258
259
|
File.open(output_filename, 'w') { |io| io.write(content) }
|
259
260
|
end
|
260
261
|
end
|
@@ -271,18 +272,20 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
271
272
|
# Mock item
|
272
273
|
item = Nanoc::Item.new(
|
273
274
|
'blah blah', {}, '/',
|
274
|
-
:
|
275
|
+
binary: false
|
275
276
|
)
|
276
277
|
|
277
278
|
# Create rep
|
278
279
|
rep = Nanoc::ItemRep.new(item, :foo)
|
279
|
-
def rep.assigns
|
280
|
+
def rep.assigns
|
281
|
+
{}
|
282
|
+
end
|
280
283
|
|
281
284
|
# Create fake filter
|
282
|
-
def rep.filter_named(
|
285
|
+
def rep.filter_named(_name)
|
283
286
|
@filter ||= Class.new(::Nanoc::Filter) do
|
284
287
|
type :binary
|
285
|
-
def run(content,
|
288
|
+
def run(content, _params = {})
|
286
289
|
File.open(output_filename, 'w') { |io| io.write(content) }
|
287
290
|
end
|
288
291
|
end
|
@@ -296,9 +299,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
296
299
|
|
297
300
|
def test_using_textual_filters_on_binary_reps_raises
|
298
301
|
item = create_binary_item
|
299
|
-
site = mock_and_stub(:
|
300
|
-
:
|
301
|
-
:
|
302
|
+
site = mock_and_stub(items: [item],
|
303
|
+
layouts: [],
|
304
|
+
config: []
|
302
305
|
)
|
303
306
|
item.stubs(:site).returns(site)
|
304
307
|
rep = create_rep_for(item, :foo)
|
@@ -334,13 +337,13 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
334
337
|
# Create item and item rep
|
335
338
|
item = create_binary_item
|
336
339
|
rep = create_rep_for(item, :foo)
|
337
|
-
rep.assigns = { :
|
340
|
+
rep.assigns = { content: 'meh' }
|
338
341
|
|
339
342
|
# Create filter
|
340
343
|
Class.new(::Nanoc::Filter) do
|
341
|
-
type :
|
344
|
+
type binary: :text
|
342
345
|
identifier :binary_to_text
|
343
|
-
def run(content,
|
346
|
+
def run(content, _params = {})
|
344
347
|
content + ' textified'
|
345
348
|
end
|
346
349
|
end
|
@@ -353,9 +356,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
353
356
|
|
354
357
|
def test_converted_binary_rep_can_be_filtered_with_textual_filters
|
355
358
|
item = create_binary_item
|
356
|
-
site = mock_and_stub(:
|
357
|
-
:
|
358
|
-
:
|
359
|
+
site = mock_and_stub(items: [item],
|
360
|
+
layouts: [],
|
361
|
+
config: []
|
359
362
|
)
|
360
363
|
item.stubs(:site).returns(site)
|
361
364
|
rep = create_rep_for(item, :foo)
|
@@ -364,10 +367,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
364
367
|
|
365
368
|
assert rep.binary?
|
366
369
|
|
367
|
-
def rep.filter_named(
|
370
|
+
def rep.filter_named(_name)
|
368
371
|
Class.new(::Nanoc::Filter) do
|
369
|
-
type :
|
370
|
-
def run(
|
372
|
+
type binary: :text
|
373
|
+
def run(_content, _params = {})
|
371
374
|
'Some textual content'
|
372
375
|
end
|
373
376
|
end
|
@@ -375,10 +378,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
375
378
|
rep.filter(:binary_to_text)
|
376
379
|
assert !rep.binary?
|
377
380
|
|
378
|
-
def rep.filter_named(
|
381
|
+
def rep.filter_named(_name)
|
379
382
|
Class.new(::Nanoc::Filter) do
|
380
383
|
type :text
|
381
|
-
def run(
|
384
|
+
def run(_content, _params = {})
|
382
385
|
'Some textual content'
|
383
386
|
end
|
384
387
|
end
|
@@ -390,9 +393,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
390
393
|
def test_converted_binary_rep_cannot_be_filtered_with_binary_filters
|
391
394
|
item = create_binary_item
|
392
395
|
site = mock_and_stub(
|
393
|
-
:
|
394
|
-
:
|
395
|
-
:
|
396
|
+
items: [item],
|
397
|
+
layouts: [],
|
398
|
+
config: []
|
396
399
|
)
|
397
400
|
item.stubs(:site).returns(site)
|
398
401
|
rep = create_rep_for(item, :foo)
|
@@ -400,10 +403,10 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
400
403
|
create_binary_filter
|
401
404
|
|
402
405
|
assert rep.binary?
|
403
|
-
def rep.filter_named(
|
406
|
+
def rep.filter_named(_name)
|
404
407
|
@filter ||= Class.new(::Nanoc::Filter) do
|
405
|
-
type :
|
406
|
-
def run(
|
408
|
+
type binary: :text
|
409
|
+
def run(_content, _params = {})
|
407
410
|
'Some textual content'
|
408
411
|
end
|
409
412
|
end
|
@@ -415,7 +418,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
415
418
|
|
416
419
|
def test_new_content_should_be_frozen
|
417
420
|
filter_class = Class.new(::Nanoc::Filter) do
|
418
|
-
def run(content,
|
421
|
+
def run(content, _params = {})
|
419
422
|
content.gsub!('foo', 'moo')
|
420
423
|
content
|
421
424
|
end
|
@@ -424,7 +427,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
424
427
|
item = Nanoc::Item.new('foo bar', {}, '/foo/')
|
425
428
|
rep = Nanoc::ItemRep.new(item, :default)
|
426
429
|
rep.instance_eval { @filter_class = filter_class }
|
427
|
-
def rep.filter_named(
|
430
|
+
def rep.filter_named(_name)
|
431
|
+
@filter_class
|
432
|
+
end
|
428
433
|
|
429
434
|
assert_raises_frozen_error do
|
430
435
|
rep.filter(:whatever)
|
@@ -433,7 +438,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
433
438
|
|
434
439
|
def test_filter_should_freeze_content
|
435
440
|
filter_class = Class.new(::Nanoc::Filter) do
|
436
|
-
def run(content,
|
441
|
+
def run(content, _params = {})
|
437
442
|
content.gsub!('foo', 'moo')
|
438
443
|
content
|
439
444
|
end
|
@@ -442,7 +447,9 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
442
447
|
item = Nanoc::Item.new('foo bar', {}, '/foo/')
|
443
448
|
rep = Nanoc::ItemRep.new(item, :default)
|
444
449
|
rep.instance_eval { @filter_class = filter_class }
|
445
|
-
def rep.filter_named(
|
450
|
+
def rep.filter_named(_name)
|
451
|
+
@filter_class
|
452
|
+
end
|
446
453
|
|
447
454
|
assert_raises_frozen_error do
|
448
455
|
rep.filter(:erb)
|
@@ -491,7 +498,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
491
498
|
end
|
492
499
|
|
493
500
|
def test_access_compiled_content_of_binary_item
|
494
|
-
item = Nanoc::Item.new('content/somefile.dat', {}, '/somefile/', :
|
501
|
+
item = Nanoc::Item.new('content/somefile.dat', {}, '/somefile/', binary: true)
|
495
502
|
item_rep = Nanoc::ItemRep.new(item, :foo)
|
496
503
|
assert_raises(Nanoc::Errors::CannotGetCompiledContentOfBinaryItem) do
|
497
504
|
item_rep.compiled_content
|
@@ -504,7 +511,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
504
511
|
File.open('content/meow.dat', 'w') { |io| io.write('asdf') }
|
505
512
|
item = Nanoc::Item.new(
|
506
513
|
'content/meow.dat', {}, '/',
|
507
|
-
:
|
514
|
+
binary: true
|
508
515
|
)
|
509
516
|
|
510
517
|
# Create rep
|
@@ -516,7 +523,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
516
523
|
|
517
524
|
# Write
|
518
525
|
notified = false
|
519
|
-
Nanoc::NotificationCenter.on(:rep_written, self) do |
|
526
|
+
Nanoc::NotificationCenter.on(:rep_written, self) do |_rep, _raw_path, is_created, is_modified|
|
520
527
|
notified = true
|
521
528
|
assert is_created
|
522
529
|
assert is_modified
|
@@ -532,7 +539,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
532
539
|
File.open('content/meow.dat', 'w') { |io| io.write('asdf') }
|
533
540
|
item = Nanoc::Item.new(
|
534
541
|
'content/meow.dat', {}, '/',
|
535
|
-
:
|
542
|
+
binary: true
|
536
543
|
)
|
537
544
|
|
538
545
|
# Create rep
|
@@ -546,7 +553,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
546
553
|
|
547
554
|
# Write
|
548
555
|
notified = false
|
549
|
-
Nanoc::NotificationCenter.on(:rep_written, self) do |
|
556
|
+
Nanoc::NotificationCenter.on(:rep_written, self) do |_rep, _raw_path, is_created, is_modified|
|
550
557
|
notified = true
|
551
558
|
refute is_created
|
552
559
|
assert is_modified
|
@@ -561,14 +568,14 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
561
568
|
def create_binary_item
|
562
569
|
Nanoc::Item.new(
|
563
570
|
'/a/file/name.dat', {}, '/',
|
564
|
-
:
|
571
|
+
binary: true
|
565
572
|
)
|
566
573
|
end
|
567
574
|
|
568
575
|
def mock_and_stub(params)
|
569
576
|
m = mock
|
570
577
|
params.each do |method, return_value|
|
571
|
-
m.stubs(method.to_sym).returns(
|
578
|
+
m.stubs(method.to_sym).returns(return_value)
|
572
579
|
end
|
573
580
|
m
|
574
581
|
end
|
@@ -580,7 +587,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
580
587
|
def create_textual_filter
|
581
588
|
f = create_filter(:text)
|
582
589
|
f.class_eval do
|
583
|
-
def run(
|
590
|
+
def run(_content, _params = {})
|
584
591
|
''
|
585
592
|
end
|
586
593
|
end
|
@@ -590,7 +597,7 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
590
597
|
def create_binary_filter
|
591
598
|
f = create_filter(:binary)
|
592
599
|
f.class_eval do
|
593
|
-
def run(content,
|
600
|
+
def run(content, _params = {})
|
594
601
|
File.open(output_filename, 'w') { |io| io.write(content) }
|
595
602
|
end
|
596
603
|
end
|
@@ -603,5 +610,4 @@ class Nanoc::ItemRepTest < Nanoc::TestCase
|
|
603
610
|
Nanoc::Filter.register filter_klass, "#{type}_filter".to_sym
|
604
611
|
filter_klass
|
605
612
|
end
|
606
|
-
|
607
613
|
end
|