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
data/test/base/test_context.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::ContextTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::ContextTest < Nanoc::TestCase
|
4
4
|
def test_context_with_instance_variable
|
5
5
|
# Create context
|
6
|
-
context = Nanoc::Context.new({ foo: 'bar', baz: 'quux' })
|
6
|
+
context = Nanoc::Int::Context.new({ foo: 'bar', baz: 'quux' })
|
7
7
|
|
8
8
|
# Ensure correct evaluation
|
9
9
|
assert_equal('bar', eval('@foo', context.get_binding))
|
@@ -11,7 +11,7 @@ class Nanoc::ContextTest < Nanoc::TestCase
|
|
11
11
|
|
12
12
|
def test_context_with_instance_method
|
13
13
|
# Create context
|
14
|
-
context = Nanoc::Context.new({ foo: 'bar', baz: 'quux' })
|
14
|
+
context = Nanoc::Int::Context.new({ foo: 'bar', baz: 'quux' })
|
15
15
|
|
16
16
|
# Ensure correct evaluation
|
17
17
|
assert_equal('bar', eval('foo', context.get_binding))
|
@@ -22,6 +22,6 @@ class Nanoc::ContextTest < Nanoc::TestCase
|
|
22
22
|
YARD.parse(LIB_DIR + '/nanoc/base/context.rb')
|
23
23
|
|
24
24
|
# Run
|
25
|
-
assert_examples_correct 'Nanoc::Context#initialize'
|
25
|
+
assert_examples_correct 'Nanoc::Int::Context#initialize'
|
26
26
|
end
|
27
27
|
end
|
@@ -26,17 +26,27 @@ class Nanoc::DataSourceTest < Nanoc::TestCase
|
|
26
26
|
# Test optional methods
|
27
27
|
data_source.up
|
28
28
|
data_source.down
|
29
|
-
data_source.update
|
30
|
-
|
31
|
-
# Test required methods - general
|
32
|
-
assert_raises(NotImplementedError) { data_source.setup }
|
33
29
|
|
34
30
|
# Test methods - loading data
|
35
31
|
assert_equal [], data_source.items
|
36
32
|
assert_equal [], data_source.layouts
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_new_item
|
36
|
+
data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
|
37
|
+
|
38
|
+
item = data_source.new_item('stuff', { title: 'Stuff!' }, '/asdf/')
|
39
|
+
assert_equal 'stuff', item.raw_content
|
40
|
+
assert_equal 'Stuff!', item.attributes[:title]
|
41
|
+
assert_equal Nanoc::Identifier.new('/asdf/'), item.identifier
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_new_layout
|
45
|
+
data_source = Nanoc::DataSource.new(nil, nil, nil, nil)
|
37
46
|
|
38
|
-
|
39
|
-
|
40
|
-
|
47
|
+
layout = data_source.new_layout('stuff', { title: 'Stuff!' }, '/asdf/')
|
48
|
+
assert_equal 'stuff', layout.raw_content
|
49
|
+
assert_equal 'Stuff!', layout.attributes[:title]
|
50
|
+
assert_equal Nanoc::Identifier.new('/asdf/'), layout.identifier
|
41
51
|
end
|
42
52
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
|
4
4
|
def test_initialize
|
5
5
|
# Mock items
|
6
6
|
items = [mock, mock]
|
7
7
|
|
8
8
|
# Create
|
9
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
9
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
10
10
|
|
11
11
|
# Verify no dependencies yet
|
12
12
|
assert_empty tracker.objects_causing_outdatedness_of(items[0])
|
@@ -18,7 +18,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
18
18
|
items = [mock, mock]
|
19
19
|
|
20
20
|
# Create
|
21
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
21
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
22
22
|
|
23
23
|
# Record some dependencies
|
24
24
|
tracker.record_dependency(items[0], items[1])
|
@@ -32,7 +32,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
32
32
|
items = [mock, mock]
|
33
33
|
|
34
34
|
# Create
|
35
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
35
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
36
36
|
|
37
37
|
# Record some dependencies
|
38
38
|
tracker.record_dependency(items[0], items[0])
|
@@ -47,7 +47,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
47
47
|
items = [mock, mock]
|
48
48
|
|
49
49
|
# Create
|
50
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
50
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
51
51
|
|
52
52
|
# Record some dependencies
|
53
53
|
tracker.record_dependency(items[0], items[1])
|
@@ -63,7 +63,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
63
63
|
items = [mock, mock, mock]
|
64
64
|
|
65
65
|
# Create
|
66
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
66
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
67
67
|
|
68
68
|
# Record some dependencies
|
69
69
|
tracker.record_dependency(items[0], items[1])
|
@@ -78,7 +78,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
78
78
|
items = [mock, mock, mock]
|
79
79
|
|
80
80
|
# Create
|
81
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
81
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
82
82
|
|
83
83
|
# Record some dependencies
|
84
84
|
tracker.record_dependency(items[0], items[1])
|
@@ -93,14 +93,14 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
93
93
|
items = [mock, mock]
|
94
94
|
|
95
95
|
# Create
|
96
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
96
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
97
97
|
|
98
98
|
# Start, do something and stop
|
99
99
|
tracker.start
|
100
|
-
Nanoc::NotificationCenter.post(:visit_started, items[0])
|
101
|
-
Nanoc::NotificationCenter.post(:visit_started, items[1])
|
102
|
-
Nanoc::NotificationCenter.post(:visit_ended, items[1])
|
103
|
-
Nanoc::NotificationCenter.post(:visit_ended, items[0])
|
100
|
+
Nanoc::Int::NotificationCenter.post(:visit_started, items[0])
|
101
|
+
Nanoc::Int::NotificationCenter.post(:visit_started, items[1])
|
102
|
+
Nanoc::Int::NotificationCenter.post(:visit_ended, items[1])
|
103
|
+
Nanoc::Int::NotificationCenter.post(:visit_ended, items[0])
|
104
104
|
tracker.stop
|
105
105
|
|
106
106
|
# Verify dependencies
|
@@ -118,7 +118,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
118
118
|
items[3].stubs(:reference).returns([:item, '/ddd/'])
|
119
119
|
|
120
120
|
# Create
|
121
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
121
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
122
122
|
|
123
123
|
# Record some dependencies
|
124
124
|
tracker.record_dependency(items[0], items[1])
|
@@ -126,14 +126,14 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
126
126
|
tracker.record_dependency(items[1], items[3])
|
127
127
|
|
128
128
|
# Store
|
129
|
-
tracker.
|
129
|
+
tracker.store
|
130
130
|
assert File.file?(tracker.filename)
|
131
131
|
|
132
132
|
# Re-create
|
133
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
133
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
134
134
|
|
135
135
|
# Load
|
136
|
-
tracker.
|
136
|
+
tracker.load
|
137
137
|
|
138
138
|
# Check loaded graph
|
139
139
|
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
|
@@ -156,7 +156,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
156
156
|
new_items = [items[0], items[1], items[2]]
|
157
157
|
|
158
158
|
# Create
|
159
|
-
tracker = Nanoc::DependencyTracker.new(old_items)
|
159
|
+
tracker = Nanoc::Int::DependencyTracker.new(old_items)
|
160
160
|
|
161
161
|
# Record some dependencies
|
162
162
|
tracker.record_dependency(old_items[0], old_items[1])
|
@@ -164,14 +164,14 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
164
164
|
tracker.record_dependency(old_items[1], old_items[3])
|
165
165
|
|
166
166
|
# Store
|
167
|
-
tracker.
|
167
|
+
tracker.store
|
168
168
|
assert File.file?(tracker.filename)
|
169
169
|
|
170
170
|
# Re-create
|
171
|
-
tracker = Nanoc::DependencyTracker.new(new_items)
|
171
|
+
tracker = Nanoc::Int::DependencyTracker.new(new_items)
|
172
172
|
|
173
173
|
# Load
|
174
|
-
tracker.
|
174
|
+
tracker.load
|
175
175
|
|
176
176
|
# Check loaded graph
|
177
177
|
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
|
@@ -188,21 +188,21 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
188
188
|
items[2].stubs(:reference).returns([:item, '/ccc/'])
|
189
189
|
|
190
190
|
# Create
|
191
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
191
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
192
192
|
|
193
193
|
# Record some dependencies
|
194
194
|
tracker.record_dependency(items[0], items[1])
|
195
195
|
tracker.record_dependency(items[1], nil)
|
196
196
|
|
197
197
|
# Store
|
198
|
-
tracker.
|
198
|
+
tracker.store
|
199
199
|
assert File.file?(tracker.filename)
|
200
200
|
|
201
201
|
# Re-create
|
202
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
202
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
203
203
|
|
204
204
|
# Load
|
205
|
-
tracker.
|
205
|
+
tracker.load
|
206
206
|
|
207
207
|
# Check loaded graph
|
208
208
|
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
|
@@ -218,21 +218,21 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
218
218
|
items[2].stubs(:reference).returns([:item, '/ccc/'])
|
219
219
|
|
220
220
|
# Create
|
221
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
221
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
222
222
|
|
223
223
|
# Record some dependencies
|
224
224
|
tracker.record_dependency(items[0], items[1])
|
225
225
|
tracker.record_dependency(nil, items[2])
|
226
226
|
|
227
227
|
# Store
|
228
|
-
tracker.
|
228
|
+
tracker.store
|
229
229
|
assert File.file?(tracker.filename)
|
230
230
|
|
231
231
|
# Re-create
|
232
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
232
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
233
233
|
|
234
234
|
# Load
|
235
|
-
tracker.
|
235
|
+
tracker.load
|
236
236
|
|
237
237
|
# Check loaded graph
|
238
238
|
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
|
@@ -244,7 +244,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
|
|
244
244
|
items = [mock, mock, mock]
|
245
245
|
|
246
246
|
# Create
|
247
|
-
tracker = Nanoc::DependencyTracker.new(items)
|
247
|
+
tracker = Nanoc::Int::DependencyTracker.new(items)
|
248
248
|
|
249
249
|
# Record some dependencies
|
250
250
|
tracker.record_dependency(items[0], items[1])
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
3
|
+
class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
|
4
4
|
def test_direct_predecessors
|
5
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
5
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
6
6
|
graph.add_edge(1, 2)
|
7
7
|
graph.add_edge(2, 3)
|
8
8
|
|
@@ -12,7 +12,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_predecessors
|
15
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
15
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
16
16
|
graph.add_edge(1, 2)
|
17
17
|
graph.add_edge(2, 3)
|
18
18
|
|
@@ -22,7 +22,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_direct_successors
|
25
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
25
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
26
26
|
graph.add_edge(1, 2)
|
27
27
|
graph.add_edge(2, 3)
|
28
28
|
|
@@ -32,7 +32,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_successors
|
35
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
35
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
36
36
|
graph.add_edge(1, 2)
|
37
37
|
graph.add_edge(2, 3)
|
38
38
|
|
@@ -42,7 +42,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_edges
|
45
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
45
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
46
46
|
graph.add_edge(1, 2)
|
47
47
|
graph.add_edge(2, 3)
|
48
48
|
|
@@ -50,7 +50,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_edges_with_new_vertices
|
53
|
-
graph = Nanoc::DirectedGraph.new([1])
|
53
|
+
graph = Nanoc::Int::DirectedGraph.new([1])
|
54
54
|
assert_equal [1], graph.vertices
|
55
55
|
graph.add_edge(1, 2)
|
56
56
|
assert_equal [1, 2], graph.vertices
|
@@ -61,7 +61,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def test_add_edge
|
64
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
64
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
65
65
|
|
66
66
|
assert_equal [], graph.successors_of(1)
|
67
67
|
assert_equal [], graph.predecessors_of(2)
|
@@ -73,7 +73,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def test_add_edge_with_new_vertices
|
76
|
-
graph = Nanoc::DirectedGraph.new([1])
|
76
|
+
graph = Nanoc::Int::DirectedGraph.new([1])
|
77
77
|
graph.add_edge(1, 2)
|
78
78
|
graph.add_edge(3, 2)
|
79
79
|
|
@@ -82,7 +82,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def test_delete_edge
|
85
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
85
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
86
86
|
graph.add_edge(1, 2)
|
87
87
|
|
88
88
|
assert_equal [2], graph.successors_of(1)
|
@@ -95,7 +95,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_delete_edges_from
|
98
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
98
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
99
99
|
|
100
100
|
graph.add_edge(1, 2)
|
101
101
|
graph.add_edge(2, 1)
|
@@ -134,7 +134,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def test_delete_edges_to
|
137
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
137
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
138
138
|
|
139
139
|
graph.add_edge(1, 2)
|
140
140
|
graph.add_edge(2, 1)
|
@@ -173,7 +173,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def test_delete_vertex
|
176
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
176
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
177
177
|
|
178
178
|
graph.add_edge(1, 2)
|
179
179
|
graph.add_edge(2, 1)
|
@@ -192,7 +192,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
192
192
|
end
|
193
193
|
|
194
194
|
def test_delete_vertex_resulting_roots
|
195
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
195
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
196
196
|
assert_equal Set.new([1, 2, 3]), graph.roots
|
197
197
|
|
198
198
|
graph.add_edge(1, 2)
|
@@ -204,7 +204,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
204
204
|
end
|
205
205
|
|
206
206
|
def test_should_return_empty_array_for_nonexistant_vertices
|
207
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
207
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
208
208
|
|
209
209
|
assert_equal [], graph.direct_predecessors_of(4)
|
210
210
|
assert_equal [], graph.predecessors_of(4)
|
@@ -213,30 +213,30 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
213
213
|
end
|
214
214
|
|
215
215
|
def test_roots_after_init
|
216
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
216
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
217
217
|
|
218
218
|
assert_equal Set.new([1, 2, 3]), graph.roots
|
219
219
|
end
|
220
220
|
|
221
221
|
def test_roots_after_adding_edge
|
222
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
222
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
223
223
|
graph.add_edge(1, 2)
|
224
224
|
assert_equal Set.new([1, 3]), graph.roots
|
225
225
|
|
226
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
226
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
227
227
|
graph.add_edge(1, 3)
|
228
228
|
assert_equal Set.new([1, 2]), graph.roots
|
229
229
|
|
230
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
230
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
231
231
|
graph.add_edge(2, 1)
|
232
232
|
assert_equal Set.new([2, 3]), graph.roots
|
233
233
|
|
234
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
234
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
235
235
|
graph.add_edge(1, 2)
|
236
236
|
graph.add_edge(2, 3)
|
237
237
|
assert_equal Set.new([1]), graph.roots
|
238
238
|
|
239
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
239
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
240
240
|
graph.add_edge(1, 2)
|
241
241
|
graph.add_edge(2, 3)
|
242
242
|
graph.add_edge(3, 1)
|
@@ -244,23 +244,23 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
244
244
|
end
|
245
245
|
|
246
246
|
def test_roots_after_removing_edge
|
247
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
247
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
248
248
|
graph.add_edge(1, 2)
|
249
249
|
graph.delete_edge(1, 2)
|
250
250
|
assert_equal Set.new([1, 2, 3]), graph.roots
|
251
251
|
|
252
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
252
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
253
253
|
graph.add_edge(1, 3)
|
254
254
|
assert_equal Set.new([1, 2]), graph.roots
|
255
255
|
graph.delete_edge(1, 2) # no such edge
|
256
256
|
assert_equal Set.new([1, 2]), graph.roots
|
257
257
|
|
258
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
258
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
259
259
|
graph.add_edge(2, 1)
|
260
260
|
graph.delete_edge(2, 1)
|
261
261
|
assert_equal Set.new([1, 2, 3]), graph.roots
|
262
262
|
|
263
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
263
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
264
264
|
graph.add_edge(1, 2)
|
265
265
|
graph.add_edge(2, 3)
|
266
266
|
graph.delete_edge(1, 2)
|
@@ -268,7 +268,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
268
268
|
graph.delete_edge(2, 3)
|
269
269
|
assert_equal Set.new([1, 2, 3]), graph.roots
|
270
270
|
|
271
|
-
graph = Nanoc::DirectedGraph.new([1, 2, 3])
|
271
|
+
graph = Nanoc::Int::DirectedGraph.new([1, 2, 3])
|
272
272
|
graph.add_edge(1, 2)
|
273
273
|
graph.add_edge(2, 3)
|
274
274
|
graph.add_edge(3, 1)
|
@@ -282,6 +282,6 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
|
|
282
282
|
|
283
283
|
def test_example
|
284
284
|
YARD.parse(LIB_DIR + '/nanoc/base/directed_graph.rb')
|
285
|
-
assert_examples_correct 'Nanoc::DirectedGraph'
|
285
|
+
assert_examples_correct 'Nanoc::Int::DirectedGraph'
|
286
286
|
end
|
287
287
|
end
|