nanoc 4.7.12 → 4.7.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +6 -0
- data/lib/nanoc/base/core_ext.rb +0 -1
- data/lib/nanoc/base/entities.rb +4 -1
- data/lib/nanoc/base/entities/dependency.rb +5 -4
- data/lib/nanoc/base/entities/directed_graph.rb +12 -0
- data/lib/nanoc/base/entities/identifiable_collection.rb +11 -6
- data/lib/nanoc/base/entities/item_collection.rb +14 -0
- data/lib/nanoc/base/entities/layout_collection.rb +14 -0
- data/lib/nanoc/base/entities/outdatedness_reasons.rb +19 -0
- data/lib/nanoc/base/entities/props.rb +33 -10
- data/lib/nanoc/base/repos/aggregate_data_source.rb +2 -2
- data/lib/nanoc/base/repos/checksum_store.rb +1 -1
- data/lib/nanoc/base/repos/dependency_store.rb +25 -12
- data/lib/nanoc/base/services/dependency_tracker.rb +3 -2
- data/lib/nanoc/base/services/outdatedness_checker.rb +33 -10
- data/lib/nanoc/base/services/outdatedness_rules.rb +2 -0
- data/lib/nanoc/base/services/outdatedness_rules/item_collection_extended.rb +16 -0
- data/lib/nanoc/base/services/outdatedness_rules/layout_collection_extended.rb +16 -0
- data/lib/nanoc/base/services/pruner.rb +13 -1
- data/lib/nanoc/base/views/identifiable_collection_view.rb +24 -0
- data/lib/nanoc/cli/commands/show-data.rb +4 -0
- data/lib/nanoc/spec.rb +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/checksummer_spec.rb +4 -4
- data/spec/nanoc/base/compiler_spec.rb +2 -2
- data/spec/nanoc/base/directed_graph_spec.rb +42 -0
- data/spec/nanoc/base/entities/identifiable_collection_spec.rb +110 -93
- data/spec/nanoc/base/entities/props_spec.rb +121 -1
- data/spec/nanoc/base/entities/site_spec.rb +2 -2
- data/spec/nanoc/base/repos/dependency_store_spec.rb +34 -40
- data/spec/nanoc/base/services/compiler/stages/calculate_checksums_spec.rb +2 -2
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +2 -2
- data/spec/nanoc/base/services/dependency_tracker_spec.rb +3 -4
- data/spec/nanoc/base/services/outdatedness_checker_spec.rb +290 -4
- data/spec/nanoc/base/services/outdatedness_rules_spec.rb +3 -3
- data/spec/nanoc/base/services/pruner_spec.rb +9 -0
- data/spec/nanoc/base/views/document_view_spec.rb +3 -4
- data/spec/nanoc/base/views/identifiable_collection_view_spec.rb +74 -7
- data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +2 -1
- data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +2 -1
- data/spec/nanoc/base/views/item_rep_view_spec.rb +3 -4
- data/spec/nanoc/base/views/item_view_spec.rb +5 -6
- data/spec/nanoc/base/views/layout_collection_view_spec.rb +2 -1
- data/spec/nanoc/base/views/mutable_identifiable_collection_view_spec.rb +1 -1
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +3 -2
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +3 -2
- data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +1 -1
- data/spec/nanoc/cli/commands/show_data_spec.rb +4 -4
- data/spec/nanoc/cli/commands/show_rules_spec.rb +2 -2
- data/spec/nanoc/helpers/rendering_spec.rb +5 -0
- data/spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb +2 -2
- data/spec/nanoc/rule_dsl/rule_context_spec.rb +6 -4
- data/test/base/test_dependency_tracker.rb +22 -22
- data/test/base/test_item_array.rb +2 -2
- data/test/filters/test_xsl.rb +2 -2
- data/test/fixtures/vcr_cassettes/html_run_error.yml +17 -12
- data/test/fixtures/vcr_cassettes/html_run_ok.yml +17 -12
- data/test/helpers/test_blogging.rb +2 -2
- data/test/helpers/test_xml_sitemap.rb +7 -7
- metadata +6 -4
- data/lib/nanoc/base/core_ext/pathname.rb +0 -10
- data/test/extra/core_ext/test_pathname.rb +0 -14
@@ -31,7 +31,41 @@ describe Nanoc::Int::Props do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe '#raw_content?' do
|
34
|
-
|
34
|
+
subject { props.raw_content? }
|
35
|
+
|
36
|
+
context 'nothing active' do
|
37
|
+
it { is_expected.not_to be }
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'raw_content active' do
|
41
|
+
let(:props) { described_class.new(raw_content: true) }
|
42
|
+
it { is_expected.to be }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'raw_content and compiled_content active' do
|
46
|
+
let(:props) { described_class.new(raw_content: true, compiled_content: true) }
|
47
|
+
it { is_expected.to be }
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'compiled_content active' do
|
51
|
+
let(:props) { described_class.new(compiled_content: true) }
|
52
|
+
it { is_expected.not_to be }
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'all active' do
|
56
|
+
let(:props) { described_class.new(raw_content: true, attributes: true, compiled_content: true, path: true) }
|
57
|
+
it { is_expected.to be }
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'raw_content is empty list' do
|
61
|
+
let(:props) { described_class.new(raw_content: []) }
|
62
|
+
it { is_expected.not_to be }
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'raw_content is non-empty list' do
|
66
|
+
let(:props) { described_class.new(raw_content: ['/asdf.*']) }
|
67
|
+
it { is_expected.to be }
|
68
|
+
end
|
35
69
|
end
|
36
70
|
|
37
71
|
describe '#attributes?' do
|
@@ -233,6 +267,92 @@ describe Nanoc::Int::Props do
|
|
233
267
|
end
|
234
268
|
end
|
235
269
|
|
270
|
+
describe '#merge_raw_content' do
|
271
|
+
let(:props_raw_content_true) do
|
272
|
+
described_class.new(raw_content: true)
|
273
|
+
end
|
274
|
+
|
275
|
+
let(:props_raw_content_false) do
|
276
|
+
described_class.new(raw_content: false)
|
277
|
+
end
|
278
|
+
|
279
|
+
let(:props_raw_content_list_a) do
|
280
|
+
described_class.new(raw_content: %w[donkey giraffe])
|
281
|
+
end
|
282
|
+
|
283
|
+
let(:props_raw_content_list_b) do
|
284
|
+
described_class.new(raw_content: %w[giraffe zebra])
|
285
|
+
end
|
286
|
+
|
287
|
+
subject { props.merge(other_props).raw_content }
|
288
|
+
|
289
|
+
context 'false + false' do
|
290
|
+
let(:props) { props_raw_content_false }
|
291
|
+
let(:other_props) { props_raw_content_false }
|
292
|
+
|
293
|
+
it { is_expected.to be(false) }
|
294
|
+
end
|
295
|
+
|
296
|
+
context 'false + true' do
|
297
|
+
let(:props) { props_raw_content_false }
|
298
|
+
let(:other_props) { props_raw_content_true }
|
299
|
+
|
300
|
+
it { is_expected.to be(true) }
|
301
|
+
end
|
302
|
+
|
303
|
+
context 'false + list' do
|
304
|
+
let(:props) { props_raw_content_false }
|
305
|
+
let(:other_props) { props_raw_content_list_a }
|
306
|
+
|
307
|
+
it { is_expected.to be_a(Set) }
|
308
|
+
it { is_expected.to match_array(%w[donkey giraffe]) }
|
309
|
+
end
|
310
|
+
|
311
|
+
context 'true + false' do
|
312
|
+
let(:props) { props_raw_content_true }
|
313
|
+
let(:other_props) { props_raw_content_false }
|
314
|
+
|
315
|
+
it { is_expected.to be(true) }
|
316
|
+
end
|
317
|
+
|
318
|
+
context 'true + true' do
|
319
|
+
let(:props) { props_raw_content_true }
|
320
|
+
let(:other_props) { props_raw_content_true }
|
321
|
+
|
322
|
+
it { is_expected.to be(true) }
|
323
|
+
end
|
324
|
+
|
325
|
+
context 'true + list' do
|
326
|
+
let(:props) { props_raw_content_true }
|
327
|
+
let(:other_props) { props_raw_content_list_a }
|
328
|
+
|
329
|
+
it { is_expected.to be(true) }
|
330
|
+
end
|
331
|
+
|
332
|
+
context 'list + false' do
|
333
|
+
let(:props) { props_raw_content_list_a }
|
334
|
+
let(:other_props) { props_raw_content_false }
|
335
|
+
|
336
|
+
it { is_expected.to be_a(Set) }
|
337
|
+
it { is_expected.to match_array(%w[donkey giraffe]) }
|
338
|
+
end
|
339
|
+
|
340
|
+
context 'list + true' do
|
341
|
+
let(:props) { props_raw_content_list_a }
|
342
|
+
let(:other_props) { props_raw_content_true }
|
343
|
+
|
344
|
+
it { is_expected.to be(true) }
|
345
|
+
end
|
346
|
+
|
347
|
+
context 'list + list' do
|
348
|
+
let(:props) { props_raw_content_list_a }
|
349
|
+
let(:other_props) { props_raw_content_list_b }
|
350
|
+
|
351
|
+
it { is_expected.to be_a(Set) }
|
352
|
+
it { is_expected.to match_array(%w[donkey giraffe zebra]) }
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
236
356
|
describe '#active' do
|
237
357
|
subject { props.active }
|
238
358
|
|
@@ -22,7 +22,7 @@ describe Nanoc::Int::Site do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
let(:items) do
|
25
|
-
Nanoc::Int::
|
25
|
+
Nanoc::Int::ItemCollection.new(
|
26
26
|
config,
|
27
27
|
[
|
28
28
|
Nanoc::Int::Item.new('foo', {}, '/foo.md'),
|
@@ -32,7 +32,7 @@ describe Nanoc::Int::Site do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
let(:layouts) do
|
35
|
-
Nanoc::Int::
|
35
|
+
Nanoc::Int::LayoutCollection.new(
|
36
36
|
config,
|
37
37
|
[
|
38
38
|
Nanoc::Int::Layout.new('foo', {}, '/foo.md'),
|
@@ -10,8 +10,8 @@ describe Nanoc::Int::DependencyStore do
|
|
10
10
|
let(:layout_a) { Nanoc::Int::Layout.new('la', {}, '/la.md') }
|
11
11
|
let(:layout_b) { Nanoc::Int::Layout.new('lb', {}, '/lb.md') }
|
12
12
|
|
13
|
-
let(:items) { Nanoc::Int::
|
14
|
-
let(:layouts) { Nanoc::Int::
|
13
|
+
let(:items) { Nanoc::Int::ItemCollection.new(config, [item_a, item_b, item_c]) }
|
14
|
+
let(:layouts) { Nanoc::Int::LayoutCollection.new(config, [layout_a, layout_b]) }
|
15
15
|
let(:config) { Nanoc::Int::Configuration.new }
|
16
16
|
|
17
17
|
describe '#dependencies_causing_outdatedness_of' do
|
@@ -91,6 +91,25 @@ describe Nanoc::Int::DependencyStore do
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
context 'dependency on items, generic prop' do
|
95
|
+
before do
|
96
|
+
store.record_dependency(item_a, items)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'creates one dependency' do
|
100
|
+
deps = store.dependencies_causing_outdatedness_of(item_a)
|
101
|
+
expect(deps.size).to eql(1)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'returns true for all props' do
|
105
|
+
deps = store.dependencies_causing_outdatedness_of(item_a)
|
106
|
+
expect(deps[0].props.raw_content?).to be
|
107
|
+
expect(deps[0].props.compiled_content?).to be
|
108
|
+
expect(deps[0].props.path?).to be
|
109
|
+
expect(deps[0].props.attributes?).to be
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
94
113
|
context 'no props' do
|
95
114
|
before do
|
96
115
|
store.record_dependency(item_a, item_b)
|
@@ -222,41 +241,16 @@ describe Nanoc::Int::DependencyStore do
|
|
222
241
|
|
223
242
|
context 'one new item' do
|
224
243
|
let(:items_after) do
|
225
|
-
Nanoc::Int::
|
244
|
+
Nanoc::Int::ItemCollection.new(config, [item_a, item_b, item_c, item_d])
|
226
245
|
end
|
227
246
|
|
228
247
|
let(:item_d) { Nanoc::Int::Item.new('d', {}, '/d.md') }
|
229
248
|
|
230
|
-
it '
|
231
|
-
expect(store.objects_causing_outdatedness_of(item_a)).
|
232
|
-
expect(store.objects_causing_outdatedness_of(item_b)).
|
233
|
-
expect(store.objects_causing_outdatedness_of(item_c)).
|
234
|
-
|
235
|
-
|
236
|
-
it 'marks new items as outdated' do
|
237
|
-
expect(store.objects_causing_outdatedness_of(item_d)).to eq([item_d])
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
context 'two new items' do
|
242
|
-
let(:items_after) do
|
243
|
-
Nanoc::Int::IdentifiableCollection.new(config, [item_a, item_b, item_c, item_d, item_e])
|
244
|
-
end
|
245
|
-
|
246
|
-
let(:item_d) { Nanoc::Int::Item.new('d', {}, '/d.md') }
|
247
|
-
let(:item_e) { Nanoc::Int::Item.new('e', {}, '/e.md') }
|
248
|
-
|
249
|
-
it 'marks existing items as outdated' do
|
250
|
-
# Only one of obj D or E needed!
|
251
|
-
expect(store.objects_causing_outdatedness_of(item_a)).to eq([item_d]).or eq([item_e])
|
252
|
-
expect(store.objects_causing_outdatedness_of(item_b)).to eq([item_d]).or eq([item_e])
|
253
|
-
expect(store.objects_causing_outdatedness_of(item_c)).to eq([item_d]).or eq([item_e])
|
254
|
-
end
|
255
|
-
|
256
|
-
it 'marks new items as outdated' do
|
257
|
-
# Only one of obj D or E needed!
|
258
|
-
expect(store.objects_causing_outdatedness_of(item_d)).to eq([item_d]).or eq([item_e])
|
259
|
-
expect(store.objects_causing_outdatedness_of(item_e)).to eq([item_d]).or eq([item_e])
|
249
|
+
it 'does not mark items as outdated' do
|
250
|
+
expect(store.objects_causing_outdatedness_of(item_a)).not_to include(item_d)
|
251
|
+
expect(store.objects_causing_outdatedness_of(item_b)).not_to include(item_d)
|
252
|
+
expect(store.objects_causing_outdatedness_of(item_c)).not_to include(item_d)
|
253
|
+
expect(store.objects_causing_outdatedness_of(item_d)).not_to include(item_d)
|
260
254
|
end
|
261
255
|
end
|
262
256
|
end
|
@@ -307,7 +301,7 @@ describe Nanoc::Int::DependencyStore do
|
|
307
301
|
|
308
302
|
it 'ignores all other objects' do
|
309
303
|
subject
|
310
|
-
expect(
|
304
|
+
expect(other_items).to all(satisfy { |o| store.dependencies_causing_outdatedness_of(o).empty? })
|
311
305
|
end
|
312
306
|
end
|
313
307
|
|
@@ -331,7 +325,7 @@ describe Nanoc::Int::DependencyStore do
|
|
331
325
|
|
332
326
|
it 'ignores all other objects' do
|
333
327
|
subject
|
334
|
-
expect(
|
328
|
+
expect(other_items).to all(satisfy { |o| store.dependencies_causing_outdatedness_of(o).empty? })
|
335
329
|
end
|
336
330
|
end
|
337
331
|
|
@@ -356,7 +350,7 @@ describe Nanoc::Int::DependencyStore do
|
|
356
350
|
|
357
351
|
it 'ignores all other objects' do
|
358
352
|
subject
|
359
|
-
expect(
|
353
|
+
expect(other_items).to all(satisfy { |o| store.dependencies_causing_outdatedness_of(o).empty? })
|
360
354
|
end
|
361
355
|
end
|
362
356
|
|
@@ -381,7 +375,7 @@ describe Nanoc::Int::DependencyStore do
|
|
381
375
|
|
382
376
|
it 'ignores all other objects' do
|
383
377
|
subject
|
384
|
-
expect(
|
378
|
+
expect(other_items).to all(satisfy { |o| store.dependencies_causing_outdatedness_of(o).empty? })
|
385
379
|
end
|
386
380
|
end
|
387
381
|
end
|
@@ -390,7 +384,7 @@ describe Nanoc::Int::DependencyStore do
|
|
390
384
|
context 'item on item' do
|
391
385
|
let(:source_obj) { item_a }
|
392
386
|
let(:target_obj) { item_b }
|
393
|
-
let(:
|
387
|
+
let(:other_items) { [item_c] }
|
394
388
|
|
395
389
|
include_examples 'records dependencies'
|
396
390
|
end
|
@@ -398,7 +392,7 @@ describe Nanoc::Int::DependencyStore do
|
|
398
392
|
context 'item on layout' do
|
399
393
|
let(:source_obj) { item_a }
|
400
394
|
let(:target_obj) { layout_a }
|
401
|
-
let(:
|
395
|
+
let(:other_items) { [item_b, item_c] }
|
402
396
|
|
403
397
|
include_examples 'records dependencies'
|
404
398
|
end
|
@@ -406,7 +400,7 @@ describe Nanoc::Int::DependencyStore do
|
|
406
400
|
context 'item on config' do
|
407
401
|
let(:source_obj) { item_a }
|
408
402
|
let(:target_obj) { config }
|
409
|
-
let(:
|
403
|
+
let(:other_items) { [item_b, item_c] }
|
410
404
|
|
411
405
|
include_examples 'records dependencies'
|
412
406
|
end
|
@@ -14,11 +14,11 @@ describe Nanoc::Int::Compiler::Stages::CalculateChecksums do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:items) do
|
17
|
-
Nanoc::Int::
|
17
|
+
Nanoc::Int::ItemCollection.new(config, [item])
|
18
18
|
end
|
19
19
|
|
20
20
|
let(:layouts) do
|
21
|
-
Nanoc::Int::
|
21
|
+
Nanoc::Int::LayoutCollection.new(config, [layout])
|
22
22
|
end
|
23
23
|
|
24
24
|
let(:code_snippet) do
|
@@ -48,11 +48,11 @@ describe Nanoc::Int::Compiler::Stages::CompileReps do
|
|
48
48
|
let(:code_snippets) { [] }
|
49
49
|
|
50
50
|
let(:layouts) do
|
51
|
-
Nanoc::Int::
|
51
|
+
Nanoc::Int::LayoutCollection.new(config)
|
52
52
|
end
|
53
53
|
|
54
54
|
let(:items) do
|
55
|
-
Nanoc::Int::
|
55
|
+
Nanoc::Int::ItemCollection.new(
|
56
56
|
config,
|
57
57
|
[item, other_item],
|
58
58
|
)
|
@@ -3,15 +3,14 @@
|
|
3
3
|
describe Nanoc::Int::DependencyTracker do
|
4
4
|
let(:tracker) { described_class.new(store) }
|
5
5
|
|
6
|
-
let(:store) { Nanoc::Int::DependencyStore.new(
|
6
|
+
let(:store) { Nanoc::Int::DependencyStore.new(empty_items, empty_layouts, config) }
|
7
7
|
|
8
8
|
let(:item_a) { Nanoc::Int::Item.new('a', {}, '/a.md') }
|
9
9
|
let(:item_b) { Nanoc::Int::Item.new('b', {}, '/b.md') }
|
10
10
|
let(:item_c) { Nanoc::Int::Item.new('c', {}, '/c.md') }
|
11
11
|
|
12
|
-
let(:
|
13
|
-
|
14
|
-
end
|
12
|
+
let(:empty_items) { Nanoc::Int::ItemCollection.new(config) }
|
13
|
+
let(:empty_layouts) { Nanoc::Int::LayoutCollection.new(config) }
|
15
14
|
|
16
15
|
let(:config) { Nanoc::Int::Configuration.new.with_defaults }
|
17
16
|
|
@@ -28,8 +28,8 @@ describe Nanoc::Int::OutdatednessChecker do
|
|
28
28
|
Nanoc::Int::DependencyStore.new(items, layouts, config)
|
29
29
|
end
|
30
30
|
|
31
|
-
let(:items) { Nanoc::Int::
|
32
|
-
let(:layouts) { Nanoc::Int::
|
31
|
+
let(:items) { Nanoc::Int::ItemCollection.new(config, [item]) }
|
32
|
+
let(:layouts) { Nanoc::Int::LayoutCollection.new(config) }
|
33
33
|
|
34
34
|
let(:code_snippets) { [] }
|
35
35
|
|
@@ -122,6 +122,56 @@ describe Nanoc::Int::OutdatednessChecker do
|
|
122
122
|
context 'with layout' do
|
123
123
|
# …
|
124
124
|
end
|
125
|
+
|
126
|
+
context 'with item collection' do
|
127
|
+
let(:obj) { items }
|
128
|
+
|
129
|
+
context 'no new items' do
|
130
|
+
it { is_expected.to be_nil }
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'new items' do
|
134
|
+
before do
|
135
|
+
dependency_store.store
|
136
|
+
|
137
|
+
new_item = Nanoc::Int::Item.new('stuff', {}, '/newblahz.md')
|
138
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, [item, new_item])
|
139
|
+
|
140
|
+
dependency_store.load
|
141
|
+
end
|
142
|
+
|
143
|
+
it { is_expected.to be_a(Nanoc::Int::OutdatednessReasons::ItemCollectionExtended) }
|
144
|
+
|
145
|
+
it 'includes proper raw_content props' do
|
146
|
+
expect(subject.objects.map(&:identifier).map(&:to_s)).to eq(['/newblahz.md'])
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'with layout collection' do
|
152
|
+
let(:obj) { layouts }
|
153
|
+
|
154
|
+
context 'no new layouts' do
|
155
|
+
it { is_expected.to be_nil }
|
156
|
+
end
|
157
|
+
|
158
|
+
context 'new layouts' do
|
159
|
+
before do
|
160
|
+
dependency_store.store
|
161
|
+
|
162
|
+
new_layout = Nanoc::Int::Layout.new('stuff', {}, '/newblahz.md')
|
163
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, layouts.to_a + [new_layout])
|
164
|
+
|
165
|
+
dependency_store.load
|
166
|
+
end
|
167
|
+
|
168
|
+
it { is_expected.to be_a(Nanoc::Int::OutdatednessReasons::LayoutCollectionExtended) }
|
169
|
+
|
170
|
+
it 'includes proper raw_content props' do
|
171
|
+
expect(subject.objects.map(&:identifier).map(&:to_s)).to eq(['/newblahz.md'])
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
125
175
|
end
|
126
176
|
|
127
177
|
describe '#outdated_due_to_dependencies?' do
|
@@ -134,7 +184,7 @@ describe Nanoc::Int::OutdatednessChecker do
|
|
134
184
|
|
135
185
|
let(:config) { Nanoc::Int::Configuration.new }
|
136
186
|
|
137
|
-
let(:items) { Nanoc::Int::
|
187
|
+
let(:items) { Nanoc::Int::ItemCollection.new(config, [item, other_item]) }
|
138
188
|
|
139
189
|
let(:old_action_sequence_for_other_item_rep) do
|
140
190
|
Nanoc::Int::ActionSequence.build(other_item_rep) do |b|
|
@@ -167,7 +217,7 @@ describe Nanoc::Int::OutdatednessChecker do
|
|
167
217
|
let(:distant_item_rep) { Nanoc::Int::ItemRep.new(distant_item, :default) }
|
168
218
|
|
169
219
|
let(:items) do
|
170
|
-
Nanoc::Int::
|
220
|
+
Nanoc::Int::ItemCollection.new(config, [item, other_item, distant_item])
|
171
221
|
end
|
172
222
|
|
173
223
|
let(:action_sequences) do
|
@@ -488,5 +538,241 @@ describe Nanoc::Int::OutdatednessChecker do
|
|
488
538
|
it { is_expected.not_to be }
|
489
539
|
end
|
490
540
|
end
|
541
|
+
|
542
|
+
context 'only item collection dependency' do
|
543
|
+
context 'dependency on any new item' do
|
544
|
+
before do
|
545
|
+
dependency_tracker = Nanoc::Int::DependencyTracker.new(dependency_store)
|
546
|
+
dependency_tracker.enter(item)
|
547
|
+
dependency_tracker.bounce(items, raw_content: true)
|
548
|
+
dependency_store.store
|
549
|
+
end
|
550
|
+
|
551
|
+
context 'nothing changed' do
|
552
|
+
it { is_expected.not_to be }
|
553
|
+
end
|
554
|
+
|
555
|
+
context 'item added' do
|
556
|
+
before do
|
557
|
+
new_item = Nanoc::Int::Item.new('stuff', {}, '/newblahz.md')
|
558
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, items.to_a + [new_item])
|
559
|
+
dependency_store.load
|
560
|
+
end
|
561
|
+
|
562
|
+
it { is_expected.to be }
|
563
|
+
end
|
564
|
+
|
565
|
+
context 'item removed' do
|
566
|
+
before do
|
567
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, [])
|
568
|
+
dependency_store.load
|
569
|
+
end
|
570
|
+
|
571
|
+
it { is_expected.not_to be }
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
context 'dependency on specific new items (string)' do
|
576
|
+
before do
|
577
|
+
dependency_tracker = Nanoc::Int::DependencyTracker.new(dependency_store)
|
578
|
+
dependency_tracker.enter(item)
|
579
|
+
dependency_tracker.bounce(items, raw_content: ['/new*'])
|
580
|
+
dependency_store.store
|
581
|
+
end
|
582
|
+
|
583
|
+
context 'nothing changed' do
|
584
|
+
it { is_expected.not_to be }
|
585
|
+
end
|
586
|
+
|
587
|
+
context 'matching item added' do
|
588
|
+
before do
|
589
|
+
new_item = Nanoc::Int::Item.new('stuff', {}, '/newblahz.md')
|
590
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, items.to_a + [new_item])
|
591
|
+
dependency_store.load
|
592
|
+
end
|
593
|
+
|
594
|
+
it { is_expected.to be }
|
595
|
+
end
|
596
|
+
|
597
|
+
context 'non-matching item added' do
|
598
|
+
before do
|
599
|
+
new_item = Nanoc::Int::Item.new('stuff', {}, '/nublahz.md')
|
600
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, items.to_a + [new_item])
|
601
|
+
dependency_store.load
|
602
|
+
end
|
603
|
+
|
604
|
+
it { is_expected.not_to be }
|
605
|
+
end
|
606
|
+
|
607
|
+
context 'item removed' do
|
608
|
+
before do
|
609
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, [])
|
610
|
+
dependency_store.load
|
611
|
+
end
|
612
|
+
|
613
|
+
it { is_expected.not_to be }
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
617
|
+
context 'dependency on specific new items (regex)' do
|
618
|
+
before do
|
619
|
+
dependency_tracker = Nanoc::Int::DependencyTracker.new(dependency_store)
|
620
|
+
dependency_tracker.enter(item)
|
621
|
+
dependency_tracker.bounce(items, raw_content: [%r{^/new.*}])
|
622
|
+
dependency_store.store
|
623
|
+
end
|
624
|
+
|
625
|
+
context 'nothing changed' do
|
626
|
+
it { is_expected.not_to be }
|
627
|
+
end
|
628
|
+
|
629
|
+
context 'matching item added' do
|
630
|
+
before do
|
631
|
+
new_item = Nanoc::Int::Item.new('stuff', {}, '/newblahz.md')
|
632
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, items.to_a + [new_item])
|
633
|
+
dependency_store.load
|
634
|
+
end
|
635
|
+
|
636
|
+
it { is_expected.to be }
|
637
|
+
end
|
638
|
+
|
639
|
+
context 'non-matching item added' do
|
640
|
+
before do
|
641
|
+
new_item = Nanoc::Int::Item.new('stuff', {}, '/nublahz.md')
|
642
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, items.to_a + [new_item])
|
643
|
+
dependency_store.load
|
644
|
+
end
|
645
|
+
|
646
|
+
it { is_expected.not_to be }
|
647
|
+
end
|
648
|
+
|
649
|
+
context 'item removed' do
|
650
|
+
before do
|
651
|
+
dependency_store.items = Nanoc::Int::ItemCollection.new(config, [])
|
652
|
+
dependency_store.load
|
653
|
+
end
|
654
|
+
|
655
|
+
it { is_expected.not_to be }
|
656
|
+
end
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
context 'only layout collection dependency' do
|
661
|
+
context 'dependency on any new layout' do
|
662
|
+
before do
|
663
|
+
dependency_tracker = Nanoc::Int::DependencyTracker.new(dependency_store)
|
664
|
+
dependency_tracker.enter(item)
|
665
|
+
dependency_tracker.bounce(layouts, raw_content: true)
|
666
|
+
dependency_store.store
|
667
|
+
end
|
668
|
+
|
669
|
+
context 'nothing changed' do
|
670
|
+
it { is_expected.not_to be }
|
671
|
+
end
|
672
|
+
|
673
|
+
context 'layout added' do
|
674
|
+
before do
|
675
|
+
new_layout = Nanoc::Int::Layout.new('stuff', {}, '/newblahz.md')
|
676
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, layouts.to_a + [new_layout])
|
677
|
+
dependency_store.load
|
678
|
+
end
|
679
|
+
|
680
|
+
it { is_expected.to be }
|
681
|
+
end
|
682
|
+
|
683
|
+
context 'layout removed' do
|
684
|
+
before do
|
685
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, [])
|
686
|
+
dependency_store.load
|
687
|
+
end
|
688
|
+
|
689
|
+
it { is_expected.not_to be }
|
690
|
+
end
|
691
|
+
end
|
692
|
+
|
693
|
+
context 'dependency on specific new layouts (string)' do
|
694
|
+
before do
|
695
|
+
dependency_tracker = Nanoc::Int::DependencyTracker.new(dependency_store)
|
696
|
+
dependency_tracker.enter(item)
|
697
|
+
dependency_tracker.bounce(layouts, raw_content: ['/new*'])
|
698
|
+
dependency_store.store
|
699
|
+
end
|
700
|
+
|
701
|
+
context 'nothing changed' do
|
702
|
+
it { is_expected.not_to be }
|
703
|
+
end
|
704
|
+
|
705
|
+
context 'matching layout added' do
|
706
|
+
before do
|
707
|
+
new_layout = Nanoc::Int::Layout.new('stuff', {}, '/newblahz.md')
|
708
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, layouts.to_a + [new_layout])
|
709
|
+
dependency_store.load
|
710
|
+
end
|
711
|
+
|
712
|
+
it { is_expected.to be }
|
713
|
+
end
|
714
|
+
|
715
|
+
context 'non-matching layout added' do
|
716
|
+
before do
|
717
|
+
new_layout = Nanoc::Int::Layout.new('stuff', {}, '/nublahz.md')
|
718
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, layouts.to_a + [new_layout])
|
719
|
+
dependency_store.load
|
720
|
+
end
|
721
|
+
|
722
|
+
it { is_expected.not_to be }
|
723
|
+
end
|
724
|
+
|
725
|
+
context 'layout removed' do
|
726
|
+
before do
|
727
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, [])
|
728
|
+
dependency_store.load
|
729
|
+
end
|
730
|
+
|
731
|
+
it { is_expected.not_to be }
|
732
|
+
end
|
733
|
+
end
|
734
|
+
|
735
|
+
context 'dependency on specific new layouts (regex)' do
|
736
|
+
before do
|
737
|
+
dependency_tracker = Nanoc::Int::DependencyTracker.new(dependency_store)
|
738
|
+
dependency_tracker.enter(item)
|
739
|
+
dependency_tracker.bounce(layouts, raw_content: [%r{^/new.*}])
|
740
|
+
dependency_store.store
|
741
|
+
end
|
742
|
+
|
743
|
+
context 'nothing changed' do
|
744
|
+
it { is_expected.not_to be }
|
745
|
+
end
|
746
|
+
|
747
|
+
context 'matching layout added' do
|
748
|
+
before do
|
749
|
+
new_layout = Nanoc::Int::Layout.new('stuff', {}, '/newblahz.md')
|
750
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, layouts.to_a + [new_layout])
|
751
|
+
dependency_store.load
|
752
|
+
end
|
753
|
+
|
754
|
+
it { is_expected.to be }
|
755
|
+
end
|
756
|
+
|
757
|
+
context 'non-matching layout added' do
|
758
|
+
before do
|
759
|
+
new_layout = Nanoc::Int::Layout.new('stuff', {}, '/nublahz.md')
|
760
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, layouts.to_a + [new_layout])
|
761
|
+
dependency_store.load
|
762
|
+
end
|
763
|
+
|
764
|
+
it { is_expected.not_to be }
|
765
|
+
end
|
766
|
+
|
767
|
+
context 'layout removed' do
|
768
|
+
before do
|
769
|
+
dependency_store.layouts = Nanoc::Int::LayoutCollection.new(config, [])
|
770
|
+
dependency_store.load
|
771
|
+
end
|
772
|
+
|
773
|
+
it { is_expected.not_to be }
|
774
|
+
end
|
775
|
+
end
|
776
|
+
end
|
491
777
|
end
|
492
778
|
end
|