nanoc 3.7.3 → 3.7.4
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.lock +71 -46
- data/NEWS.md +14 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +11 -10
- data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
- data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -1
- data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
- data/lib/nanoc/base/context.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/date.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -1
- data/lib/nanoc/base/directed_graph.rb +3 -3
- data/lib/nanoc/base/memoization.rb +1 -1
- data/lib/nanoc/base/notification_center.rb +1 -1
- data/lib/nanoc/base/ordered_hash.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +3 -3
- data/lib/nanoc/base/result_data/item_rep.rb +13 -11
- data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
- data/lib/nanoc/base/source_data/data_source.rb +3 -3
- data/lib/nanoc/base/source_data/item.rb +8 -8
- data/lib/nanoc/base/source_data/item_array.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +27 -18
- data/lib/nanoc/base/store.rb +3 -3
- data/lib/nanoc/base/temp_filename_factory.rb +2 -2
- data/lib/nanoc/cli.rb +6 -6
- data/lib/nanoc/cli/cleaning_stream.rb +1 -1
- data/lib/nanoc/cli/command_runner.rb +4 -3
- data/lib/nanoc/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc/cli/commands/check.rb +3 -3
- data/lib/nanoc/cli/commands/compile.rb +23 -23
- data/lib/nanoc/cli/commands/create-item.rb +5 -5
- data/lib/nanoc/cli/commands/create-layout.rb +14 -14
- data/lib/nanoc/cli/commands/create-site.rb +6 -6
- data/lib/nanoc/cli/commands/deploy.rb +8 -8
- data/lib/nanoc/cli/commands/nanoc.rb +3 -3
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +4 -4
- data/lib/nanoc/cli/commands/show-data.rb +5 -5
- data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
- data/lib/nanoc/cli/commands/show-rules.rb +4 -4
- data/lib/nanoc/cli/commands/sync.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +13 -13
- data/lib/nanoc/cli/commands/validate-css.rb +3 -3
- data/lib/nanoc/cli/commands/validate-html.rb +3 -3
- data/lib/nanoc/cli/commands/validate-links.rb +6 -6
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/commands/watch.rb +11 -11
- data/lib/nanoc/cli/error_handler.rb +10 -10
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
- data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +16 -16
- data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
- data/lib/nanoc/data_sources/static.rb +1 -1
- data/lib/nanoc/extra/auto_compiler.rb +2 -2
- data/lib/nanoc/extra/checking/check.rb +11 -1
- data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
- data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
- data/lib/nanoc/extra/checking/runner.rb +10 -9
- data/lib/nanoc/extra/chick.rb +2 -2
- data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
- data/lib/nanoc/extra/deployers/fog.rb +2 -2
- data/lib/nanoc/extra/deployers/rsync.rb +3 -3
- data/lib/nanoc/extra/file_proxy.rb +3 -3
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/extra/link_collector.rb +3 -3
- data/lib/nanoc/extra/piper.rb +2 -2
- data/lib/nanoc/extra/pruner.rb +4 -3
- data/lib/nanoc/extra/validators/links.rb +2 -2
- data/lib/nanoc/extra/validators/w3c.rb +1 -1
- data/lib/nanoc/extra/vcs.rb +5 -5
- data/lib/nanoc/extra/vcses/dummy.rb +1 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -1
- data/lib/nanoc/filters/bluecloth.rb +1 -1
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +19 -21
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +1 -1
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rdoc.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +5 -5
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/filters/typogruby.rb +1 -1
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +12 -12
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/helpers/html_escape.rb +6 -6
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/tasks/clean.rb +1 -1
- data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +1 -0
- data/test/base/core_ext/array_spec.rb +7 -7
- data/test/base/core_ext/hash_spec.rb +1 -1
- data/test/base/test_checksum_store.rb +1 -1
- data/test/base/test_compiler.rb +14 -14
- data/test/base/test_compiler_dsl.rb +13 -13
- data/test/base/test_context.rb +2 -2
- data/test/base/test_dependency_tracker.rb +42 -42
- data/test/base/test_directed_graph.rb +102 -102
- data/test/base/test_item.rb +21 -21
- data/test/base/test_item_array.rb +19 -19
- data/test/base/test_item_rep.rb +50 -50
- data/test/base/test_layout.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +2 -2
- data/test/base/test_rule_context.rb +2 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +7 -7
- data/test/cli/commands/test_create_site.rb +2 -2
- data/test/cli/commands/test_deploy.rb +10 -10
- data/test/cli/commands/test_prune.rb +2 -2
- data/test/cli/commands/test_sync.rb +1 -1
- data/test/cli/commands/test_watch.rb +7 -7
- data/test/cli/test_cleaning_stream.rb +4 -4
- data/test/cli/test_cli.rb +3 -3
- data/test/cli/test_error_handler.rb +3 -3
- data/test/data_sources/test_filesystem.rb +19 -19
- data/test/data_sources/test_filesystem_unified.rb +30 -30
- data/test/data_sources/test_filesystem_verbose.rb +3 -3
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +8 -8
- data/test/extra/checking/test_check.rb +11 -1
- data/test/extra/checking/test_dsl.rb +1 -1
- data/test/extra/core_ext/test_enumerable.rb +2 -2
- data/test/extra/deployers/test_fog.rb +10 -10
- data/test/extra/deployers/test_rsync.rb +2 -2
- data/test/extra/test_auto_compiler.rb +28 -28
- data/test/extra/test_filesystem_tools.rb +3 -3
- data/test/extra/test_link_collector.rb +39 -20
- data/test/extra/validators/test_w3c.rb +5 -5
- data/test/filters/test_asciidoc.rb +2 -2
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -13
- data/test/filters/test_erb.rb +1 -1
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +10 -10
- data/test/filters/test_markaby.rb +2 -2
- data/test/filters/test_maruku.rb +2 -2
- data/test/filters/test_pandoc.rb +3 -3
- data/test/filters/test_rainpress.rb +4 -4
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +5 -5
- data/test/filters/test_redcloth.rb +5 -5
- data/test/filters/test_relativize_paths.rb +33 -31
- data/test/filters/test_rubypants.rb +2 -2
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +3 -3
- data/test/filters/test_uglify_js.rb +1 -1
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +14 -16
- data/test/helpers/test_blogging.rb +28 -28
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +7 -7
- data/test/helpers/test_filtering.rb +16 -16
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +1 -1
- data/test/helpers/test_tagging.rb +11 -11
- data/test/helpers/test_xml_sitemap.rb +18 -18
- data/test/tasks/test_clean.rb +8 -8
- metadata +2 -2
|
@@ -384,7 +384,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
384
384
|
site = Nanoc::Site.new('.')
|
|
385
385
|
outdatedness_checker = site.compiler.outdatedness_checker
|
|
386
386
|
site.items.each do |item|
|
|
387
|
-
refute outdatedness_checker.outdated?(item),
|
|
387
|
+
refute outdatedness_checker.outdated?(item), 'item should not be outdated'
|
|
388
388
|
end
|
|
389
389
|
end
|
|
390
390
|
end
|
|
@@ -417,7 +417,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
|
417
417
|
site = Nanoc::Site.new('.')
|
|
418
418
|
outdatedness_checker = site.compiler.outdatedness_checker
|
|
419
419
|
site.items.each do |item|
|
|
420
|
-
refute outdatedness_checker.outdated?(item),
|
|
420
|
+
refute outdatedness_checker.outdated?(item), 'item should not be outdated'
|
|
421
421
|
end
|
|
422
422
|
end
|
|
423
423
|
end
|
|
@@ -55,8 +55,8 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
|
|
|
55
55
|
@rule_context = Nanoc::RuleContext.new(:rep => rep, :compiler => compiler)
|
|
56
56
|
|
|
57
57
|
# Check
|
|
58
|
-
rep.filter
|
|
59
|
-
rep.layout
|
|
58
|
+
rep.filter :foo, :bar => 'baz'
|
|
59
|
+
rep.layout 'foo'
|
|
60
60
|
rep.snapshot 'awesome'
|
|
61
61
|
end
|
|
62
62
|
|
data/test/base/test_site.rb
CHANGED
|
@@ -26,7 +26,7 @@ class Nanoc::SiteTest < Nanoc::TestCase
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def test_initialize_with_incomplete_data_source_config
|
|
29
|
-
site = Nanoc::Site.new(:data_sources => [
|
|
29
|
+
site = Nanoc::Site.new(:data_sources => [{ :type => 'foo', :items_root => '/bar/' }])
|
|
30
30
|
assert_equal('foo', site.config[:data_sources][0][:type])
|
|
31
31
|
assert_equal('/bar/', site.config[:data_sources][0][:items_root])
|
|
32
32
|
assert_equal('/', site.config[:data_sources][0][:layouts_root])
|
|
@@ -146,7 +146,7 @@ EOF
|
|
|
146
146
|
# Update configuration
|
|
147
147
|
File.open('nanoc.yaml', 'w') do |io|
|
|
148
148
|
io.write "data_sources:\n"
|
|
149
|
-
io.write
|
|
149
|
+
io.write ' - type: site_test_foo'
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
# Create site
|
|
@@ -176,9 +176,9 @@ EOF
|
|
|
176
176
|
bar = site.items.find { |i| i.identifier == '/parent/bar/' }
|
|
177
177
|
qux = site.items.find { |i| i.identifier == '/parent/bar/qux/' }
|
|
178
178
|
|
|
179
|
-
assert_equal Set.new([
|
|
180
|
-
assert_equal Set.new([
|
|
181
|
-
assert_equal Set.new([
|
|
179
|
+
assert_equal Set.new([parent, style]), Set.new(root.children)
|
|
180
|
+
assert_equal Set.new([foo, bar]), Set.new(parent.children)
|
|
181
|
+
assert_equal Set.new([qux]), Set.new(bar.children)
|
|
182
182
|
|
|
183
183
|
assert_equal nil, root.parent
|
|
184
184
|
assert_equal root, parent.parent
|
|
@@ -118,16 +118,16 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
|
|
|
118
118
|
def test_setup_and_teardown_listeners
|
|
119
119
|
with_site do
|
|
120
120
|
test_listener_class = Class.new(::Nanoc::CLI::Commands::Compile::Listener) do
|
|
121
|
-
def start
|
|
122
|
-
def stop
|
|
123
|
-
def started
|
|
124
|
-
def stopped
|
|
121
|
+
def start; @started = true; end
|
|
122
|
+
def stop; @stopped = true; end
|
|
123
|
+
def started?; @started; end
|
|
124
|
+
def stopped?; @stopped; end
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
options = {}
|
|
128
128
|
arguments = []
|
|
129
129
|
cmd = nil
|
|
130
|
-
listener_classes = [
|
|
130
|
+
listener_classes = [test_listener_class]
|
|
131
131
|
cmd_runner = Nanoc::CLI::Commands::Compile.new(
|
|
132
132
|
options, arguments, cmd, :listener_classes => listener_classes)
|
|
133
133
|
|
|
@@ -148,7 +148,7 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
|
|
|
148
148
|
rep.compiled = true
|
|
149
149
|
|
|
150
150
|
# Listen
|
|
151
|
-
listener = new_file_action_printer([
|
|
151
|
+
listener = new_file_action_printer([rep])
|
|
152
152
|
listener.start
|
|
153
153
|
Nanoc::NotificationCenter.post(:compilation_started, rep)
|
|
154
154
|
Nanoc::NotificationCenter.post(:rep_written, rep, rep.raw_path, false, true)
|
|
@@ -169,7 +169,7 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
|
|
|
169
169
|
rep.raw_path = 'output/foo.txt'
|
|
170
170
|
|
|
171
171
|
# Listen
|
|
172
|
-
listener = new_file_action_printer([
|
|
172
|
+
listener = new_file_action_printer([rep])
|
|
173
173
|
listener.start
|
|
174
174
|
Nanoc::NotificationCenter.post(:compilation_started, rep)
|
|
175
175
|
listener.stop
|
|
@@ -20,7 +20,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def test_default_encoding
|
|
23
|
-
|
|
23
|
+
unless defined?(Encoding)
|
|
24
24
|
skip 'No Encoding class'
|
|
25
25
|
return
|
|
26
26
|
end
|
|
@@ -38,7 +38,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
|
|
|
38
38
|
exception = assert_raises(RuntimeError) do
|
|
39
39
|
site.compile
|
|
40
40
|
end
|
|
41
|
-
assert_equal
|
|
41
|
+
assert_equal 'Could not read content/index.html because the file is not valid UTF-8.', exception.message
|
|
42
42
|
|
|
43
43
|
# Try with encoding = specific
|
|
44
44
|
File.open('nanoc.yaml', 'w') { |io| io.write("meh: true\n") }
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
|
|
4
4
|
|
|
5
5
|
def test_deploy
|
|
6
|
-
skip_unless_have_command
|
|
6
|
+
skip_unless_have_command 'rsync'
|
|
7
7
|
with_site do |site|
|
|
8
8
|
File.open('nanoc.yaml', 'w') do |io|
|
|
9
9
|
io.write "deploy:\n"
|
|
10
10
|
io.write " public:\n"
|
|
11
11
|
io.write " kind: rsync\n"
|
|
12
|
-
io.write
|
|
12
|
+
io.write ' dst: mydestination'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
FileUtils.mkdir_p('output')
|
|
@@ -28,7 +28,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
|
|
|
28
28
|
io.write "deploy:\n"
|
|
29
29
|
io.write " public:\n"
|
|
30
30
|
io.write " kind: rsync\n"
|
|
31
|
-
io.write
|
|
31
|
+
io.write ' dst: mydestination'
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
FileUtils.mkdir_p('output')
|
|
@@ -63,7 +63,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
|
|
|
63
63
|
io.write "deploy:\n"
|
|
64
64
|
io.write " public:\n"
|
|
65
65
|
io.write " kind: rsync\n"
|
|
66
|
-
io.write
|
|
66
|
+
io.write ' dst: mydestination'
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
FileUtils.mkdir_p('output')
|
|
@@ -86,7 +86,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
|
|
|
86
86
|
io.write "deploy:\n"
|
|
87
87
|
io.write " public:\n"
|
|
88
88
|
io.write " kind: rsync\n"
|
|
89
|
-
io.write
|
|
89
|
+
io.write ' dst: mydestination'
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
FileUtils.mkdir_p('output')
|
|
@@ -104,12 +104,12 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
|
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def test_deploy_without_kind
|
|
107
|
-
skip_unless_have_command
|
|
107
|
+
skip_unless_have_command 'rsync'
|
|
108
108
|
with_site do |site|
|
|
109
109
|
File.open('nanoc.yaml', 'w') do |io|
|
|
110
110
|
io.write "deploy:\n"
|
|
111
111
|
io.write " public:\n"
|
|
112
|
-
io.write
|
|
112
|
+
io.write ' dst: mydestination'
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
FileUtils.mkdir_p('output')
|
|
@@ -131,7 +131,7 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
|
|
|
131
131
|
File.open('nanoc.yaml', 'w') do |io|
|
|
132
132
|
io.write "deploy:\n"
|
|
133
133
|
io.write " public:\n"
|
|
134
|
-
io.write
|
|
134
|
+
io.write ' dst: mydestination'
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
FileUtils.mkdir_p('output')
|
|
@@ -147,12 +147,12 @@ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
|
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def test_deploy_without_target_with_default
|
|
150
|
-
skip_unless_have_command
|
|
150
|
+
skip_unless_have_command 'rsync'
|
|
151
151
|
with_site do |site|
|
|
152
152
|
File.open('nanoc.yaml', 'w') do |io|
|
|
153
153
|
io.write "deploy:\n"
|
|
154
154
|
io.write " default:\n"
|
|
155
|
-
io.write
|
|
155
|
+
io.write ' dst: mydestination'
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
FileUtils.mkdir_p('output')
|
|
@@ -93,9 +93,9 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
|
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def test_run_with_symlink_to_output_dir
|
|
96
|
-
|
|
96
|
+
skip_unless_symlinks_supported
|
|
97
97
|
if defined?(JRUBY_VERSION) && JRUBY_VERSION == '1.7.11'
|
|
98
|
-
skip
|
|
98
|
+
skip 'JRuby 1.7.11 has buggy File.find behavior (see https://github.com/jruby/jruby/issues/1647)'
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
with_site do |site|
|
|
@@ -16,7 +16,7 @@ class Nanoc::CLI::Commands::SyncTest < Nanoc::TestCase
|
|
|
16
16
|
File.open('nanoc.yaml', 'w') do |io|
|
|
17
17
|
io.write "data_sources:\n"
|
|
18
18
|
io.write " - type: sync_test_foo\n"
|
|
19
|
-
io.write
|
|
19
|
+
io.write ' items_root: /'
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
Nanoc::CLI.run %w( sync )
|
|
@@ -9,10 +9,10 @@ class Nanoc::CLI::Commands::WatchTest < Nanoc::TestCase
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
File.open('content/index.html', 'w') { |io| io.write('Hello there!') }
|
|
12
|
-
|
|
12
|
+
wait_until_content_equals('content/index.html', 'Hello there!')
|
|
13
13
|
|
|
14
14
|
File.open('content/index.html', 'w') { |io| io.write('Hello there again!') }
|
|
15
|
-
|
|
15
|
+
wait_until_content_equals('content/index.html', 'Hello there again!')
|
|
16
16
|
|
|
17
17
|
watch_thread.kill
|
|
18
18
|
end
|
|
@@ -25,7 +25,7 @@ class Nanoc::CLI::Commands::WatchTest < Nanoc::TestCase
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
File.open('content/index.html', 'w') { |io| io.write('Hello there!') }
|
|
28
|
-
|
|
28
|
+
wait_until_exists('output/index.html')
|
|
29
29
|
assert_equal 'Hello there!', File.read('output/index.html')
|
|
30
30
|
|
|
31
31
|
watch_thread.kill
|
|
@@ -35,13 +35,13 @@ class Nanoc::CLI::Commands::WatchTest < Nanoc::TestCase
|
|
|
35
35
|
def test_growlnotify_cmd
|
|
36
36
|
Nanoc::CLI.setup
|
|
37
37
|
notifier = Nanoc::CLI::Commands::Watch::Notifier.new
|
|
38
|
-
assert_equal [
|
|
38
|
+
assert_equal ['growlnotify', '-m', 'foo'], notifier.send(:growlnotify_cmd_for, 'foo')
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def test_growlnotify_windows_cmd
|
|
42
42
|
Nanoc::CLI.setup
|
|
43
43
|
notifier = Nanoc::CLI::Commands::Watch::Notifier.new
|
|
44
|
-
assert_equal [
|
|
44
|
+
assert_equal ['growlnotify', '/t:nanoc', 'foo'], notifier.send(:growlnotify_windows_cmd_for, 'foo')
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def wait_until_exists(filename)
|
|
@@ -49,13 +49,13 @@ class Nanoc::CLI::Commands::WatchTest < Nanoc::TestCase
|
|
|
49
49
|
break if File.file?(filename)
|
|
50
50
|
sleep 0.5
|
|
51
51
|
end
|
|
52
|
-
|
|
52
|
+
unless File.file?(filename)
|
|
53
53
|
raise RuntimeError, "Expected #{filename} to appear but it didn't :("
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def wait_until_content_equals(filename, expected_content)
|
|
58
|
-
|
|
58
|
+
wait_until_exists(filename)
|
|
59
59
|
|
|
60
60
|
20.times do
|
|
61
61
|
break if File.read(filename) == expected_content
|
|
@@ -17,7 +17,7 @@ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def test_forward
|
|
20
|
-
methods = [
|
|
20
|
+
methods = [:write, :<<, :tty?, :flush, :tell, :print, :puts, :string, :reopen, :exist?, :exists?, :close]
|
|
21
21
|
|
|
22
22
|
s = Stream.new
|
|
23
23
|
cs = Nanoc::CLI::CleaningStream.new(s)
|
|
@@ -45,13 +45,13 @@ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
|
|
|
45
45
|
stream = StringIO.new
|
|
46
46
|
cleaning_stream = Nanoc::CLI::CleaningStream.new(stream)
|
|
47
47
|
logger = Logger.new(cleaning_stream)
|
|
48
|
-
logger.info(
|
|
49
|
-
logger.warn(
|
|
48
|
+
logger.info('Some info')
|
|
49
|
+
logger.warn('Something could start going wrong!')
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def test_broken_pipe
|
|
53
53
|
stream = StringIO.new
|
|
54
|
-
def stream.write(s)
|
|
54
|
+
def stream.write(s); raise Errno::EPIPE.new; end
|
|
55
55
|
|
|
56
56
|
cleaning_stream = Nanoc::CLI::CleaningStream.new(stream)
|
|
57
57
|
cleaning_stream.write('lol')
|
data/test/cli/test_cli.rb
CHANGED
|
@@ -119,18 +119,18 @@ EOS
|
|
|
119
119
|
}
|
|
120
120
|
with_env_vars(new_env_diff) do
|
|
121
121
|
io = StringIO.new
|
|
122
|
-
def io.tty
|
|
122
|
+
def io.tty?; true; end
|
|
123
123
|
refute Nanoc::CLI.enable_utf8?(io)
|
|
124
124
|
|
|
125
125
|
io = StringIO.new
|
|
126
|
-
def io.tty
|
|
126
|
+
def io.tty?; false; end
|
|
127
127
|
assert Nanoc::CLI.enable_utf8?(io)
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
|
|
131
131
|
def test_enable_utf8
|
|
132
132
|
io = StringIO.new
|
|
133
|
-
def io.tty
|
|
133
|
+
def io.tty?; true; end
|
|
134
134
|
|
|
135
135
|
new_env_diff = {
|
|
136
136
|
'LC_ALL' => 'en_US.ISO-8859-1',
|
|
@@ -13,13 +13,13 @@ class Nanoc::CLI::ErrorHandlerTest < Nanoc::TestCase
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def test_resolution_for_with_known_gem_without_bundler
|
|
16
|
-
def @handler.using_bundler
|
|
16
|
+
def @handler.using_bundler?; false; end
|
|
17
17
|
error = LoadError.new('no such file to load -- kramdown')
|
|
18
18
|
assert_match(/^Install the 'kramdown' gem using `gem install kramdown`./, @handler.send(:resolution_for, error))
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def test_resolution_for_with_known_gem_with_bundler
|
|
22
|
-
def @handler.using_bundler
|
|
22
|
+
def @handler.using_bundler?; true; end
|
|
23
23
|
error = LoadError.new('no such file to load -- kramdown')
|
|
24
24
|
assert_match(/^Make sure the gem is added to Gemfile/, @handler.send(:resolution_for, error))
|
|
25
25
|
end
|
|
@@ -48,7 +48,7 @@ class Nanoc::CLI::ErrorHandlerTest < Nanoc::TestCase
|
|
|
48
48
|
def new_error(amount_factor)
|
|
49
49
|
backtrace_generator = lambda do |af|
|
|
50
50
|
if af == 0
|
|
51
|
-
raise
|
|
51
|
+
raise 'finally!'
|
|
52
52
|
else
|
|
53
53
|
backtrace_generator.call(af - 1)
|
|
54
54
|
end
|
|
@@ -86,9 +86,9 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
86
86
|
|
|
87
87
|
# Get all files
|
|
88
88
|
output_expected = {
|
|
89
|
-
'./foo' => [
|
|
90
|
-
'./bar.entry' => [
|
|
91
|
-
'./foo/qux' => [
|
|
89
|
+
'./foo' => ['yaml', 'html'],
|
|
90
|
+
'./bar.entry' => [nil, 'html'],
|
|
91
|
+
'./foo/qux' => ['yaml', nil]
|
|
92
92
|
}
|
|
93
93
|
output_actual = data_source.send :all_split_files_in, '.'
|
|
94
94
|
|
|
@@ -113,9 +113,9 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
113
113
|
|
|
114
114
|
# Get all files
|
|
115
115
|
output_expected = {
|
|
116
|
-
'./foo' => [
|
|
117
|
-
'./bar' => [
|
|
118
|
-
'./foo/qux' => [
|
|
116
|
+
'./foo' => ['yaml', 'html'],
|
|
117
|
+
'./bar' => [nil, 'html.erb'],
|
|
118
|
+
'./foo/qux' => ['yaml', nil]
|
|
119
119
|
}
|
|
120
120
|
output_actual = data_source.send :all_split_files_in, '.'
|
|
121
121
|
|
|
@@ -135,9 +135,9 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
135
135
|
|
|
136
136
|
# Check
|
|
137
137
|
expected = {
|
|
138
|
-
'./aaa/foo' => [
|
|
139
|
-
'./bbb/foo' => [
|
|
140
|
-
'./ccc/foo' => [
|
|
138
|
+
'./aaa/foo' => [nil, 'html'],
|
|
139
|
+
'./bbb/foo' => [nil, 'html'],
|
|
140
|
+
'./ccc/foo' => [nil, 'html']
|
|
141
141
|
}
|
|
142
142
|
assert_equal expected, data_source.send(:all_split_files_in, '.')
|
|
143
143
|
end
|
|
@@ -291,7 +291,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
291
291
|
# Parse it
|
|
292
292
|
result = data_source.instance_eval { parse('test.html', nil, 'foobar') }
|
|
293
293
|
assert_equal({ 'foo' => 'bar' }, result[0])
|
|
294
|
-
assert_equal(
|
|
294
|
+
assert_equal('', result[1])
|
|
295
295
|
end
|
|
296
296
|
|
|
297
297
|
def test_parse_embedded_meta_only_2
|
|
@@ -308,7 +308,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
308
308
|
# Parse it
|
|
309
309
|
result = data_source.instance_eval { parse('test.html', nil, 'foobar') }
|
|
310
310
|
assert_equal({ 'foo' => 'bar' }, result[0])
|
|
311
|
-
assert_equal(
|
|
311
|
+
assert_equal('', result[1])
|
|
312
312
|
end
|
|
313
313
|
|
|
314
314
|
def test_parse_embedded_meta_only_3
|
|
@@ -316,7 +316,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
316
316
|
File.open('test.html', 'w') do |io|
|
|
317
317
|
io.write "-----\r\n"
|
|
318
318
|
io.write "foo: bar\n"
|
|
319
|
-
io.write
|
|
319
|
+
io.write '-----'
|
|
320
320
|
end
|
|
321
321
|
|
|
322
322
|
# Create data source
|
|
@@ -325,7 +325,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
325
325
|
# Parse it
|
|
326
326
|
result = data_source.instance_eval { parse('test.html', nil, 'foobar') }
|
|
327
327
|
assert_equal({ 'foo' => 'bar' }, result[0])
|
|
328
|
-
assert_equal(
|
|
328
|
+
assert_equal('', result[1])
|
|
329
329
|
end
|
|
330
330
|
|
|
331
331
|
def test_parse_embedded_invalid_2
|
|
@@ -403,7 +403,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
403
403
|
io.write "-----\n"
|
|
404
404
|
io.write "-----\n"
|
|
405
405
|
io.write "\nblah blah\n"
|
|
406
|
-
io.write
|
|
406
|
+
io.write '-----'
|
|
407
407
|
end
|
|
408
408
|
|
|
409
409
|
# Create data source
|
|
@@ -417,7 +417,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
417
417
|
|
|
418
418
|
def test_parse_utf8_bom
|
|
419
419
|
File.open('test.html', 'w') do |io|
|
|
420
|
-
io.write [
|
|
420
|
+
io.write [0xEF, 0xBB, 0xBF].map { |i| i.chr }.join
|
|
421
421
|
io.write "-----\n"
|
|
422
422
|
io.write "utf8bomawareness: high\n"
|
|
423
423
|
io.write "-----\n"
|
|
@@ -468,16 +468,16 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
|
468
468
|
|
|
469
469
|
def test_parse_external
|
|
470
470
|
# Create a file
|
|
471
|
-
File.open('test.html', 'w') { |io| io.write(
|
|
472
|
-
File.open('test.yaml', 'w') { |io| io.write(
|
|
471
|
+
File.open('test.html', 'w') { |io| io.write('blah blah') }
|
|
472
|
+
File.open('test.yaml', 'w') { |io| io.write('foo: bar') }
|
|
473
473
|
|
|
474
474
|
# Create data source
|
|
475
475
|
data_source = Nanoc::DataSources::FilesystemCombined.new(nil, nil, nil, nil)
|
|
476
476
|
|
|
477
477
|
# Parse it
|
|
478
478
|
result = data_source.instance_eval { parse('test.html', 'test.yaml', 'foobar') }
|
|
479
|
-
assert_equal({
|
|
480
|
-
assert_equal(
|
|
479
|
+
assert_equal({ 'foo' => 'bar'}, result[0])
|
|
480
|
+
assert_equal('blah blah', result[1])
|
|
481
481
|
end
|
|
482
482
|
|
|
483
483
|
end
|