nanoc 4.8.11 → 4.8.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/NEWS.md +10 -0
- data/README.md +1 -0
- data/lib/nanoc/base/entities/pattern.rb +2 -0
- data/lib/nanoc/base/entities/site.rb +1 -1
- data/lib/nanoc/base/repos/action_sequence_store.rb +4 -1
- data/lib/nanoc/base/repos/compiled_content_cache.rb +2 -2
- data/lib/nanoc/base/services/compiler.rb +4 -1
- data/lib/nanoc/base/services/compiler/stages/cleanup.rb +3 -3
- data/lib/nanoc/filters/colorize_syntax/colorizers.rb +2 -3
- data/lib/nanoc/filters/pandoc.rb +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/nanoc.manifest +4 -6
- data/spec/gem_spec.rb +21 -0
- data/spec/manifest_spec.rb +2 -2
- data/spec/nanoc/base/compiler_spec.rb +7 -2
- data/spec/nanoc/base/entities/pattern_spec.rb +6 -0
- data/spec/nanoc/base/repos/compiled_content_cache_spec.rb +9 -1
- data/spec/nanoc/base/repos/dependency_store_spec.rb +116 -9
- data/spec/nanoc/base/repos/store_spec.rb +34 -0
- data/spec/nanoc/base/services/compiler/phases/cache_spec.rb +9 -1
- data/spec/nanoc/base/services/compiler/stages/cleanup_spec.rb +1 -1
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +1 -1
- data/spec/nanoc/base/services/notification_center_spec.rb +25 -0
- data/spec/nanoc/base/services/outdatedness_checker_spec.rb +3 -3
- data/spec/nanoc/base/services/outdatedness_rules_spec.rb +2 -2
- data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +10 -2
- data/spec/nanoc/filters/colorize_syntax/rouge_spec.rb +66 -108
- data/spec/nanoc/regressions/gh_1248_spec.rb +24 -0
- data/spec/nanoc/rule_dsl/rule_spec.rb +111 -0
- data/spec/spec_helper.rb +0 -6
- data/test/base/test_compiler.rb +0 -54
- data/test/filters/test_pandoc.rb +2 -2
- data/test/helper.rb +0 -36
- metadata +7 -9
- data/Appraisals +0 -13
- data/test/base/test_dependency_tracker.rb +0 -265
- data/test/base/test_notification_center.rb +0 -32
- data/test/base/test_store.rb +0 -39
- data/test/rule_dsl/test_rule.rb +0 -27
- data/test/test_gem.rb +0 -30
data/spec/spec_helper.rb
CHANGED
@@ -73,12 +73,6 @@ RSpec.configure do |c|
|
|
73
73
|
|
74
74
|
File.write('Rules', 'passthrough "/**/*"')
|
75
75
|
end
|
76
|
-
|
77
|
-
# Set focus if any
|
78
|
-
if ENV.fetch('FOCUS', false)
|
79
|
-
$stdout.puts "Focusing spec on '#{ENV['FOCUS']}'"
|
80
|
-
c.filter_run_including ENV['FOCUS'].to_sym => true
|
81
|
-
end
|
82
76
|
end
|
83
77
|
|
84
78
|
RSpec::Matchers.define_negated_matcher :not_match, :match
|
data/test/base/test_compiler.rb
CHANGED
@@ -149,60 +149,6 @@ class Nanoc::Int::CompilerTest < Nanoc::TestCase
|
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
def test_disallow_duplicate_routes
|
153
|
-
# Create site
|
154
|
-
Nanoc::CLI.run %w[create_site bar]
|
155
|
-
|
156
|
-
FileUtils.cd('bar') do
|
157
|
-
# Create routes
|
158
|
-
File.open('Rules', 'w') do |io|
|
159
|
-
io.write "compile '/**/*' do\n"
|
160
|
-
io.write "end\n"
|
161
|
-
io.write "\n"
|
162
|
-
io.write "route '/**/*' do\n"
|
163
|
-
io.write " '/index.html'\n"
|
164
|
-
io.write "end\n"
|
165
|
-
end
|
166
|
-
|
167
|
-
# Create files
|
168
|
-
File.write('content/foo.html', 'asdf')
|
169
|
-
File.write('content/bar.html', 'asdf')
|
170
|
-
|
171
|
-
# Create site
|
172
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
173
|
-
assert_raises(Nanoc::Int::ItemRepRouter::IdenticalRoutesError) do
|
174
|
-
site.compile
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_disallow_multiple_snapshots_with_the_same_name
|
180
|
-
# Create site
|
181
|
-
Nanoc::CLI.run %w[create_site bar]
|
182
|
-
|
183
|
-
FileUtils.cd('bar') do
|
184
|
-
# Create routes
|
185
|
-
File.open('Rules', 'w') do |io|
|
186
|
-
io.write "compile '/**/*' do\n"
|
187
|
-
io.write " snapshot :aaa\n"
|
188
|
-
io.write " snapshot :aaa\n"
|
189
|
-
io.write "end\n"
|
190
|
-
io.write "\n"
|
191
|
-
io.write "route '/**/*' do\n"
|
192
|
-
io.write " item.identifier.to_s\n"
|
193
|
-
io.write "end\n"
|
194
|
-
io.write "\n"
|
195
|
-
io.write "layout '/**/*', :erb\n"
|
196
|
-
end
|
197
|
-
|
198
|
-
# Compile
|
199
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
200
|
-
assert_raises Nanoc::Int::Errors::CannotCreateMultipleSnapshotsWithSameName do
|
201
|
-
site.compile
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
152
|
def test_include_compiled_content_of_active_item_at_previous_snapshot
|
207
153
|
with_site do |_site|
|
208
154
|
# Create item
|
data/test/filters/test_pandoc.rb
CHANGED
@@ -38,9 +38,9 @@ class Nanoc::Filters::PandocTest < Nanoc::TestCase
|
|
38
38
|
filter = ::Nanoc::Filters::Pandoc.new
|
39
39
|
|
40
40
|
# Run filter
|
41
|
-
args = [:s, { f: :markdown, to: :html }, '
|
41
|
+
args = [:s, { f: :markdown, to: :html }, 'wrap=none', :toc]
|
42
42
|
result = filter.setup_and_run("# Heading\n", args: args)
|
43
|
-
assert_match '<
|
43
|
+
assert_match '<nav id="TOC">', result
|
44
44
|
assert_match(%r{<h1 id=\"heading\">Heading</h1>\s*}, result)
|
45
45
|
end
|
46
46
|
end
|
data/test/helper.rb
CHANGED
@@ -49,13 +49,6 @@ module Nanoc::TestHelpers
|
|
49
49
|
yield
|
50
50
|
end
|
51
51
|
|
52
|
-
def if_implemented
|
53
|
-
yield
|
54
|
-
rescue NotImplementedError, NameError
|
55
|
-
skip $ERROR_INFO
|
56
|
-
return
|
57
|
-
end
|
58
|
-
|
59
52
|
def with_site(params = {})
|
60
53
|
# Build site name
|
61
54
|
site_name = params[:name]
|
@@ -122,13 +115,6 @@ EOS
|
|
122
115
|
end
|
123
116
|
|
124
117
|
def setup
|
125
|
-
# Check skipped
|
126
|
-
if ENV['skip']
|
127
|
-
if ENV['skip'].split(',').include?(self.class.to_s)
|
128
|
-
skip 'manually skipped'
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
118
|
# Clean up
|
133
119
|
GC.start
|
134
120
|
|
@@ -215,28 +201,6 @@ EOS
|
|
215
201
|
end
|
216
202
|
end
|
217
203
|
|
218
|
-
def assert_contains_exactly(expected, actual)
|
219
|
-
assert_equal(
|
220
|
-
expected.size,
|
221
|
-
actual.size,
|
222
|
-
format('Expected %s to be of same size as %s', actual.inspect, expected.inspect),
|
223
|
-
)
|
224
|
-
remaining = actual.dup.to_a
|
225
|
-
expected.each do |e|
|
226
|
-
index = remaining.index(e)
|
227
|
-
remaining.delete_at(index) if index
|
228
|
-
end
|
229
|
-
assert(
|
230
|
-
remaining.empty?,
|
231
|
-
format('Expected %s to contain all the elements of %s', actual.inspect, expected.inspect),
|
232
|
-
)
|
233
|
-
end
|
234
|
-
|
235
|
-
def assert_raises_frozen_error
|
236
|
-
error = assert_raises(RuntimeError, TypeError) { yield }
|
237
|
-
assert_match(/(^can't modify frozen |^unable to modify frozen object$)/, error.message)
|
238
|
-
end
|
239
|
-
|
240
204
|
def with_env_vars(hash, &_block)
|
241
205
|
orig_env_hash = ENV.to_hash
|
242
206
|
hash.each_pair { |k, v| ENV[k] = v }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.
|
4
|
+
version: 4.8.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -123,7 +123,6 @@ extra_rdoc_files:
|
|
123
123
|
files:
|
124
124
|
- ".rspec"
|
125
125
|
- ".rubocop.yml"
|
126
|
-
- Appraisals
|
127
126
|
- CODE_OF_CONDUCT.md
|
128
127
|
- LICENSE
|
129
128
|
- NEWS.md
|
@@ -390,6 +389,7 @@ files:
|
|
390
389
|
- nanoc.gemspec
|
391
390
|
- nanoc.manifest
|
392
391
|
- spec/contributors_spec.rb
|
392
|
+
- spec/gem_spec.rb
|
393
393
|
- spec/manifest_spec.rb
|
394
394
|
- spec/nanoc/base/changes_stream_spec.rb
|
395
395
|
- spec/nanoc/base/checksummer_spec.rb
|
@@ -446,6 +446,7 @@ files:
|
|
446
446
|
- spec/nanoc/base/services/executor_spec.rb
|
447
447
|
- spec/nanoc/base/services/item_rep_router_spec.rb
|
448
448
|
- spec/nanoc/base/services/item_rep_selector_spec.rb
|
449
|
+
- spec/nanoc/base/services/notification_center_spec.rb
|
449
450
|
- spec/nanoc/base/services/outdatedness_checker_spec.rb
|
450
451
|
- spec/nanoc/base/services/outdatedness_rules_spec.rb
|
451
452
|
- spec/nanoc/base/services/pruner_spec.rb
|
@@ -539,6 +540,7 @@ files:
|
|
539
540
|
- spec/nanoc/regressions/gh_1171_spec.rb
|
540
541
|
- spec/nanoc/regressions/gh_1185_spec.rb
|
541
542
|
- spec/nanoc/regressions/gh_1216_spec.rb
|
543
|
+
- spec/nanoc/regressions/gh_1248_spec.rb
|
542
544
|
- spec/nanoc/regressions/gh_761_spec.rb
|
543
545
|
- spec/nanoc/regressions/gh_767_spec.rb
|
544
546
|
- spec/nanoc/regressions/gh_769_spec.rb
|
@@ -573,6 +575,7 @@ files:
|
|
573
575
|
- spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb
|
574
576
|
- spec/nanoc/rule_dsl/recording_executor_spec.rb
|
575
577
|
- spec/nanoc/rule_dsl/rule_context_spec.rb
|
578
|
+
- spec/nanoc/rule_dsl/rule_spec.rb
|
576
579
|
- spec/nanoc/rule_dsl/rules_collection_spec.rb
|
577
580
|
- spec/nanoc/spec_spec.rb
|
578
581
|
- spec/nanoc/telemetry/counter_spec.rb
|
@@ -585,11 +588,8 @@ files:
|
|
585
588
|
- spec/regression_filenames_spec.rb
|
586
589
|
- spec/spec_helper.rb
|
587
590
|
- test/base/test_compiler.rb
|
588
|
-
- test/base/test_dependency_tracker.rb
|
589
591
|
- test/base/test_filter.rb
|
590
|
-
- test/base/test_notification_center.rb
|
591
592
|
- test/base/test_site.rb
|
592
|
-
- test/base/test_store.rb
|
593
593
|
- test/checking/checks/test_css.rb
|
594
594
|
- test/checking/checks/test_external_links.rb
|
595
595
|
- test/checking/checks/test_html.rb
|
@@ -659,9 +659,7 @@ files:
|
|
659
659
|
- test/helpers/test_xml_sitemap.rb
|
660
660
|
- test/rule_dsl/test_action_provider.rb
|
661
661
|
- test/rule_dsl/test_compiler_dsl.rb
|
662
|
-
- test/rule_dsl/test_rule.rb
|
663
662
|
- test/rule_dsl/test_rules_collection.rb
|
664
|
-
- test/test_gem.rb
|
665
663
|
homepage: http://nanoc.ws/
|
666
664
|
licenses:
|
667
665
|
- MIT
|
@@ -684,7 +682,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
684
682
|
version: '0'
|
685
683
|
requirements: []
|
686
684
|
rubyforge_project:
|
687
|
-
rubygems_version: 2.
|
685
|
+
rubygems_version: 2.7.2
|
688
686
|
signing_key:
|
689
687
|
specification_version: 4
|
690
688
|
summary: A static-site generator with a focus on flexibility.
|
data/Appraisals
DELETED
@@ -1,265 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
|
5
|
-
class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
|
6
|
-
def test_initialize
|
7
|
-
# Mock objects
|
8
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
9
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
10
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
11
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
12
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
13
|
-
])
|
14
|
-
|
15
|
-
# Create
|
16
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
17
|
-
|
18
|
-
# Verify no dependencies yet
|
19
|
-
assert_empty store.objects_causing_outdatedness_of(items.to_a[0])
|
20
|
-
assert_empty store.objects_causing_outdatedness_of(items.to_a[1])
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_record_dependency
|
24
|
-
# Mock objects
|
25
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
26
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
27
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
28
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
29
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
30
|
-
])
|
31
|
-
|
32
|
-
# Create
|
33
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
34
|
-
|
35
|
-
# Record some dependencies
|
36
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
37
|
-
|
38
|
-
# Verify dependencies
|
39
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_record_dependency_no_self
|
43
|
-
# Mock objects
|
44
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
45
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
46
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
47
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
48
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
49
|
-
])
|
50
|
-
|
51
|
-
# Create
|
52
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
53
|
-
|
54
|
-
# Record some dependencies
|
55
|
-
store.record_dependency(items.to_a[0], items.to_a[0])
|
56
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
57
|
-
|
58
|
-
# Verify dependencies
|
59
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_record_dependency_no_doubles
|
63
|
-
# Mock objects
|
64
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
65
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
66
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
67
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
68
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
69
|
-
])
|
70
|
-
|
71
|
-
# Create
|
72
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
73
|
-
|
74
|
-
# Record some dependencies
|
75
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
76
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
77
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
78
|
-
|
79
|
-
# Verify dependencies
|
80
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_objects_causing_outdatedness_of
|
84
|
-
# Mock objects
|
85
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
86
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
87
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
88
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
89
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
90
|
-
Nanoc::Int::Item.new('c', {}, '/c.md'),
|
91
|
-
])
|
92
|
-
|
93
|
-
# Create
|
94
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
95
|
-
|
96
|
-
# Record some dependencies
|
97
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
98
|
-
store.record_dependency(items.to_a[1], items.to_a[2])
|
99
|
-
|
100
|
-
# Verify dependencies
|
101
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_store_graph_and_load_graph_simple
|
105
|
-
# Mock objects
|
106
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
107
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
108
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
109
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
110
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
111
|
-
Nanoc::Int::Item.new('c', {}, '/c.md'),
|
112
|
-
Nanoc::Int::Item.new('d', {}, '/d.md'),
|
113
|
-
])
|
114
|
-
|
115
|
-
# Create
|
116
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
117
|
-
|
118
|
-
# Record some dependencies
|
119
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
120
|
-
store.record_dependency(items.to_a[1], items.to_a[2])
|
121
|
-
store.record_dependency(items.to_a[1], items.to_a[3])
|
122
|
-
|
123
|
-
# Store
|
124
|
-
store.store
|
125
|
-
assert File.file?(store.filename)
|
126
|
-
|
127
|
-
# Re-create
|
128
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
129
|
-
|
130
|
-
# Load
|
131
|
-
store.load
|
132
|
-
|
133
|
-
# Check loaded graph
|
134
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
135
|
-
assert_contains_exactly [items.to_a[2], items.to_a[3]], store.objects_causing_outdatedness_of(items.to_a[1])
|
136
|
-
assert_empty store.objects_causing_outdatedness_of(items.to_a[2])
|
137
|
-
assert_empty store.objects_causing_outdatedness_of(items.to_a[3])
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_store_graph_and_load_graph_with_removed_items
|
141
|
-
# Mock objects
|
142
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
143
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
144
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
145
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
146
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
147
|
-
Nanoc::Int::Item.new('c', {}, '/c.md'),
|
148
|
-
Nanoc::Int::Item.new('d', {}, '/d.md'),
|
149
|
-
])
|
150
|
-
|
151
|
-
# Create new and old lists
|
152
|
-
old_items = Nanoc::Int::ItemCollection.new(config, [items.to_a[0], items.to_a[1], items.to_a[2], items.to_a[3]])
|
153
|
-
new_items = Nanoc::Int::ItemCollection.new(config, [items.to_a[0], items.to_a[1], items.to_a[2]])
|
154
|
-
|
155
|
-
# Create
|
156
|
-
store = Nanoc::Int::DependencyStore.new(old_items, layouts, config)
|
157
|
-
|
158
|
-
# Record some dependencies
|
159
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
160
|
-
store.record_dependency(items.to_a[1], items.to_a[2])
|
161
|
-
store.record_dependency(items.to_a[1], items.to_a[3])
|
162
|
-
|
163
|
-
# Store
|
164
|
-
store.store
|
165
|
-
assert File.file?(store.filename)
|
166
|
-
|
167
|
-
# Re-create
|
168
|
-
store = Nanoc::Int::DependencyStore.new(new_items, layouts, config)
|
169
|
-
|
170
|
-
# Load
|
171
|
-
store.load
|
172
|
-
|
173
|
-
# Check loaded graph
|
174
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
175
|
-
assert_contains_exactly [items.to_a[2], nil], store.objects_causing_outdatedness_of(items.to_a[1])
|
176
|
-
assert_empty store.objects_causing_outdatedness_of(items.to_a[2])
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_store_graph_with_nils_in_dst
|
180
|
-
# Mock objects
|
181
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
182
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
183
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
184
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
185
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
186
|
-
Nanoc::Int::Item.new('c', {}, '/c.md'),
|
187
|
-
])
|
188
|
-
|
189
|
-
# Create
|
190
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
191
|
-
|
192
|
-
# Record some dependencies
|
193
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
194
|
-
store.record_dependency(items.to_a[1], nil)
|
195
|
-
|
196
|
-
# Store
|
197
|
-
store.store
|
198
|
-
assert File.file?(store.filename)
|
199
|
-
|
200
|
-
# Re-create
|
201
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
202
|
-
|
203
|
-
# Load
|
204
|
-
store.load
|
205
|
-
|
206
|
-
# Check loaded graph
|
207
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
208
|
-
assert_contains_exactly [nil], store.objects_causing_outdatedness_of(items.to_a[1])
|
209
|
-
end
|
210
|
-
|
211
|
-
def test_store_graph_with_nils_in_src
|
212
|
-
# Mock objects
|
213
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
214
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
215
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
216
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
217
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
218
|
-
Nanoc::Int::Item.new('c', {}, '/c.md'),
|
219
|
-
])
|
220
|
-
|
221
|
-
# Create
|
222
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
223
|
-
|
224
|
-
# Record some dependencies
|
225
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
226
|
-
store.record_dependency(nil, items.to_a[2])
|
227
|
-
|
228
|
-
# Store
|
229
|
-
store.store
|
230
|
-
assert File.file?(store.filename)
|
231
|
-
|
232
|
-
# Re-create
|
233
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
234
|
-
|
235
|
-
# Load
|
236
|
-
store.load
|
237
|
-
|
238
|
-
# Check loaded graph
|
239
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
240
|
-
assert_empty store.objects_causing_outdatedness_of(items.to_a[1])
|
241
|
-
end
|
242
|
-
|
243
|
-
def test_forget_dependencies_for
|
244
|
-
# Mock objects
|
245
|
-
config = Nanoc::Int::Configuration.new.with_defaults
|
246
|
-
layouts = Nanoc::Int::LayoutCollection.new(config)
|
247
|
-
items = Nanoc::Int::ItemCollection.new(config, [
|
248
|
-
Nanoc::Int::Item.new('a', {}, '/a.md'),
|
249
|
-
Nanoc::Int::Item.new('b', {}, '/b.md'),
|
250
|
-
Nanoc::Int::Item.new('c', {}, '/c.md'),
|
251
|
-
])
|
252
|
-
|
253
|
-
# Create
|
254
|
-
store = Nanoc::Int::DependencyStore.new(items, layouts, config)
|
255
|
-
|
256
|
-
# Record some dependencies
|
257
|
-
store.record_dependency(items.to_a[0], items.to_a[1])
|
258
|
-
store.record_dependency(items.to_a[1], items.to_a[2])
|
259
|
-
assert_contains_exactly [items.to_a[1]], store.objects_causing_outdatedness_of(items.to_a[0])
|
260
|
-
|
261
|
-
# Forget dependencies
|
262
|
-
store.forget_dependencies_for(items.to_a[0])
|
263
|
-
assert_empty store.objects_causing_outdatedness_of(items.to_a[0])
|
264
|
-
end
|
265
|
-
end
|