nanoc 4.0.0b2 → 4.0.0b3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -22
- data/NEWS.md +20 -0
- data/Rakefile +0 -2
- data/bin/nanoc +0 -2
- data/lib/nanoc.rb +0 -2
- data/lib/nanoc/base.rb +1 -2
- data/lib/nanoc/base/checksummer.rb +0 -2
- data/lib/nanoc/base/compilation/checksum_store.rb +0 -2
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -2
- data/lib/nanoc/base/compilation/compiler.rb +0 -2
- data/lib/nanoc/base/compilation/compiler_dsl.rb +0 -2
- data/lib/nanoc/base/compilation/dependency_tracker.rb +0 -2
- data/lib/nanoc/base/compilation/filter.rb +0 -2
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -2
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -2
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -2
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -2
- data/lib/nanoc/base/compilation/rule.rb +0 -2
- data/lib/nanoc/base/compilation/rule_context.rb +0 -2
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -2
- data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -2
- data/lib/nanoc/base/compilation/rules_collection.rb +0 -2
- data/lib/nanoc/base/context.rb +0 -2
- data/lib/nanoc/base/core_ext.rb +0 -2
- 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 -2
- data/lib/nanoc/base/error.rb +0 -2
- data/lib/nanoc/base/errors.rb +0 -2
- data/lib/nanoc/base/identifiable_collection.rb +0 -2
- data/lib/nanoc/base/memoization.rb +0 -2
- data/lib/nanoc/base/notification_center.rb +0 -2
- data/lib/nanoc/base/pattern.rb +0 -2
- data/lib/nanoc/base/plugin_registry.rb +0 -2
- data/lib/nanoc/base/result_data/item_rep.rb +0 -2
- data/lib/nanoc/base/source_data/code_snippet.rb +0 -2
- data/lib/nanoc/base/source_data/configuration.rb +0 -2
- data/lib/nanoc/base/source_data/data_source.rb +0 -2
- data/lib/nanoc/base/source_data/identifier.rb +0 -2
- data/lib/nanoc/base/source_data/item.rb +0 -2
- data/lib/nanoc/base/source_data/layout.rb +0 -2
- data/lib/nanoc/base/source_data/site.rb +1 -3
- data/lib/nanoc/base/store.rb +0 -2
- data/lib/nanoc/base/temp_filename_factory.rb +0 -2
- data/lib/nanoc/base/views/config.rb +0 -2
- data/lib/nanoc/base/views/identifiable_collection.rb +0 -2
- data/lib/nanoc/base/views/item.rb +3 -5
- data/lib/nanoc/base/views/item_collection.rb +0 -2
- data/lib/nanoc/base/views/item_rep.rb +0 -2
- data/lib/nanoc/base/views/item_rep_collection.rb +48 -0
- data/lib/nanoc/base/views/layout.rb +0 -2
- data/lib/nanoc/base/views/layout_collection.rb +0 -2
- data/lib/nanoc/base/views/mutable_config.rb +0 -2
- data/lib/nanoc/base/views/mutable_identifiable_collection.rb +0 -2
- data/lib/nanoc/base/views/mutable_item.rb +0 -2
- data/lib/nanoc/base/views/mutable_item_collection.rb +0 -2
- data/lib/nanoc/base/views/mutable_layout.rb +0 -2
- data/lib/nanoc/base/views/mutable_layout_collection.rb +0 -2
- data/lib/nanoc/base/views/site.rb +0 -2
- data/lib/nanoc/cli.rb +0 -2
- data/lib/nanoc/cli/ansi_string_colorizer.rb +0 -2
- data/lib/nanoc/cli/cleaning_stream.rb +0 -2
- data/lib/nanoc/cli/command_runner.rb +0 -2
- data/lib/nanoc/cli/commands/check.rb +0 -2
- data/lib/nanoc/cli/commands/compile.rb +0 -2
- data/lib/nanoc/cli/commands/create-site.rb +7 -25
- data/lib/nanoc/cli/commands/deploy.rb +0 -2
- data/lib/nanoc/cli/commands/nanoc.rb +0 -2
- data/lib/nanoc/cli/commands/prune.rb +0 -2
- data/lib/nanoc/cli/commands/shell.rb +0 -2
- data/lib/nanoc/cli/commands/show-data.rb +0 -2
- data/lib/nanoc/cli/commands/show-plugins.rb +0 -2
- data/lib/nanoc/cli/commands/show-rules.rb +0 -2
- data/lib/nanoc/cli/commands/view.rb +0 -2
- data/lib/nanoc/cli/error_handler.rb +0 -2
- data/lib/nanoc/cli/logger.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +0 -2
- data/lib/nanoc/data_sources.rb +1 -5
- data/lib/nanoc/data_sources/filesystem.rb +2 -2
- data/lib/nanoc/data_sources/filesystem_unified.rb +0 -2
- data/lib/nanoc/extra.rb +0 -2
- data/lib/nanoc/extra/checking.rb +0 -2
- data/lib/nanoc/extra/checking/check.rb +23 -15
- data/lib/nanoc/extra/checking/checks.rb +0 -2
- data/lib/nanoc/extra/checking/checks/css.rb +1 -3
- data/lib/nanoc/extra/checking/checks/external_links.rb +0 -2
- data/lib/nanoc/extra/checking/checks/html.rb +1 -3
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -5
- data/lib/nanoc/extra/checking/checks/mixed_content.rb +0 -2
- data/lib/nanoc/extra/checking/checks/stale.rb +2 -4
- data/lib/nanoc/extra/checking/dsl.rb +0 -2
- data/lib/nanoc/extra/checking/issue.rb +0 -2
- data/lib/nanoc/extra/checking/runner.rb +1 -3
- data/lib/nanoc/extra/core_ext.rb +0 -2
- data/lib/nanoc/extra/core_ext/pathname.rb +0 -2
- data/lib/nanoc/extra/core_ext/time.rb +0 -2
- data/lib/nanoc/extra/deployer.rb +0 -2
- data/lib/nanoc/extra/deployers.rb +0 -2
- data/lib/nanoc/extra/deployers/fog.rb +40 -8
- data/lib/nanoc/extra/deployers/rsync.rb +0 -2
- data/lib/nanoc/extra/filesystem_tools.rb +0 -2
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -2
- data/lib/nanoc/extra/link_collector.rb +0 -2
- data/lib/nanoc/extra/piper.rb +0 -2
- data/lib/nanoc/extra/pruner.rb +0 -2
- data/lib/nanoc/filters.rb +0 -2
- data/lib/nanoc/filters/asciidoc.rb +0 -2
- data/lib/nanoc/filters/bluecloth.rb +0 -2
- data/lib/nanoc/filters/coffeescript.rb +0 -2
- data/lib/nanoc/filters/colorize_syntax.rb +0 -2
- data/lib/nanoc/filters/erb.rb +0 -2
- data/lib/nanoc/filters/erubis.rb +0 -2
- data/lib/nanoc/filters/haml.rb +0 -2
- data/lib/nanoc/filters/handlebars.rb +0 -2
- data/lib/nanoc/filters/kramdown.rb +0 -2
- data/lib/nanoc/filters/less.rb +0 -2
- data/lib/nanoc/filters/markaby.rb +0 -2
- data/lib/nanoc/filters/maruku.rb +0 -2
- data/lib/nanoc/filters/mustache.rb +0 -2
- 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 -2
- data/lib/nanoc/filters/redcloth.rb +0 -2
- data/lib/nanoc/filters/relativize_paths.rb +0 -2
- data/lib/nanoc/filters/rubypants.rb +0 -2
- data/lib/nanoc/filters/sass.rb +0 -2
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
- data/lib/nanoc/filters/slim.rb +0 -2
- data/lib/nanoc/filters/typogruby.rb +0 -2
- data/lib/nanoc/filters/uglify_js.rb +0 -2
- data/lib/nanoc/filters/xsl.rb +0 -2
- data/lib/nanoc/filters/yui_compressor.rb +0 -2
- data/lib/nanoc/helpers.rb +0 -2
- data/lib/nanoc/helpers/blogging.rb +0 -2
- data/lib/nanoc/helpers/breadcrumbs.rb +0 -2
- data/lib/nanoc/helpers/capturing.rb +0 -2
- data/lib/nanoc/helpers/filtering.rb +0 -2
- data/lib/nanoc/helpers/html_escape.rb +0 -2
- data/lib/nanoc/helpers/link_to.rb +0 -2
- data/lib/nanoc/helpers/rendering.rb +0 -2
- data/lib/nanoc/helpers/tagging.rb +0 -2
- data/lib/nanoc/helpers/text.rb +0 -2
- data/lib/nanoc/helpers/xml_sitemap.rb +0 -2
- data/lib/nanoc/version.rb +1 -3
- data/nanoc.gemspec +1 -3
- data/tasks/doc.rake +0 -2
- data/tasks/test.rake +0 -2
- data/test/base/checksummer_spec.rb +0 -2
- data/test/base/core_ext/array_spec.rb +0 -2
- data/test/base/core_ext/hash_spec.rb +0 -2
- data/test/base/core_ext/pathname_spec.rb +0 -2
- data/test/base/core_ext/string_spec.rb +0 -2
- data/test/base/temp_filename_factory_spec.rb +0 -2
- data/test/base/test_checksum_store.rb +0 -2
- data/test/base/test_code_snippet.rb +0 -2
- data/test/base/test_compiler.rb +0 -2
- data/test/base/test_compiler_dsl.rb +1 -3
- data/test/base/test_context.rb +0 -2
- 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 +0 -2
- data/test/base/test_filter.rb +0 -2
- data/test/base/test_item.rb +0 -2
- data/test/base/test_item_array.rb +0 -2
- data/test/base/test_item_rep.rb +0 -2
- data/test/base/test_item_rep_recorder_proxy.rb +0 -2
- data/test/base/test_layout.rb +0 -2
- data/test/base/test_memoization.rb +0 -2
- data/test/base/test_notification_center.rb +0 -2
- data/test/base/test_outdatedness_checker.rb +1 -3
- data/test/base/test_plugin.rb +0 -2
- data/test/base/test_rule.rb +0 -2
- data/test/base/test_rule_context.rb +0 -2
- data/test/base/test_site.rb +1 -3
- data/test/base/test_store.rb +0 -2
- data/test/cli/commands/test_check.rb +0 -2
- data/test/cli/commands/test_compile.rb +0 -2
- data/test/cli/commands/test_create_site.rb +1 -3
- data/test/cli/commands/test_deploy.rb +0 -2
- 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 +2 -4
- data/test/cli/test_cleaning_stream.rb +0 -2
- data/test/cli/test_cli.rb +0 -6
- data/test/cli/test_error_handler.rb +0 -2
- data/test/cli/test_logger.rb +0 -2
- data/test/data_sources/test_filesystem.rb +0 -2
- data/test/data_sources/test_filesystem_unified.rb +15 -2
- data/test/extra/checking/checks/test_css.rb +3 -5
- data/test/extra/checking/checks/test_external_links.rb +5 -7
- data/test/extra/checking/checks/test_html.rb +2 -4
- data/test/extra/checking/checks/test_internal_links.rb +5 -7
- data/test/extra/checking/checks/test_mixed_content.rb +8 -10
- data/test/extra/checking/checks/test_stale.rb +1 -3
- data/test/extra/checking/test_check.rb +2 -6
- data/test/extra/checking/test_dsl.rb +0 -2
- data/test/extra/checking/test_runner.rb +0 -2
- data/test/extra/core_ext/test_pathname.rb +0 -2
- data/test/extra/core_ext/test_time.rb +0 -2
- data/test/extra/deployers/test_fog.rb +147 -2
- data/test/extra/deployers/test_rsync.rb +0 -2
- data/test/extra/test_filesystem_tools.rb +0 -2
- data/test/extra/test_link_collector.rb +0 -2
- data/test/extra/test_piper.rb +0 -2
- data/test/filters/test_asciidoc.rb +0 -2
- data/test/filters/test_bluecloth.rb +0 -2
- data/test/filters/test_coffeescript.rb +0 -2
- data/test/filters/test_colorize_syntax.rb +0 -2
- data/test/filters/test_erb.rb +0 -2
- data/test/filters/test_erubis.rb +0 -2
- data/test/filters/test_haml.rb +0 -2
- data/test/filters/test_handlebars.rb +0 -2
- data/test/filters/test_kramdown.rb +0 -2
- data/test/filters/test_less.rb +0 -2
- data/test/filters/test_markaby.rb +0 -2
- data/test/filters/test_maruku.rb +0 -2
- data/test/filters/test_mustache.rb +0 -2
- data/test/filters/test_pandoc.rb +0 -2
- data/test/filters/test_rainpress.rb +0 -2
- data/test/filters/test_rdiscount.rb +0 -2
- data/test/filters/test_rdoc.rb +0 -2
- data/test/filters/test_redcarpet.rb +0 -2
- data/test/filters/test_redcloth.rb +0 -2
- data/test/filters/test_relativize_paths.rb +0 -2
- data/test/filters/test_rubypants.rb +0 -2
- data/test/filters/test_sass.rb +0 -2
- data/test/filters/test_slim.rb +0 -2
- data/test/filters/test_typogruby.rb +0 -2
- data/test/filters/test_uglify_js.rb +0 -2
- data/test/filters/test_xsl.rb +0 -2
- data/test/filters/test_yui_compressor.rb +0 -2
- data/test/gem_loader.rb +0 -2
- data/test/helper.rb +1 -3
- data/test/helpers/test_blogging.rb +0 -2
- data/test/helpers/test_breadcrumbs.rb +0 -2
- data/test/helpers/test_capturing.rb +0 -2
- data/test/helpers/test_filtering.rb +0 -2
- data/test/helpers/test_html_escape.rb +0 -2
- data/test/helpers/test_link_to.rb +0 -2
- data/test/helpers/test_rendering.rb +0 -2
- data/test/helpers/test_tagging.rb +0 -2
- data/test/helpers/test_text.rb +0 -2
- data/test/helpers/test_xml_sitemap.rb +0 -2
- data/test/test_gem.rb +0 -5
- metadata +5 -6
- data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -71
- data/test/data_sources/test_filesystem_verbose.rb +0 -308
data/test/base/test_store.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
|
4
2
|
def test_create_site_with_existing_name
|
5
3
|
Nanoc::CLI.run %w( create_site foo )
|
@@ -88,7 +86,7 @@ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
|
|
88
86
|
io.write("string_pattern_type: glob\n")
|
89
87
|
io.write("data_sources:\n")
|
90
88
|
io.write(" -\n")
|
91
|
-
io.write(" type:
|
89
|
+
io.write(" type: filesystem\n")
|
92
90
|
io.write(" identifier_type: full\n")
|
93
91
|
end
|
94
92
|
site = Nanoc::Int::Site.new('.')
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
|
4
2
|
def test_run_without_yes
|
5
3
|
with_site do |_site|
|
@@ -31,7 +29,7 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
|
|
31
29
|
io << 'string_pattern_type: legacy' << "\n"
|
32
30
|
io << 'data_sources:' << "\n"
|
33
31
|
io << ' -' << "\n"
|
34
|
-
io << ' type:
|
32
|
+
io << ' type: filesystem' << "\n"
|
35
33
|
io << ' identifier_type: legacy' << "\n"
|
36
34
|
end
|
37
35
|
FileUtils.mkdir_p('output2')
|
@@ -79,7 +77,7 @@ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
|
|
79
77
|
io << 'string_pattern_type: legacy' << "\n"
|
80
78
|
io << 'data_sources:' << "\n"
|
81
79
|
io << ' -' << "\n"
|
82
|
-
io << ' type:
|
80
|
+
io << ' type: filesystem' << "\n"
|
83
81
|
io << ' identifier_type: legacy' << "\n"
|
84
82
|
end
|
85
83
|
FileUtils.mkdir_p('output')
|
data/test/cli/test_cli.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::CLITest < Nanoc::TestCase
|
4
2
|
COMMAND_CODE = <<EOS
|
5
|
-
# encoding: utf-8
|
6
|
-
|
7
3
|
usage '_test [options]'
|
8
4
|
summary 'meh'
|
9
5
|
description 'longer meh'
|
@@ -14,8 +10,6 @@ end
|
|
14
10
|
EOS
|
15
11
|
|
16
12
|
SUBCOMMAND_CODE = <<EOS
|
17
|
-
# encoding: utf-8
|
18
|
-
|
19
13
|
usage '_sub [options]'
|
20
14
|
summary 'meh sub'
|
21
15
|
description 'longer meh sub'
|
data/test/cli/test_logger.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
|
4
2
|
def new_data_source(params = nil)
|
5
3
|
# Mock site
|
@@ -117,6 +115,21 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
|
|
117
115
|
assert_nil items[0].raw_content
|
118
116
|
end
|
119
117
|
|
118
|
+
def test_load_layouts_with_nil_dir_name
|
119
|
+
# Create data source
|
120
|
+
data_source = new_data_source(layouts_dir: nil)
|
121
|
+
|
122
|
+
# Create sample files
|
123
|
+
FileUtils.mkdir_p('layouts')
|
124
|
+
File.write('layouts/stuff.txt', 'blah blah')
|
125
|
+
|
126
|
+
# Load
|
127
|
+
layouts = data_source.layouts
|
128
|
+
|
129
|
+
# Check
|
130
|
+
assert_empty(layouts)
|
131
|
+
end
|
132
|
+
|
120
133
|
def test_load_binary_layouts
|
121
134
|
# Create data source
|
122
135
|
data_source = new_data_source
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
|
4
2
|
def test_run_ok
|
5
3
|
VCR.use_cassette('css_run_ok') do
|
@@ -10,7 +8,7 @@ class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
|
|
10
8
|
File.open('output/style.css', 'w') { |io| io.write('h1 { color: red; }') }
|
11
9
|
|
12
10
|
# Run check
|
13
|
-
check = Nanoc::Extra::Checking::Checks::CSS.
|
11
|
+
check = Nanoc::Extra::Checking::Checks::CSS.create(site)
|
14
12
|
check.run
|
15
13
|
|
16
14
|
# Check
|
@@ -28,7 +26,7 @@ class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
|
|
28
26
|
File.open('output/style.css', 'w') { |io| io.write('h1 { coxlor: rxed; }') }
|
29
27
|
|
30
28
|
# Run check
|
31
|
-
check = Nanoc::Extra::Checking::Checks::CSS.
|
29
|
+
check = Nanoc::Extra::Checking::Checks::CSS.create(site)
|
32
30
|
check.run
|
33
31
|
|
34
32
|
# Check
|
@@ -49,7 +47,7 @@ class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
|
|
49
47
|
File.open('output/style.css', 'w') { |io| io.write('h1 { ; {') }
|
50
48
|
|
51
49
|
# Run check
|
52
|
-
check = Nanoc::Extra::Checking::Checks::CSS.
|
50
|
+
check = Nanoc::Extra::Checking::Checks::CSS.create(site)
|
53
51
|
check.run
|
54
52
|
|
55
53
|
# Check
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
4
2
|
def test_run
|
5
3
|
with_site do |site|
|
@@ -9,7 +7,7 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
|
9
7
|
File.open('output/bar.html', 'w') { |io| io.write('<a href="http://example.com/">not broken</a>') }
|
10
8
|
|
11
9
|
# Create check
|
12
|
-
check = Nanoc::Extra::Checking::Checks::ExternalLinks.
|
10
|
+
check = Nanoc::Extra::Checking::Checks::ExternalLinks.create(site)
|
13
11
|
def check.request_url_once(url)
|
14
12
|
Net::HTTPResponse.new('1.1', url.path == '/' ? '200' : '404', 'okay')
|
15
13
|
end
|
@@ -23,7 +21,7 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
|
23
21
|
def test_valid_by_path
|
24
22
|
with_site do |site|
|
25
23
|
# Create check
|
26
|
-
check = Nanoc::Extra::Checking::Checks::ExternalLinks.
|
24
|
+
check = Nanoc::Extra::Checking::Checks::ExternalLinks.create(site)
|
27
25
|
def check.request_url_once(url)
|
28
26
|
Net::HTTPResponse.new('1.1', url.path == '/200' ? '200' : '404', 'okay')
|
29
27
|
end
|
@@ -38,7 +36,7 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
|
38
36
|
def test_valid_by_query
|
39
37
|
with_site do |site|
|
40
38
|
# Create check
|
41
|
-
check = Nanoc::Extra::Checking::Checks::ExternalLinks.
|
39
|
+
check = Nanoc::Extra::Checking::Checks::ExternalLinks.create(site)
|
42
40
|
def check.request_url_once(url)
|
43
41
|
Net::HTTPResponse.new('1.1', url.query == 'status=200' ? '200' : '404', 'okay')
|
44
42
|
end
|
@@ -52,7 +50,7 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
|
52
50
|
def test_fallback_to_get_when_head_is_not_allowed
|
53
51
|
with_site do |site|
|
54
52
|
# Create check
|
55
|
-
check = Nanoc::Extra::Checking::Checks::ExternalLinks.
|
53
|
+
check = Nanoc::Extra::Checking::Checks::ExternalLinks.create(site)
|
56
54
|
def check.request_url_once(url, req_method = Net::HTTP::Head)
|
57
55
|
Net::HTTPResponse.new('1.1', (req_method == Net::HTTP::Head || url.path == '/405') ? '405' : '200', 'okay')
|
58
56
|
end
|
@@ -65,7 +63,7 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
|
|
65
63
|
|
66
64
|
def test_path_for_url
|
67
65
|
with_site do |site|
|
68
|
-
check = Nanoc::Extra::Checking::Checks::ExternalLinks.
|
66
|
+
check = Nanoc::Extra::Checking::Checks::ExternalLinks.create(site)
|
69
67
|
|
70
68
|
assert_equal '/', check.send(:path_for_url, URI.parse('http://example.com'))
|
71
69
|
assert_equal '/', check.send(:path_for_url, URI.parse('http://example.com/'))
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::Extra::Checking::Checks::HTMLTest < Nanoc::TestCase
|
4
2
|
def test_run_ok
|
5
3
|
VCR.use_cassette('html_run_ok') do
|
@@ -10,7 +8,7 @@ class Nanoc::Extra::Checking::Checks::HTMLTest < Nanoc::TestCase
|
|
10
8
|
File.open('output/style.css', 'w') { |io| io.write('h1 { coxlor: rxed; }') }
|
11
9
|
|
12
10
|
# Run check
|
13
|
-
check = Nanoc::Extra::Checking::Checks::HTML.
|
11
|
+
check = Nanoc::Extra::Checking::Checks::HTML.create(site)
|
14
12
|
check.run
|
15
13
|
|
16
14
|
# Check
|
@@ -28,7 +26,7 @@ class Nanoc::Extra::Checking::Checks::HTMLTest < Nanoc::TestCase
|
|
28
26
|
File.open('output/style.css', 'w') { |io| io.write('h1 { coxlor: rxed; }') }
|
29
27
|
|
30
28
|
# Run check
|
31
|
-
check = Nanoc::Extra::Checking::Checks::HTML.
|
29
|
+
check = Nanoc::Extra::Checking::Checks::HTML.create(site)
|
32
30
|
check.run
|
33
31
|
|
34
32
|
# Check
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
4
2
|
def test_run
|
5
3
|
with_site do |site|
|
@@ -10,7 +8,7 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
10
8
|
File.open('output/bar.html', 'w') { |io| io.write('<a href="/foo.txt">not broken</a>') }
|
11
9
|
|
12
10
|
# Create check
|
13
|
-
check = Nanoc::Extra::Checking::Checks::InternalLinks.
|
11
|
+
check = Nanoc::Extra::Checking::Checks::InternalLinks.create(site)
|
14
12
|
check.run
|
15
13
|
|
16
14
|
# Test
|
@@ -28,7 +26,7 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
28
26
|
File.open('output/stuff/blah', 'w') { |io| io.write('hi') }
|
29
27
|
|
30
28
|
# Create check
|
31
|
-
check = Nanoc::Extra::Checking::Checks::InternalLinks.
|
29
|
+
check = Nanoc::Extra::Checking::Checks::InternalLinks.create(site)
|
32
30
|
|
33
31
|
# Test
|
34
32
|
assert check.send(:valid?, 'foo', 'output/origin')
|
@@ -45,7 +43,7 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
45
43
|
FileUtils.mkdir_p('output/stuff')
|
46
44
|
File.open('output/stuff/right', 'w') { |io| io.write('hi') }
|
47
45
|
|
48
|
-
check = Nanoc::Extra::Checking::Checks::InternalLinks.
|
46
|
+
check = Nanoc::Extra::Checking::Checks::InternalLinks.create(site)
|
49
47
|
|
50
48
|
assert check.send(:valid?, 'stuff/right?foo=123', 'output/origin')
|
51
49
|
refute check.send(:valid?, 'stuff/wrong?foo=123', 'output/origin')
|
@@ -55,7 +53,7 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
55
53
|
def test_exclude
|
56
54
|
with_site do |site|
|
57
55
|
# Create check
|
58
|
-
check = Nanoc::Extra::Checking::Checks::InternalLinks.
|
56
|
+
check = Nanoc::Extra::Checking::Checks::InternalLinks.create(site)
|
59
57
|
site.config.update({ checks: { internal_links: { exclude: ['^/excluded\d+'] } } })
|
60
58
|
|
61
59
|
# Test
|
@@ -70,7 +68,7 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
70
68
|
FileUtils.mkdir_p('output/stuff')
|
71
69
|
File.open('output/stuff/right foo', 'w') { |io| io.write('hi') }
|
72
70
|
|
73
|
-
check = Nanoc::Extra::Checking::Checks::InternalLinks.
|
71
|
+
check = Nanoc::Extra::Checking::Checks::InternalLinks.create(site)
|
74
72
|
|
75
73
|
assert check.send(:valid?, 'stuff/right%20foo', 'output/origin')
|
76
74
|
refute check.send(:valid?, 'stuff/wrong%20foo', 'output/origin')
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
4
2
|
def create_output_file(name, lines)
|
5
3
|
FileUtils.mkdir_p('output')
|
@@ -24,7 +22,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
24
22
|
'<audio src="https://nanoc.ws/theme-song.flac"></audio>',
|
25
23
|
'<video src="https://nanoc.ws/screen-cast.mkv"></video>'
|
26
24
|
])
|
27
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
25
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
28
26
|
check.run
|
29
27
|
|
30
28
|
assert check.issues.empty?
|
@@ -42,7 +40,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
42
40
|
'<audio src="/theme-song.flac"></audio>',
|
43
41
|
'<video src="/screen-cast.mkv"></video>'
|
44
42
|
])
|
45
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
43
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
46
44
|
check.run
|
47
45
|
|
48
46
|
assert check.issues.empty?
|
@@ -60,7 +58,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
60
58
|
'<audio src="//nanoc.ws/theme-song.flac"></audio>',
|
61
59
|
'<video src="//nanoc.ws/screen-cast.mkv"></video>'
|
62
60
|
])
|
63
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
61
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
64
62
|
check.run
|
65
63
|
|
66
64
|
assert check.issues.empty?
|
@@ -78,7 +76,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
78
76
|
'<audio src="theme-song.flac"></audio>',
|
79
77
|
'<video src="screen-cast.mkv"></video>'
|
80
78
|
])
|
81
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
79
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
82
80
|
check.run
|
83
81
|
|
84
82
|
assert check.issues.empty?
|
@@ -96,7 +94,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
96
94
|
'<audio src="?query-string"></audio>',
|
97
95
|
'<video src="?query-string"></video>'
|
98
96
|
])
|
99
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
97
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
100
98
|
check.run
|
101
99
|
|
102
100
|
assert check.issues.empty?
|
@@ -114,7 +112,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
114
112
|
'<audio src="#fragment"></audio>',
|
115
113
|
'<video src="#fragment"></video>'
|
116
114
|
])
|
117
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
115
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
118
116
|
check.run
|
119
117
|
|
120
118
|
assert check.issues.empty?
|
@@ -133,7 +131,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
133
131
|
'<audio src="http://nanoc.ws/theme-song.flac"></audio>',
|
134
132
|
'<video src="http://nanoc.ws/screencast.mkv"></video>'
|
135
133
|
])
|
136
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
134
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
137
135
|
check.run
|
138
136
|
|
139
137
|
issues = check.issues.to_a
|
@@ -179,7 +177,7 @@ class Nanoc::Extra::Checking::Checks::MixedContentTest < Nanoc::TestCase
|
|
179
177
|
'<video target="http://nanoc.ws/screen-cast.mkv"></video>',
|
180
178
|
'<p>http://nanoc.ws/harmless-text</p>'
|
181
179
|
])
|
182
|
-
check = Nanoc::Extra::Checking::Checks::MixedContent.
|
180
|
+
check = Nanoc::Extra::Checking::Checks::MixedContent.create(site)
|
183
181
|
check.run
|
184
182
|
|
185
183
|
assert check.issues.empty?
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
4
2
|
def check_class
|
5
3
|
Nanoc::Extra::Checking::Checks::Stale
|
@@ -7,7 +5,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
|
|
7
5
|
|
8
6
|
def calc_issues
|
9
7
|
site = Nanoc::Int::Site.new('.')
|
10
|
-
check = check_class.
|
8
|
+
check = check_class.create(site)
|
11
9
|
check.run
|
12
10
|
check.issues
|
13
11
|
end
|
@@ -1,11 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::Extra::Checking::CheckTest < Nanoc::TestCase
|
4
2
|
def test_output_filenames
|
5
3
|
with_site do |site|
|
6
|
-
check = Nanoc::Extra::Checking::Check.new(site)
|
7
|
-
assert check.output_filenames.empty?
|
8
4
|
File.open('output/foo.html', 'w') { |io| io.write 'hello' }
|
5
|
+
check = Nanoc::Extra::Checking::Check.create(site)
|
9
6
|
assert_equal ['output/foo.html'], check.output_filenames
|
10
7
|
end
|
11
8
|
end
|
@@ -13,9 +10,8 @@ class Nanoc::Extra::Checking::CheckTest < Nanoc::TestCase
|
|
13
10
|
def test_no_output_dir
|
14
11
|
with_site do |site|
|
15
12
|
site.config[:output_dir] = 'non-existent'
|
16
|
-
check = Nanoc::Extra::Checking::Check.new(site)
|
17
13
|
assert_raises Nanoc::Extra::Checking::OutputDirNotFoundError do
|
18
|
-
|
14
|
+
Nanoc::Extra::Checking::Check.create(site)
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|