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::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def new_data_source(params = nil)
|
6
5
|
# Mock site
|
7
6
|
site = Nanoc::Site.new({})
|
@@ -42,22 +41,22 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
42
41
|
|
43
42
|
# Check items
|
44
43
|
assert_equal(2, items.size)
|
45
|
-
assert(items.any?
|
44
|
+
assert(items.any? do |a|
|
46
45
|
a[:title] == 'Foo' &&
|
47
46
|
a[:extension] == 'html' &&
|
48
47
|
a[:content_filename] == 'content/foo/foo.html' &&
|
49
48
|
a[:meta_filename] == 'content/foo/foo.yaml'
|
50
|
-
|
51
|
-
assert(items.any?
|
49
|
+
end)
|
50
|
+
assert(items.any? do |a|
|
52
51
|
a[:title] == 'Bar' &&
|
53
52
|
a[:extension] == 'xml' &&
|
54
53
|
a[:content_filename] == 'content/bar/bar.xml' &&
|
55
54
|
a[:meta_filename] == 'content/bar/bar.yaml'
|
56
|
-
|
55
|
+
end)
|
57
56
|
end
|
58
57
|
|
59
58
|
def test_items_with_period_in_name
|
60
|
-
data_source = new_data_source(:
|
59
|
+
data_source = new_data_source(allow_periods_in_identifiers: true)
|
61
60
|
|
62
61
|
# Create foo.css
|
63
62
|
FileUtils.mkdir_p('content/foo')
|
@@ -67,7 +66,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
67
66
|
File.open('content/foo/foo.css', 'w') do |io|
|
68
67
|
io.write('body.foo {}')
|
69
68
|
end
|
70
|
-
|
69
|
+
|
71
70
|
# Create foo.bar.css
|
72
71
|
FileUtils.mkdir_p('content/foo.bar')
|
73
72
|
File.open('content/foo.bar/foo.bar.yaml', 'w') do |io|
|
@@ -76,10 +75,10 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
76
75
|
File.open('content/foo.bar/foo.bar.css', 'w') do |io|
|
77
76
|
io.write('body.foobar {}')
|
78
77
|
end
|
79
|
-
|
78
|
+
|
80
79
|
# Load
|
81
80
|
items = data_source.items.sort_by { |i| i[:title] }
|
82
|
-
|
81
|
+
|
83
82
|
# Check
|
84
83
|
assert_equal 2, items.size
|
85
84
|
assert_equal '/foo/', items[0].identifier
|
@@ -114,18 +113,18 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
114
113
|
|
115
114
|
# Check items
|
116
115
|
assert_equal(2, items.size)
|
117
|
-
assert(items.any?
|
118
|
-
a[:title]
|
119
|
-
a[:extension]
|
116
|
+
assert(items.any? do |a|
|
117
|
+
a[:title].nil? &&
|
118
|
+
a[:extension] == 'html' &&
|
120
119
|
a[:content_filename] == 'content/foo/foo.html' &&
|
121
|
-
a[:meta_filename]
|
122
|
-
|
123
|
-
assert(items.any?
|
124
|
-
a[:title]
|
125
|
-
a[:extension]
|
126
|
-
a[:content_filename]
|
127
|
-
a[:meta_filename]
|
128
|
-
|
120
|
+
a[:meta_filename].nil?
|
121
|
+
end)
|
122
|
+
assert(items.any? do |a|
|
123
|
+
a[:title] == 'Bar' &&
|
124
|
+
a[:extension].nil? &&
|
125
|
+
a[:content_filename].nil? &&
|
126
|
+
a[:meta_filename] == 'content/bar/bar.yaml'
|
127
|
+
end)
|
129
128
|
end
|
130
129
|
|
131
130
|
def test_layouts
|
@@ -164,7 +163,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
164
163
|
File.open('layouts/foo/foo.html', 'w') do |io|
|
165
164
|
io.write('body.foo {}')
|
166
165
|
end
|
167
|
-
|
166
|
+
|
168
167
|
# Create bar.html.erb
|
169
168
|
FileUtils.mkdir_p('layouts/bar')
|
170
169
|
File.open('layouts/bar/bar.yaml', 'w') do |io|
|
@@ -173,10 +172,10 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
173
172
|
File.open('layouts/bar/bar.html.erb', 'w') do |io|
|
174
173
|
io.write('body.foobar {}')
|
175
174
|
end
|
176
|
-
|
175
|
+
|
177
176
|
# Load
|
178
|
-
layouts = data_source.layouts.sort_by
|
179
|
-
|
177
|
+
layouts = data_source.layouts.sort_by(&:identifier)
|
178
|
+
|
180
179
|
# Check
|
181
180
|
assert_equal 2, layouts.size
|
182
181
|
assert_equal '/bar/', layouts[0].identifier
|
@@ -186,7 +185,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
186
185
|
end
|
187
186
|
|
188
187
|
def test_layouts_with_period_in_name_allowing_periods_in_identifiers
|
189
|
-
data_source = new_data_source(:
|
188
|
+
data_source = new_data_source(allow_periods_in_identifiers: true)
|
190
189
|
|
191
190
|
# Create foo.html
|
192
191
|
FileUtils.mkdir_p('layouts/foo')
|
@@ -196,7 +195,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
196
195
|
File.open('layouts/foo/foo.html', 'w') do |io|
|
197
196
|
io.write('body.foo {}')
|
198
197
|
end
|
199
|
-
|
198
|
+
|
200
199
|
# Create bar.html.erb
|
201
200
|
FileUtils.mkdir_p('layouts/bar.xyz')
|
202
201
|
File.open('layouts/bar.xyz/bar.xyz.yaml', 'w') do |io|
|
@@ -205,10 +204,10 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
205
204
|
File.open('layouts/bar.xyz/bar.xyz.html', 'w') do |io|
|
206
205
|
io.write('body.foobar {}')
|
207
206
|
end
|
208
|
-
|
207
|
+
|
209
208
|
# Load
|
210
|
-
layouts = data_source.layouts.sort_by
|
211
|
-
|
209
|
+
layouts = data_source.layouts.sort_by(&:identifier)
|
210
|
+
|
212
211
|
# Check
|
213
212
|
assert_equal 2, layouts.size
|
214
213
|
assert_equal '/bar.xyz/', layouts[0].identifier
|
@@ -220,7 +219,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
220
219
|
def test_create_item_at_root
|
221
220
|
# Create item
|
222
221
|
data_source = new_data_source
|
223
|
-
data_source.create_item('content here', { :
|
222
|
+
data_source.create_item('content here', { foo: 'bar' }, '/')
|
224
223
|
|
225
224
|
# Check file existance
|
226
225
|
assert File.directory?('content')
|
@@ -235,7 +234,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
235
234
|
def test_create_item_not_at_root
|
236
235
|
# Create item
|
237
236
|
data_source = new_data_source
|
238
|
-
data_source.create_item('content here', { :
|
237
|
+
data_source.create_item('content here', { foo: 'bar' }, '/moo/')
|
239
238
|
|
240
239
|
# Check file existance
|
241
240
|
assert File.directory?('content/moo')
|
@@ -250,7 +249,7 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
250
249
|
def test_create_layout
|
251
250
|
# Create layout
|
252
251
|
data_source = new_data_source
|
253
|
-
data_source.create_layout('content here', { :
|
252
|
+
data_source.create_layout('content here', { foo: 'bar' }, '/moo/')
|
254
253
|
|
255
254
|
# Check file existance
|
256
255
|
assert File.directory?('layouts/moo')
|
@@ -351,5 +350,4 @@ class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
|
351
350
|
data_source.items
|
352
351
|
end
|
353
352
|
end
|
354
|
-
|
355
353
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::DataSources::StaticTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def new_data_source(params = nil)
|
6
5
|
# Mock site
|
7
6
|
site = Nanoc::Site.new({})
|
@@ -17,7 +16,7 @@ class Nanoc::DataSources::StaticTest < Nanoc::TestCase
|
|
17
16
|
skip_unless_symlinks_supported
|
18
17
|
|
19
18
|
# Create data source
|
20
|
-
data_source = new_data_source(:
|
19
|
+
data_source = new_data_source(prefix: 'foo')
|
21
20
|
|
22
21
|
# Create sample files
|
23
22
|
FileUtils.mkdir_p('foo')
|
@@ -33,19 +32,19 @@ class Nanoc::DataSources::StaticTest < Nanoc::TestCase
|
|
33
32
|
|
34
33
|
# Check all files
|
35
34
|
expected_filenames = ['foo/a.png', 'foo/1/b.png', 'foo/c.png'].sort
|
36
|
-
actual_filenames = Nanoc::Extra::FilesystemTools.all_files_in('foo').sort
|
35
|
+
actual_filenames = Nanoc::Extra::FilesystemTools.all_files_in('foo', nil).sort
|
37
36
|
assert_equal expected_filenames, actual_filenames
|
38
37
|
|
39
38
|
# Check items
|
40
|
-
items = data_source.send(:items).sort_by
|
41
|
-
actual_item_identifiers = items.map
|
39
|
+
items = data_source.send(:items).sort_by(&:identifier)
|
40
|
+
actual_item_identifiers = items.map(&:identifier).sort
|
42
41
|
expected_item_identifiers = %w( /a.png/ /1/b.png/ /c.png/ ).sort
|
43
42
|
assert_equal expected_item_identifiers, actual_item_identifiers
|
44
43
|
end
|
45
44
|
|
46
45
|
def test_items
|
47
46
|
# Create data source
|
48
|
-
data_source = new_data_source(:
|
47
|
+
data_source = new_data_source(prefix: 'foo')
|
49
48
|
|
50
49
|
# Create sample files
|
51
50
|
FileUtils.mkdir_p('foo')
|
@@ -58,33 +57,33 @@ class Nanoc::DataSources::StaticTest < Nanoc::TestCase
|
|
58
57
|
expected_out = [
|
59
58
|
Nanoc::Item.new(
|
60
59
|
'foo/bar.png',
|
61
|
-
{ :
|
60
|
+
{ extension: 'png', filename: 'foo/bar.png' },
|
62
61
|
'/bar.png/',
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
62
|
+
binary: true,
|
63
|
+
mtime: File.mtime('foo/bar.png'),
|
64
|
+
checksum: Pathname.new('foo/bar.png').checksum
|
66
65
|
),
|
67
66
|
Nanoc::Item.new(
|
68
67
|
'foo/b.c.css',
|
69
|
-
{ :
|
68
|
+
{ extension: 'css', filename: 'foo/b.c.css' },
|
70
69
|
'/b.c.css/',
|
71
|
-
:
|
72
|
-
:
|
73
|
-
:
|
70
|
+
binary: true,
|
71
|
+
mtime: File.mtime('foo/b.c.css'),
|
72
|
+
checksum: Pathname.new('foo/b.c.css').checksum
|
74
73
|
),
|
75
74
|
Nanoc::Item.new(
|
76
75
|
'foo/a/b/c.gif',
|
77
|
-
{ :
|
76
|
+
{ extension: 'gif', filename: 'foo/a/b/c.gif' },
|
78
77
|
'/a/b/c.gif/',
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
78
|
+
binary: true,
|
79
|
+
mtime: File.mtime('foo/a/b/c.gif'),
|
80
|
+
checksum: Pathname.new('foo/a/b/c.gif').checksum
|
82
81
|
)
|
83
|
-
].sort_by
|
82
|
+
].sort_by(&:identifier)
|
84
83
|
|
85
|
-
actual_out = data_source.send(:items).sort_by
|
84
|
+
actual_out = data_source.send(:items).sort_by(&:identifier)
|
86
85
|
|
87
|
-
(0..expected_out.size-1).each do |i|
|
86
|
+
(0..expected_out.size - 1).each do |i|
|
88
87
|
assert_equal expected_out[i].raw_content, actual_out[i].raw_content, 'content must match'
|
89
88
|
assert_equal expected_out[i].identifier, actual_out[i].identifier, 'identifier must match'
|
90
89
|
assert_equal expected_out[i].mtime, actual_out[i].mtime, 'mtime must match'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_run_ok
|
6
5
|
VCR.use_cassette('css_run_ok') do
|
7
6
|
with_site do |site|
|
@@ -34,9 +33,31 @@ class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
|
|
34
33
|
|
35
34
|
# Check
|
36
35
|
refute check.issues.empty?
|
36
|
+
assert_equal 1, check.issues.size
|
37
|
+
assert_equal 'line 1: Property coxlor doesn\'t exist: h1 { coxlor: rxed; }',
|
38
|
+
check.issues.to_a[0].description
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
|
-
|
43
|
+
def test_run_parse_error
|
44
|
+
VCR.use_cassette('css_run_parse_error') do
|
45
|
+
with_site do |site|
|
46
|
+
# Create files
|
47
|
+
FileUtils.mkdir_p('output')
|
48
|
+
File.open('output/blah.html', 'w') { |io| io.write('<h1>Hi!</h1>') }
|
49
|
+
File.open('output/style.css', 'w') { |io| io.write('h1 { ; {') }
|
50
|
+
|
51
|
+
# Run check
|
52
|
+
check = Nanoc::Extra::Checking::Checks::CSS.new(site)
|
53
|
+
check.run
|
42
54
|
|
55
|
+
# Check
|
56
|
+
refute check.issues.empty?
|
57
|
+
assert_equal 1, check.issues.size
|
58
|
+
assert_equal 'line 1: Parse Error: h1 { ; {',
|
59
|
+
check.issues.to_a[0].description
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_run
|
6
5
|
with_site do |site|
|
7
6
|
# Create files
|
@@ -52,13 +51,13 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
|
52
51
|
|
53
52
|
def test_fallback_to_get_when_head_is_not_allowed
|
54
53
|
with_site do |site|
|
55
|
-
#Create check
|
54
|
+
# Create check
|
56
55
|
check = Nanoc::Extra::Checking::Checks::ExternalLinks.new(site)
|
57
56
|
def check.request_url_once(url, req_method = Net::HTTP::Head)
|
58
57
|
Net::HTTPResponse.new('1.1', (req_method == Net::HTTP::Head || url.path == '/405') ? '405' : '200', 'okay')
|
59
58
|
end
|
60
59
|
|
61
|
-
#Test
|
60
|
+
# Test
|
62
61
|
assert_nil check.validate('http://127.0.0.1:9204')
|
63
62
|
refute_nil check.validate('http://127.0.0.1:9204/405')
|
64
63
|
end
|
@@ -75,5 +74,4 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
|
75
74
|
assert_equal '/meow?foo=bar', check.send(:path_for_url, URI.parse('http://example.com/meow?foo=bar'))
|
76
75
|
end
|
77
76
|
end
|
78
|
-
|
79
77
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::Extra::Checking::Checks::HTMLTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_run_ok
|
6
5
|
VCR.use_cassette('html_run_ok') do
|
7
6
|
with_site do |site|
|
@@ -34,9 +33,11 @@ class Nanoc::Extra::Checking::Checks::HTMLTest < Nanoc::TestCase
|
|
34
33
|
|
35
34
|
# Check
|
36
35
|
refute check.issues.empty?
|
36
|
+
assert_equal 2, check.issues.size
|
37
|
+
assert_equal 'line 1: no document type declaration; will parse without validation: <h2>Hi!</h1>', check.issues.to_a[0].description
|
38
|
+
assert_equal 'line 1: end tag for element "H1" which is not open: <h2>Hi!</h1>', check.issues.to_a[1].description
|
39
|
+
check.issues.to_a[0].description
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
40
|
-
|
41
43
|
end
|
42
|
-
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_run
|
6
5
|
with_site do |site|
|
7
6
|
# Create files
|
@@ -57,7 +56,7 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
57
56
|
with_site do |site|
|
58
57
|
# Create check
|
59
58
|
check = Nanoc::Extra::Checking::Checks::InternalLinks.new(site)
|
60
|
-
site.config.update({ :
|
59
|
+
site.config.update({ checks: { internal_links: { exclude: ['^/excluded\d+'] } } })
|
61
60
|
|
62
61
|
# Test
|
63
62
|
assert check.send(:valid?, '/excluded1', 'output/origin')
|
@@ -77,5 +76,4 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
77
76
|
refute check.send(:valid?, 'stuff/wrong%20foo', 'output/origin')
|
78
77
|
end
|
79
78
|
end
|
80
|
-
|
81
79
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def check_class
|
6
5
|
Nanoc::Extra::Checking::Checks::Stale
|
7
6
|
end
|
@@ -14,7 +13,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def test_run_ok
|
17
|
-
with_site do |
|
16
|
+
with_site do |_site|
|
18
17
|
assert Dir['content/*'].empty?
|
19
18
|
assert Dir['output/*'].empty?
|
20
19
|
|
@@ -30,7 +29,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
|
30
29
|
end
|
31
30
|
|
32
31
|
def test_run_error
|
33
|
-
with_site do |
|
32
|
+
with_site do |_site|
|
34
33
|
assert Dir['content/*'].empty?
|
35
34
|
assert Dir['output/*'].empty?
|
36
35
|
|
@@ -44,7 +43,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def test_run_excluded
|
47
|
-
with_site do |
|
46
|
+
with_site do |_site|
|
48
47
|
assert Dir['content/*'].empty?
|
49
48
|
assert Dir['output/*'].empty?
|
50
49
|
|
@@ -56,7 +55,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
|
56
55
|
end
|
57
56
|
|
58
57
|
def test_run_excluded_with_broken_config
|
59
|
-
with_site do |
|
58
|
+
with_site do |_site|
|
60
59
|
assert Dir['content/*'].empty?
|
61
60
|
assert Dir['output/*'].empty?
|
62
61
|
|
@@ -66,5 +65,4 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
|
66
65
|
refute calc_issues.empty?
|
67
66
|
end
|
68
67
|
end
|
69
|
-
|
70
68
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::Extra::Checking::CheckTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_output_filenames
|
6
5
|
with_site do |site|
|
7
6
|
check = Nanoc::Extra::Checking::Check.new(site)
|
@@ -20,5 +19,4 @@ class Nanoc::Extra::Checking::CheckTest < Nanoc::TestCase
|
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
23
|
-
|
24
22
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Nanoc::Extra::Checking::DSLTest < Nanoc::TestCase
|
4
|
-
|
5
4
|
def test_from_file
|
6
|
-
with_site do |
|
5
|
+
with_site do |_site|
|
7
6
|
File.open('Checks', 'w') { |io| io.write("check :foo do\n\nend\ndeploy_check :bar\n") }
|
8
7
|
dsl = Nanoc::Extra::Checking::DSL.from_file('Checks')
|
9
8
|
|
@@ -14,5 +13,4 @@ class Nanoc::Extra::Checking::DSLTest < Nanoc::TestCase
|
|
14
13
|
assert_equal [:bar], dsl.deploy_checks
|
15
14
|
end
|
16
15
|
end
|
17
|
-
|
18
16
|
end
|