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
data/test/base/test_layout.rb
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::LayoutTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_initialize
|
|
6
5
|
# Make sure attributes are cleaned
|
|
7
6
|
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
|
8
|
-
assert_equal({ :
|
|
7
|
+
assert_equal({ foo: 'bar' }, layout.attributes)
|
|
9
8
|
|
|
10
9
|
# Make sure identifier is cleaned
|
|
11
10
|
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, 'foo')
|
|
@@ -39,14 +38,13 @@ class Nanoc::LayoutTest < Nanoc::TestCase
|
|
|
39
38
|
def test_dump_and_load
|
|
40
39
|
layout = Nanoc::Layout.new(
|
|
41
40
|
'foobar',
|
|
42
|
-
{ :
|
|
41
|
+
{ a: { b: 123 } },
|
|
43
42
|
'/foo/')
|
|
44
43
|
|
|
45
44
|
layout = Marshal.load(Marshal.dump(layout))
|
|
46
45
|
|
|
47
46
|
assert_equal '/foo/', layout.identifier
|
|
48
47
|
assert_equal 'foobar', layout.raw_content
|
|
49
|
-
assert_equal({ :
|
|
48
|
+
assert_equal({ a: { b: 123 } }, layout.attributes)
|
|
50
49
|
end
|
|
51
|
-
|
|
52
50
|
end
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
class Sample1
|
|
6
|
-
|
|
7
5
|
extend Nanoc::Memoization
|
|
8
6
|
|
|
9
7
|
def initialize(value)
|
|
@@ -11,14 +9,12 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
|
11
9
|
end
|
|
12
10
|
|
|
13
11
|
def run(n)
|
|
14
|
-
@value*10 + n
|
|
12
|
+
@value * 10 + n
|
|
15
13
|
end
|
|
16
14
|
memoize :run
|
|
17
|
-
|
|
18
15
|
end
|
|
19
16
|
|
|
20
17
|
class Sample2
|
|
21
|
-
|
|
22
18
|
extend Nanoc::Memoization
|
|
23
19
|
|
|
24
20
|
def initialize(value)
|
|
@@ -26,14 +22,12 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
|
26
22
|
end
|
|
27
23
|
|
|
28
24
|
def run(n)
|
|
29
|
-
@value*100 + n
|
|
25
|
+
@value * 100 + n
|
|
30
26
|
end
|
|
31
27
|
memoize :run
|
|
32
|
-
|
|
33
28
|
end
|
|
34
29
|
|
|
35
30
|
class EqualSample
|
|
36
|
-
|
|
37
31
|
extend Nanoc::Memoization
|
|
38
32
|
|
|
39
33
|
def initialize(value)
|
|
@@ -44,19 +38,18 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
|
44
38
|
4
|
|
45
39
|
end
|
|
46
40
|
|
|
47
|
-
def eql?(
|
|
41
|
+
def eql?(_other)
|
|
48
42
|
true
|
|
49
43
|
end
|
|
50
44
|
|
|
51
|
-
def ==(
|
|
45
|
+
def ==(_other)
|
|
52
46
|
true
|
|
53
47
|
end
|
|
54
48
|
|
|
55
49
|
def run(n)
|
|
56
|
-
@value*10 + n
|
|
50
|
+
@value * 10 + n
|
|
57
51
|
end
|
|
58
52
|
memoize :run
|
|
59
|
-
|
|
60
53
|
end
|
|
61
54
|
|
|
62
55
|
def test
|
|
@@ -66,10 +59,10 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
|
66
59
|
sample2b = Sample2.new(25)
|
|
67
60
|
|
|
68
61
|
3.times do
|
|
69
|
-
assert_equal 10*10+5, sample1a.run(5)
|
|
70
|
-
assert_equal 10*15+7, sample1b.run(7)
|
|
71
|
-
assert_equal 100*20+5, sample2a.run(5)
|
|
72
|
-
assert_equal 100*25+7, sample2b.run(7)
|
|
62
|
+
assert_equal 10 * 10 + 5, sample1a.run(5)
|
|
63
|
+
assert_equal 10 * 15 + 7, sample1b.run(7)
|
|
64
|
+
assert_equal 100 * 20 + 5, sample2a.run(5)
|
|
65
|
+
assert_equal 100 * 25 + 7, sample2b.run(7)
|
|
73
66
|
end
|
|
74
67
|
end
|
|
75
68
|
|
|
@@ -78,11 +71,10 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
|
78
71
|
sample2 = EqualSample.new(3)
|
|
79
72
|
|
|
80
73
|
3.times do
|
|
81
|
-
assert_equal 2*10+5, sample1.run(5)
|
|
82
|
-
assert_equal 2*10+3, sample1.run(3)
|
|
83
|
-
assert_equal 3*10+5, sample2.run(5)
|
|
84
|
-
assert_equal 3*10+3, sample2.run(3)
|
|
74
|
+
assert_equal 2 * 10 + 5, sample1.run(5)
|
|
75
|
+
assert_equal 2 * 10 + 3, sample1.run(3)
|
|
76
|
+
assert_equal 3 * 10 + 5, sample2.run(5)
|
|
77
|
+
assert_equal 3 * 10 + 3, sample2.run(3)
|
|
85
78
|
end
|
|
86
79
|
end
|
|
87
|
-
|
|
88
80
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::NotificationCenterTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_post
|
|
6
5
|
# Set up notification
|
|
7
6
|
Nanoc::NotificationCenter.on :ping_received, :test do
|
|
@@ -28,5 +27,4 @@ class Nanoc::NotificationCenterTest < Nanoc::TestCase
|
|
|
28
27
|
Nanoc::NotificationCenter.post :ping_received
|
|
29
28
|
assert(!@ping_received)
|
|
30
29
|
end
|
|
31
|
-
|
|
32
30
|
end
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_not_outdated
|
|
6
5
|
# Compile once
|
|
7
|
-
with_site(:
|
|
6
|
+
with_site(name: 'foo') do |site|
|
|
8
7
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
9
8
|
File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
|
|
10
9
|
|
|
@@ -12,7 +11,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
# Check
|
|
15
|
-
with_site(:
|
|
14
|
+
with_site(name: 'foo') do |site|
|
|
16
15
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
17
16
|
rep = site.items[0].reps[0]
|
|
18
17
|
assert_nil outdatedness_checker.outdatedness_reason_for(rep)
|
|
@@ -21,7 +20,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
21
20
|
|
|
22
21
|
def test_outdated_if_item_checksum_nil
|
|
23
22
|
# Compile once
|
|
24
|
-
with_site(:
|
|
23
|
+
with_site(name: 'foo') do |site|
|
|
25
24
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
26
25
|
File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
|
|
27
26
|
|
|
@@ -29,12 +28,12 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
# Delete checksums
|
|
32
|
-
with_site(:
|
|
31
|
+
with_site(name: 'foo') do |_site|
|
|
33
32
|
FileUtils.rm('tmp/checksums')
|
|
34
33
|
end
|
|
35
34
|
|
|
36
35
|
# Check
|
|
37
|
-
with_site(:
|
|
36
|
+
with_site(name: 'foo') do |site|
|
|
38
37
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
39
38
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
|
40
39
|
assert_equal ::Nanoc::OutdatednessReasons::NotEnoughData,
|
|
@@ -44,7 +43,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
44
43
|
|
|
45
44
|
def test_outdated_if_compiled_file_doesnt_exist
|
|
46
45
|
# Compile once
|
|
47
|
-
with_site(:
|
|
46
|
+
with_site(name: 'foo') do |site|
|
|
48
47
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
49
48
|
File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
|
|
50
49
|
|
|
@@ -57,7 +56,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
57
56
|
end
|
|
58
57
|
|
|
59
58
|
# Check
|
|
60
|
-
with_site(:
|
|
59
|
+
with_site(name: 'foo') do |site|
|
|
61
60
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
62
61
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
|
63
62
|
assert_equal ::Nanoc::OutdatednessReasons::NotWritten,
|
|
@@ -67,7 +66,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
67
66
|
|
|
68
67
|
def test_outdated_if_item_checksum_is_different
|
|
69
68
|
# Compile once
|
|
70
|
-
with_site(:
|
|
69
|
+
with_site(name: 'foo') do |site|
|
|
71
70
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
72
71
|
File.open('content/new.html', 'w') { |io| io.write('o hello too') }
|
|
73
72
|
File.open('lib/stuff.rb', 'w') { |io| io.write('$foo = 123') }
|
|
@@ -81,7 +80,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
81
80
|
end
|
|
82
81
|
|
|
83
82
|
# Check
|
|
84
|
-
with_site(:
|
|
83
|
+
with_site(name: 'foo') do |site|
|
|
85
84
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
86
85
|
rep = site.items.find { |i| i.identifier == '/new/' }.reps[0]
|
|
87
86
|
assert_equal ::Nanoc::OutdatednessReasons::SourceModified,
|
|
@@ -91,7 +90,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
91
90
|
|
|
92
91
|
def test_outdated_if_dependent_layout_outdated
|
|
93
92
|
# Compile once
|
|
94
|
-
with_site(:
|
|
93
|
+
with_site(name: 'foo', compilation_rule_content: 'layout "/default/"', has_layout: true) do |site|
|
|
95
94
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
96
95
|
File.open('layouts/default.html', 'w') { |io| io.write('!!! <%= yield %> !!!') }
|
|
97
96
|
|
|
@@ -104,8 +103,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
104
103
|
end
|
|
105
104
|
|
|
106
105
|
# Check
|
|
107
|
-
with_site(:
|
|
108
|
-
# FIXME ugly fugly hack
|
|
106
|
+
with_site(name: 'foo') do |site|
|
|
107
|
+
# FIXME: ugly fugly hack
|
|
109
108
|
site.compiler.load
|
|
110
109
|
|
|
111
110
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
@@ -117,7 +116,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
117
116
|
|
|
118
117
|
def test_outdated_if_dependent_item_outdated
|
|
119
118
|
# Compile once
|
|
120
|
-
with_site(:
|
|
119
|
+
with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
|
|
121
120
|
File.open('content/a.html', 'w') do |io|
|
|
122
121
|
io.write('<%= @items.find { |i| i.identifier == "/b/" }.compiled_content %>')
|
|
123
122
|
end
|
|
@@ -136,8 +135,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
136
135
|
end
|
|
137
136
|
|
|
138
137
|
# Check
|
|
139
|
-
with_site(:
|
|
140
|
-
# FIXME ugly fugly hack
|
|
138
|
+
with_site(name: 'foo') do |site|
|
|
139
|
+
# FIXME: ugly fugly hack
|
|
141
140
|
site.compiler.load
|
|
142
141
|
|
|
143
142
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
@@ -149,7 +148,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
149
148
|
|
|
150
149
|
def test_outdated_if_dependent_item_outdated_chained
|
|
151
150
|
# Compile once
|
|
152
|
-
with_site(:
|
|
151
|
+
with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
|
|
153
152
|
File.open('content/a.html', 'w') do |io|
|
|
154
153
|
io.write('<%= @items.find { |i| i.identifier == "/b/" }.compiled_content %> aaa')
|
|
155
154
|
end
|
|
@@ -171,8 +170,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
171
170
|
end
|
|
172
171
|
|
|
173
172
|
# Check
|
|
174
|
-
with_site(:
|
|
175
|
-
# FIXME ugly fugly hack
|
|
173
|
+
with_site(name: 'foo') do |site|
|
|
174
|
+
# FIXME: ugly fugly hack
|
|
176
175
|
site.compiler.load
|
|
177
176
|
|
|
178
177
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
@@ -184,7 +183,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
184
183
|
|
|
185
184
|
def test_outdated_if_dependent_item_removed
|
|
186
185
|
# Compile once
|
|
187
|
-
with_site(:
|
|
186
|
+
with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
|
|
188
187
|
File.open('content/a.html', 'w') do |io|
|
|
189
188
|
io.write('<% @items.select { |i| i.identifier != @item.identifier }.each do |i| %>')
|
|
190
189
|
io.write(' <%= i.compiled_content %>')
|
|
@@ -203,8 +202,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
203
202
|
end
|
|
204
203
|
|
|
205
204
|
# Check
|
|
206
|
-
with_site(:
|
|
207
|
-
# FIXME ugly fugly hack
|
|
205
|
+
with_site(name: 'foo') do |site|
|
|
206
|
+
# FIXME: ugly fugly hack
|
|
208
207
|
site.compiler.load
|
|
209
208
|
|
|
210
209
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
@@ -216,7 +215,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
216
215
|
|
|
217
216
|
def test_outdated_if_dependent_item_added
|
|
218
217
|
# Compile once
|
|
219
|
-
with_site(:
|
|
218
|
+
with_site(name: 'foo', compilation_rule_content: 'filter :erb') do |site|
|
|
220
219
|
File.open('content/a.html', 'w') do |io|
|
|
221
220
|
io.write('<% @items.select { |i| i.identifier != @item.identifier }.each do |i| %>')
|
|
222
221
|
io.write(' <%= i.compiled_content %>')
|
|
@@ -237,8 +236,8 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
237
236
|
end
|
|
238
237
|
|
|
239
238
|
# Check
|
|
240
|
-
with_site(:
|
|
241
|
-
# FIXME ugly fugly hack
|
|
239
|
+
with_site(name: 'foo') do |site|
|
|
240
|
+
# FIXME: ugly fugly hack
|
|
242
241
|
site.compiler.load
|
|
243
242
|
|
|
244
243
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
@@ -248,11 +247,11 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
248
247
|
end
|
|
249
248
|
end
|
|
250
249
|
|
|
251
|
-
# TODO make sure outdatedness of non-outdated items is correct
|
|
250
|
+
# TODO: make sure outdatedness of non-outdated items is correct
|
|
252
251
|
|
|
253
252
|
def test_outdated_if_code_snippets_outdated
|
|
254
253
|
# Compile once
|
|
255
|
-
with_site(:
|
|
254
|
+
with_site(name: 'foo') do |site|
|
|
256
255
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
257
256
|
|
|
258
257
|
site.compile
|
|
@@ -264,7 +263,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
264
263
|
end
|
|
265
264
|
|
|
266
265
|
# Check
|
|
267
|
-
with_site(:
|
|
266
|
+
with_site(name: 'foo') do |site|
|
|
268
267
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
269
268
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
|
270
269
|
assert_equal ::Nanoc::OutdatednessReasons::CodeSnippetsModified,
|
|
@@ -274,7 +273,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
274
273
|
|
|
275
274
|
def test_outdated_if_config_outdated
|
|
276
275
|
# Compile once
|
|
277
|
-
with_site(:
|
|
276
|
+
with_site(name: 'foo') do |site|
|
|
278
277
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
279
278
|
|
|
280
279
|
site.compile
|
|
@@ -286,7 +285,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
286
285
|
end
|
|
287
286
|
|
|
288
287
|
# Check
|
|
289
|
-
with_site(:
|
|
288
|
+
with_site(name: 'foo') do |site|
|
|
290
289
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
291
290
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
|
292
291
|
assert_equal ::Nanoc::OutdatednessReasons::ConfigurationModified,
|
|
@@ -296,7 +295,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
296
295
|
|
|
297
296
|
def test_not_outdated_if_irrelevant_rule_modified
|
|
298
297
|
# Compile once
|
|
299
|
-
with_site(:
|
|
298
|
+
with_site(name: 'foo') do |site|
|
|
300
299
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
301
300
|
|
|
302
301
|
site.compile
|
|
@@ -308,7 +307,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
308
307
|
end
|
|
309
308
|
|
|
310
309
|
# Check
|
|
311
|
-
with_site(:
|
|
310
|
+
with_site(name: 'foo') do |site|
|
|
312
311
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
|
313
312
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
|
314
313
|
assert_nil outdatedness_checker.outdatedness_reason_for(rep)
|
|
@@ -317,7 +316,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
317
316
|
|
|
318
317
|
def test_outdated_if_relevant_rule_modified
|
|
319
318
|
# Create site
|
|
320
|
-
with_site(:
|
|
319
|
+
with_site(name: 'foo') do |_site|
|
|
321
320
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
322
321
|
File.open('Rules', 'w') do |io|
|
|
323
322
|
io.write("compile '/' do\n")
|
|
@@ -360,7 +359,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
360
359
|
|
|
361
360
|
def test_items_in_rules_should_not_cause_outdatedness
|
|
362
361
|
# Create site
|
|
363
|
-
with_site(:
|
|
362
|
+
with_site(name: 'foo') do |_site|
|
|
364
363
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
365
364
|
File.open('Rules', 'w') do |io|
|
|
366
365
|
io.write("compile '/' do\n")
|
|
@@ -391,7 +390,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
391
390
|
|
|
392
391
|
def test_non_serializable_parameters_in_rules_should_be_allowed
|
|
393
392
|
# Create site
|
|
394
|
-
with_site(:
|
|
393
|
+
with_site(name: 'foo') do |_site|
|
|
395
394
|
File.open('content/index.html', 'w') { |io| io.write('o hello') }
|
|
396
395
|
File.open('Rules', 'w') do |io|
|
|
397
396
|
io.write("compile '/' do\n")
|
|
@@ -421,5 +420,4 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
421
420
|
end
|
|
422
421
|
end
|
|
423
422
|
end
|
|
424
|
-
|
|
425
423
|
end
|
data/test/base/test_plugin.rb
CHANGED
data/test/base/test_rule.rb
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::RuleTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_initialize
|
|
6
|
-
# TODO implement
|
|
5
|
+
# TODO: implement
|
|
7
6
|
end
|
|
8
7
|
|
|
9
8
|
def test_applicable_to
|
|
10
|
-
# TODO implement
|
|
9
|
+
# TODO: implement
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
def test_apply_to
|
|
14
|
-
# TODO implement
|
|
13
|
+
# TODO: implement
|
|
15
14
|
end
|
|
16
|
-
|
|
17
15
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
class Nanoc::RuleContextTest < Nanoc::TestCase
|
|
4
|
-
|
|
5
4
|
def test_objects
|
|
6
5
|
# Mock everything
|
|
7
6
|
config = mock
|
|
@@ -18,7 +17,7 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
|
|
|
18
17
|
compiler = Nanoc::Compiler.new(site)
|
|
19
18
|
|
|
20
19
|
# Create context
|
|
21
|
-
@rule_context = Nanoc::RuleContext.new(:
|
|
20
|
+
@rule_context = Nanoc::RuleContext.new(rep: rep, compiler: compiler)
|
|
22
21
|
|
|
23
22
|
# Check
|
|
24
23
|
assert_equal rep, @rule_context.rep
|
|
@@ -44,7 +43,7 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
|
|
|
44
43
|
# Mock rep
|
|
45
44
|
rep = mock
|
|
46
45
|
rep.stubs(:item).returns(item)
|
|
47
|
-
rep.expects(:filter).with(:foo, { :
|
|
46
|
+
rep.expects(:filter).with(:foo, { bar: 'baz' })
|
|
48
47
|
rep.expects(:layout).with('foo')
|
|
49
48
|
rep.expects(:snapshot).with('awesome')
|
|
50
49
|
|
|
@@ -52,12 +51,11 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
|
|
|
52
51
|
compiler = Nanoc::Compiler.new(site)
|
|
53
52
|
|
|
54
53
|
# Create context
|
|
55
|
-
@rule_context = Nanoc::RuleContext.new(:
|
|
54
|
+
@rule_context = Nanoc::RuleContext.new(rep: rep, compiler: compiler)
|
|
56
55
|
|
|
57
56
|
# Check
|
|
58
|
-
rep.filter :foo, :
|
|
57
|
+
rep.filter :foo, bar: 'baz'
|
|
59
58
|
rep.layout 'foo'
|
|
60
59
|
rep.snapshot 'awesome'
|
|
61
60
|
end
|
|
62
|
-
|
|
63
61
|
end
|