nanoc 3.8.0 → 4.0.0a1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +322 -0
- data/NEWS.md +6 -0
- data/bin/nanoc +0 -18
- data/lib/nanoc.rb +5 -3
- data/lib/nanoc/base.rb +24 -6
- data/lib/nanoc/base/checksummer.rb +6 -4
- data/lib/nanoc/base/compilation/checksum_store.rb +4 -4
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +5 -5
- data/lib/nanoc/base/compilation/compiler.rb +60 -65
- data/lib/nanoc/base/compilation/compiler_dsl.rb +11 -9
- data/lib/nanoc/base/compilation/dependency_tracker.rb +24 -38
- data/lib/nanoc/base/compilation/filter.rb +22 -7
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +14 -12
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -8
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +32 -32
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +3 -1
- data/lib/nanoc/base/compilation/rule.rb +9 -7
- data/lib/nanoc/base/compilation/rule_context.rb +15 -15
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +3 -3
- data/lib/nanoc/base/compilation/rule_memory_store.rb +7 -7
- data/lib/nanoc/base/compilation/rules_collection.rb +28 -30
- data/lib/nanoc/base/context.rb +2 -2
- data/lib/nanoc/base/core_ext/array.rb +17 -25
- data/lib/nanoc/base/core_ext/hash.rb +17 -25
- data/lib/nanoc/base/core_ext/pathname.rb +4 -2
- data/lib/nanoc/base/core_ext/string.rb +5 -3
- data/lib/nanoc/base/directed_graph.rb +4 -9
- data/lib/nanoc/base/error.rb +7 -0
- data/lib/nanoc/base/errors.rb +16 -23
- data/lib/nanoc/base/memoization.rb +4 -2
- data/lib/nanoc/base/notification_center.rb +3 -1
- data/lib/nanoc/base/plugin_registry.rb +14 -21
- data/lib/nanoc/base/result_data/item_rep.rb +43 -88
- data/lib/nanoc/base/source_data/code_snippet.rb +6 -4
- data/lib/nanoc/base/source_data/configuration.rb +3 -1
- data/lib/nanoc/base/source_data/data_source.rb +12 -94
- data/lib/nanoc/base/source_data/identifier.rb +50 -0
- data/lib/nanoc/base/source_data/item.rb +24 -67
- data/lib/nanoc/base/source_data/item_array.rb +6 -4
- data/lib/nanoc/base/source_data/layout.rb +17 -28
- data/lib/nanoc/base/source_data/site.rb +33 -44
- data/lib/nanoc/base/store.rb +3 -5
- data/lib/nanoc/base/temp_filename_factory.rb +3 -2
- data/lib/nanoc/base/views/config.rb +19 -0
- data/lib/nanoc/base/views/item.rb +77 -0
- data/lib/nanoc/base/views/item_collection.rb +43 -0
- data/lib/nanoc/base/views/item_rep.rb +125 -0
- data/lib/nanoc/base/views/layout.rb +42 -0
- data/lib/nanoc/base/views/layout_collection.rb +26 -0
- data/lib/nanoc/base/views/mutable_config.rb +9 -0
- data/lib/nanoc/base/views/mutable_item.rb +9 -0
- data/lib/nanoc/base/views/mutable_item_collection.rb +18 -0
- data/lib/nanoc/base/views/mutable_layout.rb +9 -0
- data/lib/nanoc/base/views/mutable_layout_collection.rb +18 -0
- data/lib/nanoc/base/views/site.rb +35 -0
- data/lib/nanoc/cli.rb +3 -6
- data/lib/nanoc/cli/ansi_string_colorizer.rb +2 -0
- data/lib/nanoc/cli/cleaning_stream.rb +2 -0
- data/lib/nanoc/cli/command_runner.rb +8 -42
- data/lib/nanoc/cli/commands/check.rb +2 -2
- data/lib/nanoc/cli/commands/compile.rb +19 -34
- data/lib/nanoc/cli/commands/create-site.rb +46 -83
- data/lib/nanoc/cli/commands/deploy.rb +4 -4
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/cli/commands/show-plugins.rb +4 -6
- data/lib/nanoc/cli/error_handler.rb +4 -14
- data/lib/nanoc/cli/logger.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners.rb +1 -0
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +2 -0
- data/lib/nanoc/data_sources.rb +1 -17
- data/lib/nanoc/data_sources/filesystem.rb +6 -37
- data/lib/nanoc/data_sources/filesystem_unified.rb +5 -3
- data/lib/nanoc/data_sources/filesystem_verbose.rb +5 -3
- data/lib/nanoc/data_sources/static.rb +4 -2
- data/lib/nanoc/extra.rb +1 -13
- data/lib/nanoc/extra/checking.rb +1 -0
- data/lib/nanoc/extra/checking/check.rb +4 -2
- data/lib/nanoc/extra/checking/checks.rb +1 -0
- data/lib/nanoc/extra/checking/checks/css.rb +1 -0
- data/lib/nanoc/extra/checking/checks/external_links.rb +2 -0
- data/lib/nanoc/extra/checking/checks/html.rb +1 -0
- data/lib/nanoc/extra/checking/checks/internal_links.rb +2 -0
- data/lib/nanoc/extra/checking/checks/mixed_content.rb +2 -0
- data/lib/nanoc/extra/checking/checks/stale.rb +1 -0
- data/lib/nanoc/extra/checking/dsl.rb +1 -0
- data/lib/nanoc/extra/checking/issue.rb +1 -0
- data/lib/nanoc/extra/checking/runner.rb +3 -3
- data/lib/nanoc/extra/core_ext/pathname.rb +5 -3
- data/lib/nanoc/extra/core_ext/time.rb +4 -2
- data/lib/nanoc/extra/deployer.rb +3 -1
- data/lib/nanoc/extra/deployers.rb +1 -0
- data/lib/nanoc/extra/deployers/fog.rb +2 -0
- data/lib/nanoc/extra/deployers/rsync.rb +2 -0
- data/lib/nanoc/extra/filesystem_tools.rb +3 -7
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -0
- data/lib/nanoc/extra/link_collector.rb +1 -0
- data/lib/nanoc/extra/piper.rb +2 -1
- data/lib/nanoc/extra/pruner.rb +5 -3
- data/lib/nanoc/filters.rb +1 -2
- data/lib/nanoc/filters/asciidoc.rb +2 -0
- data/lib/nanoc/filters/bluecloth.rb +1 -0
- data/lib/nanoc/filters/coffeescript.rb +2 -0
- data/lib/nanoc/filters/colorize_syntax.rb +1 -12
- data/lib/nanoc/filters/erb.rb +2 -1
- data/lib/nanoc/filters/erubis.rb +2 -1
- data/lib/nanoc/filters/haml.rb +2 -1
- data/lib/nanoc/filters/handlebars.rb +2 -0
- data/lib/nanoc/filters/kramdown.rb +1 -0
- data/lib/nanoc/filters/less.rb +1 -0
- data/lib/nanoc/filters/markaby.rb +1 -0
- data/lib/nanoc/filters/maruku.rb +1 -0
- data/lib/nanoc/filters/mustache.rb +2 -0
- data/lib/nanoc/filters/pandoc.rb +1 -0
- data/lib/nanoc/filters/rainpress.rb +1 -0
- data/lib/nanoc/filters/rdiscount.rb +1 -0
- data/lib/nanoc/filters/rdoc.rb +1 -0
- data/lib/nanoc/filters/redcarpet.rb +2 -0
- data/lib/nanoc/filters/redcloth.rb +1 -0
- data/lib/nanoc/filters/relativize_paths.rb +1 -0
- data/lib/nanoc/filters/rubypants.rb +1 -0
- data/lib/nanoc/filters/sass.rb +1 -0
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +2 -0
- data/lib/nanoc/filters/slim.rb +3 -1
- data/lib/nanoc/filters/typogruby.rb +2 -0
- data/lib/nanoc/filters/uglify_js.rb +1 -0
- data/lib/nanoc/filters/xsl.rb +2 -0
- data/lib/nanoc/filters/yui_compressor.rb +2 -0
- data/lib/nanoc/helpers/blogging.rb +30 -30
- data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
- data/lib/nanoc/helpers/capturing.rb +6 -17
- data/lib/nanoc/helpers/filtering.rb +3 -3
- data/lib/nanoc/helpers/link_to.rb +3 -3
- data/lib/nanoc/helpers/rendering.rb +11 -11
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -3
- data/lib/nanoc/tasks.rb +1 -0
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/tasks/doc.rake +2 -1
- data/tasks/test.rake +7 -1
- data/test/base/checksummer_spec.rb +15 -15
- data/test/base/core_ext/array_spec.rb +10 -10
- data/test/base/core_ext/hash_spec.rb +16 -16
- data/test/base/core_ext/pathname_spec.rb +2 -2
- data/test/base/core_ext/string_spec.rb +9 -9
- data/test/base/temp_filename_factory_spec.rb +3 -7
- data/test/base/test_checksum_store.rb +5 -5
- data/test/base/test_code_snippet.rb +3 -3
- data/test/base/test_compiler.rb +29 -29
- data/test/base/test_compiler_dsl.rb +23 -23
- data/test/base/test_context.rb +4 -4
- data/test/base/test_data_source.rb +17 -7
- data/test/base/test_dependency_tracker.rb +29 -29
- data/test/base/test_directed_graph.rb +27 -27
- data/test/base/test_item.rb +23 -21
- data/test/base/test_item_array.rb +18 -18
- data/test/base/test_item_rep.rb +76 -76
- data/test/base/test_item_rep_recorder_proxy.rb +4 -4
- data/test/base/test_layout.rb +8 -16
- data/test/base/test_memoization.rb +4 -4
- data/test/base/test_notification_center.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +18 -18
- data/test/base/test_plugin.rb +1 -1
- data/test/base/test_rule.rb +2 -2
- data/test/base/test_rule_context.rb +5 -5
- data/test/base/test_site.rb +62 -38
- data/test/base/test_store.rb +2 -2
- data/test/cli/commands/test_check.rb +1 -1
- data/test/cli/commands/test_compile.rb +24 -18
- data/test/cli/commands/test_create_site.rb +5 -7
- data/test/cli/commands/test_deploy.rb +1 -1
- data/test/data_sources/test_filesystem.rb +22 -67
- data/test/data_sources/test_filesystem_unified.rb +10 -23
- data/test/data_sources/test_filesystem_verbose.rb +8 -53
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +1 -1
- data/test/extra/core_ext/test_pathname.rb +3 -3
- data/test/extra/core_ext/test_time.rb +4 -4
- data/test/extra/test_filesystem_tools.rb +1 -1
- data/test/filters/test_handlebars.rb +3 -3
- data/test/filters/test_less.rb +6 -6
- data/test/filters/test_mustache.rb +2 -2
- data/test/filters/test_relativize_paths.rb +81 -81
- data/test/filters/test_sass.rb +7 -7
- data/test/filters/test_xsl.rb +6 -6
- data/test/helper.rb +1 -1
- data/test/helpers/test_blogging.rb +78 -99
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +10 -11
- data/test/helpers/test_filtering.rb +6 -6
- data/test/helpers/test_rendering.rb +3 -3
- data/test/helpers/test_tagging.rb +7 -7
- data/test/helpers/test_xml_sitemap.rb +34 -33
- metadata +19 -43
- data/lib/nanoc/cli/commands/autocompile.rb +0 -69
- data/lib/nanoc/cli/commands/create-item.rb +0 -55
- data/lib/nanoc/cli/commands/create-layout.rb +0 -68
- data/lib/nanoc/cli/commands/sync.rb +0 -32
- data/lib/nanoc/cli/commands/update.rb +0 -63
- data/lib/nanoc/cli/commands/validate-css.rb +0 -20
- data/lib/nanoc/cli/commands/validate-html.rb +0 -20
- data/lib/nanoc/cli/commands/validate-links.rb +0 -27
- data/lib/nanoc/cli/commands/watch.rb +0 -176
- data/lib/nanoc/data_sources/deprecated/delicious.rb +0 -38
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +0 -85
- data/lib/nanoc/data_sources/deprecated/twitter.rb +0 -34
- data/lib/nanoc/extra/auto_compiler.rb +0 -99
- data/lib/nanoc/extra/chick.rb +0 -117
- data/lib/nanoc/extra/file_proxy.rb +0 -36
- data/lib/nanoc/extra/validators.rb +0 -8
- data/lib/nanoc/extra/validators/links.rb +0 -18
- data/lib/nanoc/extra/validators/w3c.rb +0 -23
- data/lib/nanoc/extra/vcs.rb +0 -62
- data/lib/nanoc/extra/vcses.rb +0 -15
- data/lib/nanoc/extra/vcses/bazaar.rb +0 -21
- data/lib/nanoc/extra/vcses/dummy.rb +0 -20
- data/lib/nanoc/extra/vcses/git.rb +0 -21
- data/lib/nanoc/extra/vcses/mercurial.rb +0 -21
- data/lib/nanoc/extra/vcses/subversion.rb +0 -21
- data/lib/nanoc/filters/coderay.rb +0 -19
- data/lib/nanoc3.rb +0 -3
- data/lib/nanoc3/cli.rb +0 -3
- data/lib/nanoc3/tasks.rb +0 -3
- data/test/cli/commands/test_create_item.rb +0 -10
- data/test/cli/commands/test_create_layout.rb +0 -24
- data/test/cli/commands/test_sync.rb +0 -27
- data/test/cli/commands/test_update.rb +0 -6
- data/test/cli/commands/test_watch.rb +0 -74
- data/test/extra/test_auto_compiler.rb +0 -437
- data/test/extra/test_vcs.rb +0 -18
- data/test/extra/validators/test_links.rb +0 -4
- data/test/extra/validators/test_w3c.rb +0 -37
- data/test/filters/test_coderay.rb +0 -40
@@ -1,17 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::ItemRepRecorderProxyTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::ItemRepRecorderProxyTest < Nanoc::TestCase
|
4
4
|
def test_double_names
|
5
|
-
proxy = Nanoc::ItemRepRecorderProxy.new(mock)
|
5
|
+
proxy = Nanoc::Int::ItemRepRecorderProxy.new(mock)
|
6
6
|
|
7
7
|
proxy.snapshot(:foo, stuff: :giraffe)
|
8
|
-
assert_raises(Nanoc::Errors::CannotCreateMultipleSnapshotsWithSameName) do
|
8
|
+
assert_raises(Nanoc::Int::Errors::CannotCreateMultipleSnapshotsWithSameName) do
|
9
9
|
proxy.snapshot(:foo, stuff: :donkey)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_double_params
|
14
|
-
proxy = Nanoc::ItemRepRecorderProxy.new(mock)
|
14
|
+
proxy = Nanoc::Int::ItemRepRecorderProxy.new(mock)
|
15
15
|
|
16
16
|
proxy.snapshot(:foo)
|
17
17
|
proxy.snapshot(:bar)
|
data/test/base/test_layout.rb
CHANGED
@@ -1,27 +1,19 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::LayoutTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::LayoutTest < Nanoc::TestCase
|
4
4
|
def test_initialize
|
5
5
|
# Make sure attributes are cleaned
|
6
|
-
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
6
|
+
layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
7
7
|
assert_equal({ foo: 'bar' }, layout.attributes)
|
8
8
|
|
9
9
|
# Make sure identifier is cleaned
|
10
|
-
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, 'foo')
|
11
|
-
assert_equal('/foo/', layout.identifier)
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_frozen_identifier
|
15
|
-
layout = Nanoc::Layout.new('foo', {}, '/foo')
|
16
|
-
|
17
|
-
assert_raises_frozen_error do
|
18
|
-
layout.identifier.chop!
|
19
|
-
end
|
10
|
+
layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, 'foo')
|
11
|
+
assert_equal(Nanoc::Identifier.new('/foo/'), layout.identifier)
|
20
12
|
end
|
21
13
|
|
22
14
|
def test_lookup_with_known_attribute
|
23
15
|
# Create layout
|
24
|
-
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
16
|
+
layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
25
17
|
|
26
18
|
# Check attributes
|
27
19
|
assert_equal('bar', layout[:foo])
|
@@ -29,21 +21,21 @@ class Nanoc::LayoutTest < Nanoc::TestCase
|
|
29
21
|
|
30
22
|
def test_lookup_with_unknown_attribute
|
31
23
|
# Create layout
|
32
|
-
layout = Nanoc::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
24
|
+
layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, '/foo/')
|
33
25
|
|
34
26
|
# Check attributes
|
35
27
|
assert_equal(nil, layout[:filter])
|
36
28
|
end
|
37
29
|
|
38
30
|
def test_dump_and_load
|
39
|
-
layout = Nanoc::Layout.new(
|
31
|
+
layout = Nanoc::Int::Layout.new(
|
40
32
|
'foobar',
|
41
33
|
{ a: { b: 123 } },
|
42
34
|
'/foo/')
|
43
35
|
|
44
36
|
layout = Marshal.load(Marshal.dump(layout))
|
45
37
|
|
46
|
-
assert_equal '/foo/', layout.identifier
|
38
|
+
assert_equal Nanoc::Identifier.new('/foo/'), layout.identifier
|
47
39
|
assert_equal 'foobar', layout.raw_content
|
48
40
|
assert_equal({ a: { b: 123 } }, layout.attributes)
|
49
41
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::MemoizationTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::MemoizationTest < Nanoc::TestCase
|
4
4
|
class Sample1
|
5
|
-
extend Nanoc::Memoization
|
5
|
+
extend Nanoc::Int::Memoization
|
6
6
|
|
7
7
|
def initialize(value)
|
8
8
|
@value = value
|
@@ -15,7 +15,7 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class Sample2
|
18
|
-
extend Nanoc::Memoization
|
18
|
+
extend Nanoc::Int::Memoization
|
19
19
|
|
20
20
|
def initialize(value)
|
21
21
|
@value = value
|
@@ -28,7 +28,7 @@ class Nanoc::MemoizationTest < Nanoc::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
class EqualSample
|
31
|
-
extend Nanoc::Memoization
|
31
|
+
extend Nanoc::Int::Memoization
|
32
32
|
|
33
33
|
def initialize(value)
|
34
34
|
@value = value
|
@@ -1,30 +1,30 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::NotificationCenterTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::NotificationCenterTest < Nanoc::TestCase
|
4
4
|
def test_post
|
5
5
|
# Set up notification
|
6
|
-
Nanoc::NotificationCenter.on :ping_received, :test do
|
6
|
+
Nanoc::Int::NotificationCenter.on :ping_received, :test do
|
7
7
|
@ping_received = true
|
8
8
|
end
|
9
9
|
|
10
10
|
# Post
|
11
11
|
@ping_received = false
|
12
|
-
Nanoc::NotificationCenter.post :ping_received
|
12
|
+
Nanoc::Int::NotificationCenter.post :ping_received
|
13
13
|
assert(@ping_received)
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_remove
|
17
17
|
# Set up notification
|
18
|
-
Nanoc::NotificationCenter.on :ping_received, :test do
|
18
|
+
Nanoc::Int::NotificationCenter.on :ping_received, :test do
|
19
19
|
@ping_received = true
|
20
20
|
end
|
21
21
|
|
22
22
|
# Remove observer
|
23
|
-
Nanoc::NotificationCenter.remove :ping_received, :test
|
23
|
+
Nanoc::Int::NotificationCenter.remove :ping_received, :test
|
24
24
|
|
25
25
|
# Post
|
26
26
|
@ping_received = false
|
27
|
-
Nanoc::NotificationCenter.post :ping_received
|
27
|
+
Nanoc::Int::NotificationCenter.post :ping_received
|
28
28
|
assert(!@ping_received)
|
29
29
|
end
|
30
30
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
|
4
4
|
def test_not_outdated
|
5
5
|
# Compile once
|
6
6
|
with_site(name: 'foo') do |site|
|
@@ -36,7 +36,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
36
36
|
with_site(name: 'foo') do |site|
|
37
37
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
38
38
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
39
|
-
assert_equal ::Nanoc::OutdatednessReasons::NotEnoughData,
|
39
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::NotEnoughData,
|
40
40
|
outdatedness_checker.outdatedness_reason_for(rep)
|
41
41
|
end
|
42
42
|
end
|
@@ -59,7 +59,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
59
59
|
with_site(name: 'foo') do |site|
|
60
60
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
61
61
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
62
|
-
assert_equal ::Nanoc::OutdatednessReasons::NotWritten,
|
62
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::NotWritten,
|
63
63
|
outdatedness_checker.outdatedness_reason_for(rep)
|
64
64
|
end
|
65
65
|
end
|
@@ -83,7 +83,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
83
83
|
with_site(name: 'foo') do |site|
|
84
84
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
85
85
|
rep = site.items.find { |i| i.identifier == '/new/' }.reps[0]
|
86
|
-
assert_equal ::Nanoc::OutdatednessReasons::SourceModified,
|
86
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::SourceModified,
|
87
87
|
outdatedness_checker.outdatedness_reason_for(rep)
|
88
88
|
end
|
89
89
|
end
|
@@ -109,7 +109,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
109
109
|
|
110
110
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
111
111
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
112
|
-
assert_equal ::Nanoc::OutdatednessReasons::DependenciesOutdated,
|
112
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
|
113
113
|
outdatedness_checker.outdatedness_reason_for(rep)
|
114
114
|
end
|
115
115
|
end
|
@@ -141,7 +141,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
141
141
|
|
142
142
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
143
143
|
rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
|
144
|
-
assert_equal ::Nanoc::OutdatednessReasons::DependenciesOutdated,
|
144
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
|
145
145
|
outdatedness_checker.outdatedness_reason_for(rep)
|
146
146
|
end
|
147
147
|
end
|
@@ -176,7 +176,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
176
176
|
|
177
177
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
178
178
|
rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
|
179
|
-
assert_equal ::Nanoc::OutdatednessReasons::DependenciesOutdated,
|
179
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
|
180
180
|
outdatedness_checker.outdatedness_reason_for(rep)
|
181
181
|
end
|
182
182
|
end
|
@@ -208,7 +208,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
208
208
|
|
209
209
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
210
210
|
rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
|
211
|
-
assert_equal ::Nanoc::OutdatednessReasons::DependenciesOutdated,
|
211
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
|
212
212
|
outdatedness_checker.outdatedness_reason_for(rep)
|
213
213
|
end
|
214
214
|
end
|
@@ -242,7 +242,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
242
242
|
|
243
243
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
244
244
|
rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
|
245
|
-
assert_equal ::Nanoc::OutdatednessReasons::DependenciesOutdated,
|
245
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
|
246
246
|
outdatedness_checker.outdatedness_reason_for(rep)
|
247
247
|
end
|
248
248
|
end
|
@@ -266,7 +266,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
266
266
|
with_site(name: 'foo') do |site|
|
267
267
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
268
268
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
269
|
-
assert_equal ::Nanoc::OutdatednessReasons::CodeSnippetsModified,
|
269
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::CodeSnippetsModified,
|
270
270
|
outdatedness_checker.outdatedness_reason_for(rep)
|
271
271
|
end
|
272
272
|
end
|
@@ -288,7 +288,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
288
288
|
with_site(name: 'foo') do |site|
|
289
289
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
290
290
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
291
|
-
assert_equal ::Nanoc::OutdatednessReasons::ConfigurationModified,
|
291
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::ConfigurationModified,
|
292
292
|
outdatedness_checker.outdatedness_reason_for(rep)
|
293
293
|
end
|
294
294
|
end
|
@@ -331,7 +331,7 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
331
331
|
|
332
332
|
# Compile once
|
333
333
|
FileUtils.cd('foo') do
|
334
|
-
site = Nanoc::Site.new('.')
|
334
|
+
site = Nanoc::Int::Site.new('.')
|
335
335
|
site.compile
|
336
336
|
end
|
337
337
|
|
@@ -349,10 +349,10 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
349
349
|
|
350
350
|
# Check
|
351
351
|
FileUtils.cd('foo') do
|
352
|
-
site = Nanoc::Site.new('.')
|
352
|
+
site = Nanoc::Int::Site.new('.')
|
353
353
|
outdatedness_checker = site.compiler.send :outdatedness_checker
|
354
354
|
rep = site.items.find { |i| i.identifier == '/' }.reps[0]
|
355
|
-
assert_equal ::Nanoc::OutdatednessReasons::RulesModified,
|
355
|
+
assert_equal ::Nanoc::Int::OutdatednessReasons::RulesModified,
|
356
356
|
outdatedness_checker.outdatedness_reason_for(rep)
|
357
357
|
end
|
358
358
|
end
|
@@ -374,13 +374,13 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
374
374
|
|
375
375
|
# Compile
|
376
376
|
FileUtils.cd('foo') do
|
377
|
-
site = Nanoc::Site.new('.')
|
377
|
+
site = Nanoc::Int::Site.new('.')
|
378
378
|
site.compile
|
379
379
|
end
|
380
380
|
|
381
381
|
# Assert not outdated
|
382
382
|
FileUtils.cd('foo') do
|
383
|
-
site = Nanoc::Site.new('.')
|
383
|
+
site = Nanoc::Int::Site.new('.')
|
384
384
|
outdatedness_checker = site.compiler.outdatedness_checker
|
385
385
|
site.items.each do |item|
|
386
386
|
refute outdatedness_checker.outdated?(item), 'item should not be outdated'
|
@@ -407,13 +407,13 @@ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
|
|
407
407
|
|
408
408
|
# Compile
|
409
409
|
FileUtils.cd('foo') do
|
410
|
-
site = Nanoc::Site.new('.')
|
410
|
+
site = Nanoc::Int::Site.new('.')
|
411
411
|
site.compile
|
412
412
|
end
|
413
413
|
|
414
414
|
# Assert not outdated
|
415
415
|
FileUtils.cd('foo') do
|
416
|
-
site = Nanoc::Site.new('.')
|
416
|
+
site = Nanoc::Int::Site.new('.')
|
417
417
|
outdatedness_checker = site.compiler.outdatedness_checker
|
418
418
|
site.items.each do |item|
|
419
419
|
refute outdatedness_checker.outdated?(item), 'item should not be outdated'
|
data/test/base/test_plugin.rb
CHANGED
@@ -18,7 +18,7 @@ class Nanoc::PluginTest < Nanoc::TestCase
|
|
18
18
|
def test_register
|
19
19
|
SampleFilter.send(:identifier, :_plugin_test_sample_filter)
|
20
20
|
|
21
|
-
registry = Nanoc::PluginRegistry.instance
|
21
|
+
registry = Nanoc::Int::PluginRegistry.instance
|
22
22
|
filter = registry.find(Nanoc::Filter, :_plugin_test_sample_filter)
|
23
23
|
|
24
24
|
refute_nil filter
|
data/test/base/test_rule.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::RuleTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::RuleTest < Nanoc::TestCase
|
4
4
|
def test_initialize
|
5
5
|
# TODO: implement
|
6
6
|
end
|
@@ -18,7 +18,7 @@ class Nanoc::RuleTest < Nanoc::TestCase
|
|
18
18
|
identifier = '/anything/else/'
|
19
19
|
expected = ['anything', 'else']
|
20
20
|
|
21
|
-
rule = Nanoc::Rule.new(regexp, :string, Proc.new {})
|
21
|
+
rule = Nanoc::Int::Rule.new(regexp, :string, Proc.new {})
|
22
22
|
|
23
23
|
assert_equal expected, rule.send(:matches, identifier)
|
24
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::RuleContextTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::RuleContextTest < Nanoc::TestCase
|
4
4
|
def test_objects
|
5
5
|
# Mock everything
|
6
6
|
config = mock
|
@@ -14,10 +14,10 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
|
|
14
14
|
item.stubs(:site).returns(site)
|
15
15
|
rep = mock
|
16
16
|
rep.stubs(:item).returns(item)
|
17
|
-
compiler = Nanoc::Compiler.new(site)
|
17
|
+
compiler = Nanoc::Int::Compiler.new(site)
|
18
18
|
|
19
19
|
# Create context
|
20
|
-
@rule_context = Nanoc::RuleContext.new(rep: rep, compiler: compiler)
|
20
|
+
@rule_context = Nanoc::Int::RuleContext.new(rep: rep, compiler: compiler)
|
21
21
|
|
22
22
|
# Check
|
23
23
|
assert_equal rep, @rule_context.rep
|
@@ -48,10 +48,10 @@ class Nanoc::RuleContextTest < Nanoc::TestCase
|
|
48
48
|
rep.expects(:snapshot).with('awesome')
|
49
49
|
|
50
50
|
# Mock compiler
|
51
|
-
compiler = Nanoc::Compiler.new(site)
|
51
|
+
compiler = Nanoc::Int::Compiler.new(site)
|
52
52
|
|
53
53
|
# Create context
|
54
|
-
@rule_context = Nanoc::RuleContext.new(rep: rep, compiler: compiler)
|
54
|
+
@rule_context = Nanoc::Int::RuleContext.new(rep: rep, compiler: compiler)
|
55
55
|
|
56
56
|
# Check
|
57
57
|
rep.filter :foo, bar: 'baz'
|
data/test/base/test_site.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::SiteTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::SiteTest < Nanoc::TestCase
|
4
4
|
def test_initialize_with_dir_without_config_yaml
|
5
|
-
assert_raises(Nanoc::Errors::GenericTrivial) do
|
6
|
-
Nanoc::Site.new('.')
|
5
|
+
assert_raises(Nanoc::Int::Errors::GenericTrivial) do
|
6
|
+
Nanoc::Int::Site.new('.')
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_initialize_with_dir_with_config_yaml
|
11
11
|
File.open('config.yaml', 'w') { |io| io.write('output_dir: public_html') }
|
12
|
-
site = Nanoc::Site.new('.')
|
12
|
+
site = Nanoc::Int::Site.new('.')
|
13
13
|
assert_equal 'public_html', site.config[:output_dir]
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_initialize_with_dir_with_nanoc_yaml
|
17
17
|
File.open('nanoc.yaml', 'w') { |io| io.write('output_dir: public_html') }
|
18
|
-
site = Nanoc::Site.new('.')
|
18
|
+
site = Nanoc::Int::Site.new('.')
|
19
19
|
assert_equal 'public_html', site.config[:output_dir]
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_initialize_with_config_hash
|
23
|
-
site = Nanoc::Site.new(foo: 'bar')
|
23
|
+
site = Nanoc::Int::Site.new(foo: 'bar')
|
24
24
|
assert_equal 'bar', site.config[:foo]
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_initialize_with_incomplete_data_source_config
|
28
|
-
site = Nanoc::Site.new(data_sources: [{ type: 'foo', items_root: '/bar/' }])
|
28
|
+
site = Nanoc::Int::Site.new(data_sources: [{ type: 'foo', items_root: '/bar/' }])
|
29
29
|
assert_equal('foo', site.config[:data_sources][0][:type])
|
30
30
|
assert_equal('/bar/', site.config[:data_sources][0][:items_root])
|
31
31
|
assert_equal('/', site.config[:data_sources][0][:layouts_root])
|
@@ -58,7 +58,7 @@ EOF
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
site = Nanoc::Site.new('.')
|
61
|
+
site = Nanoc::Int::Site.new('.')
|
62
62
|
assert_nil site.config[:parent_config_file]
|
63
63
|
assert site.config[:enable_output_diff]
|
64
64
|
assert_equal 'bar', site.config[:foo]
|
@@ -72,8 +72,8 @@ parent_config_file: foo/foo.yaml
|
|
72
72
|
EOF
|
73
73
|
end
|
74
74
|
|
75
|
-
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
76
|
-
Nanoc::Site.new('.')
|
75
|
+
error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
|
76
|
+
Nanoc::Int::Site.new('.')
|
77
77
|
end
|
78
78
|
assert_equal(
|
79
79
|
"Could not find parent configuration file 'foo/foo.yaml'",
|
@@ -96,8 +96,8 @@ EOF
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
error = assert_raises(Nanoc::Errors::GenericTrivial) do
|
100
|
-
Nanoc::Site.new('.')
|
99
|
+
error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
|
100
|
+
Nanoc::Int::Site.new('.')
|
101
101
|
end
|
102
102
|
assert_equal(
|
103
103
|
"Cycle detected. Could not use parent configuration file '../nanoc.yaml'",
|
@@ -113,7 +113,7 @@ EOF
|
|
113
113
|
dsl.expects(:compile).with('*')
|
114
114
|
|
115
115
|
# Create site
|
116
|
-
site = Nanoc::Site.new({})
|
116
|
+
site = Nanoc::Int::Site.new({})
|
117
117
|
site.compiler.rules_collection.stubs(:dsl).returns(dsl)
|
118
118
|
|
119
119
|
# Create rules file
|
@@ -138,7 +138,7 @@ EOF
|
|
138
138
|
File.open('lib/some_data_source.rb', 'w') do |io|
|
139
139
|
io.write "class FooDataSource < Nanoc::DataSource\n"
|
140
140
|
io.write " identifier :site_test_foo\n"
|
141
|
-
io.write " def items ; [ Nanoc::Item.new('content', {}, '/foo/') ] ; end\n"
|
141
|
+
io.write " def items ; [ Nanoc::Int::Item.new('content', {}, '/foo/') ] ; end\n"
|
142
142
|
io.write "end\n"
|
143
143
|
end
|
144
144
|
|
@@ -149,24 +149,48 @@ EOF
|
|
149
149
|
end
|
150
150
|
|
151
151
|
# Create site
|
152
|
-
site = Nanoc::Site.new('.')
|
153
|
-
site.
|
152
|
+
site = Nanoc::Int::Site.new('.')
|
153
|
+
site.load
|
154
154
|
|
155
155
|
# Check
|
156
156
|
assert_equal 1, site.data_sources.size
|
157
|
-
assert_equal '/foo/', site.items[0].identifier
|
157
|
+
assert_equal Nanoc::Identifier.new('/foo/'), site.items[0].identifier
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_identifier_classes
|
162
|
+
Nanoc::CLI.run %w( create_site bar)
|
163
|
+
FileUtils.cd('bar') do
|
164
|
+
FileUtils.mkdir_p('content')
|
165
|
+
FileUtils.mkdir_p('layouts')
|
166
|
+
|
167
|
+
File.open('content/foo_bar.md', 'w') { |io| io << 'asdf' }
|
168
|
+
File.open('layouts/detail.erb', 'w') { |io| io << 'asdf' }
|
169
|
+
|
170
|
+
site = Nanoc::Int::Site.new('.')
|
171
|
+
|
172
|
+
site.items.each do |item|
|
173
|
+
assert_equal Nanoc::Identifier, item.identifier.class
|
174
|
+
end
|
175
|
+
|
176
|
+
site.layouts.each do |layout|
|
177
|
+
assert_equal Nanoc::Identifier, layout.identifier.class
|
178
|
+
end
|
158
179
|
end
|
159
180
|
end
|
160
181
|
|
161
182
|
def test_setup_child_parent_links
|
162
183
|
Nanoc::CLI.run %w( create_site bar)
|
163
184
|
FileUtils.cd('bar') do
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
185
|
+
FileUtils.mkdir_p('content/parent')
|
186
|
+
FileUtils.mkdir_p('content/parent/bar')
|
187
|
+
|
188
|
+
File.open('content/parent.md', 'w') { |io| io << 'asdf' }
|
189
|
+
File.open('content/parent/foo.md', 'w') { |io| io << 'asdf' }
|
190
|
+
File.open('content/parent/bar.md', 'w') { |io| io << 'asdf' }
|
191
|
+
File.open('content/parent/bar/qux.md', 'w') { |io| io << 'asdf' }
|
168
192
|
|
169
|
-
site = Nanoc::Site.new('.')
|
193
|
+
site = Nanoc::Int::Site.new('.')
|
170
194
|
|
171
195
|
root = site.items.find { |i| i.identifier == '/' }
|
172
196
|
style = site.items.find { |i| i.identifier == '/stylesheet/' }
|
@@ -193,8 +217,8 @@ EOF
|
|
193
217
|
FileUtils.mkdir_p('content/sam')
|
194
218
|
File.open('content/sam/index.html', 'w') { |io| io.write('I am Sam, too!') }
|
195
219
|
|
196
|
-
assert_raises(Nanoc::Errors::DuplicateIdentifier) do
|
197
|
-
site = Nanoc::Site.new('.')
|
220
|
+
assert_raises(Nanoc::Int::Errors::DuplicateIdentifier) do
|
221
|
+
site = Nanoc::Int::Site.new('.')
|
198
222
|
site.load
|
199
223
|
end
|
200
224
|
end
|
@@ -206,64 +230,64 @@ EOF
|
|
206
230
|
FileUtils.mkdir_p('layouts/sam')
|
207
231
|
File.open('layouts/sam/index.html', 'w') { |io| io.write('I am Sam, too!') }
|
208
232
|
|
209
|
-
assert_raises(Nanoc::Errors::DuplicateIdentifier) do
|
210
|
-
site = Nanoc::Site.new('.')
|
233
|
+
assert_raises(Nanoc::Int::Errors::DuplicateIdentifier) do
|
234
|
+
site = Nanoc::Int::Site.new('.')
|
211
235
|
site.load
|
212
236
|
end
|
213
237
|
end
|
214
238
|
end
|
215
239
|
end
|
216
240
|
|
217
|
-
describe 'Nanoc::Site#initialize' do
|
241
|
+
describe 'Nanoc::Int::Site#initialize' do
|
218
242
|
include Nanoc::TestHelpers
|
219
243
|
|
220
244
|
it 'should merge default config' do
|
221
|
-
site = Nanoc::Site.new(foo: 'bar')
|
245
|
+
site = Nanoc::Int::Site.new(foo: 'bar')
|
222
246
|
site.config[:foo].must_equal 'bar'
|
223
247
|
site.config[:output_dir].must_equal 'output'
|
224
248
|
end
|
225
249
|
|
226
250
|
it 'should not raise under normal circumstances' do
|
227
|
-
Nanoc::Site.new({})
|
251
|
+
Nanoc::Int::Site.new({})
|
228
252
|
end
|
229
253
|
|
230
254
|
it 'should not raise for non-existant output directory' do
|
231
|
-
Nanoc::Site.new(output_dir: 'fklsdhailfdjalghlkasdflhagjskajdf')
|
255
|
+
Nanoc::Int::Site.new(output_dir: 'fklsdhailfdjalghlkasdflhagjskajdf')
|
232
256
|
end
|
233
257
|
|
234
258
|
it 'should not raise for unknown data sources' do
|
235
259
|
proc do
|
236
|
-
Nanoc::Site.new(data_source: 'fklsdhailfdjalghlkasdflhagjskajdf')
|
260
|
+
Nanoc::Int::Site.new(data_source: 'fklsdhailfdjalghlkasdflhagjskajdf')
|
237
261
|
end
|
238
262
|
end
|
239
263
|
end
|
240
264
|
|
241
|
-
describe 'Nanoc::Site#compiler' do
|
265
|
+
describe 'Nanoc::Int::Site#compiler' do
|
242
266
|
include Nanoc::TestHelpers
|
243
267
|
|
244
268
|
it 'should not raise under normal circumstances' do
|
245
|
-
site = Nanoc::Site.new({})
|
269
|
+
site = Nanoc::Int::Site.new({})
|
246
270
|
site.compiler
|
247
271
|
end
|
248
272
|
end
|
249
273
|
|
250
|
-
describe 'Nanoc::Site#data_sources' do
|
274
|
+
describe 'Nanoc::Int::Site#data_sources' do
|
251
275
|
include Nanoc::TestHelpers
|
252
276
|
|
253
277
|
it 'should not raise for known data sources' do
|
254
|
-
site = Nanoc::Site.new({})
|
278
|
+
site = Nanoc::Int::Site.new({})
|
255
279
|
site.data_sources
|
256
280
|
end
|
257
281
|
|
258
282
|
it 'should raise for unknown data sources' do
|
259
283
|
proc do
|
260
|
-
site = Nanoc::Site.new(
|
284
|
+
site = Nanoc::Int::Site.new(
|
261
285
|
data_sources: [
|
262
286
|
{ type: 'fklsdhailfdjalghlkasdflhagjskajdf' }
|
263
287
|
]
|
264
288
|
)
|
265
289
|
site.data_sources
|
266
|
-
end.must_raise Nanoc::Errors::UnknownDataSource
|
290
|
+
end.must_raise Nanoc::Int::Errors::UnknownDataSource
|
267
291
|
end
|
268
292
|
|
269
293
|
it 'should also use the toplevel config for data sources' do
|
@@ -277,7 +301,7 @@ describe 'Nanoc::Site#data_sources' do
|
|
277
301
|
io.write " bbb: two\n"
|
278
302
|
end
|
279
303
|
|
280
|
-
site = Nanoc::Site.new('.')
|
304
|
+
site = Nanoc::Int::Site.new('.')
|
281
305
|
data_sources = site.data_sources
|
282
306
|
|
283
307
|
assert data_sources.first.config[:aaa] = 'one'
|