nanoc 4.8.9 → 4.8.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -4
- data/Gemfile +2 -1
- data/NEWS.md +7 -0
- data/README.md +1 -1
- data/lib/nanoc.rb +2 -6
- data/lib/nanoc/base/entities/site.rb +9 -5
- data/lib/nanoc/base/repos/data_source.rb +0 -15
- data/lib/nanoc/base/repos/outdatedness_store.rb +17 -15
- data/lib/nanoc/base/services/compilation_context.rb +4 -4
- data/lib/nanoc/base/services/compiler.rb +102 -103
- data/lib/nanoc/base/services/compiler/stages/build_reps.rb +7 -7
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +4 -2
- data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +25 -7
- data/lib/nanoc/base/services/compiler/stages/postprocess.rb +3 -3
- data/lib/nanoc/base/services/compiler/stages/preprocess.rb +3 -0
- data/lib/nanoc/base/services/compiler_loader.rb +1 -4
- data/lib/nanoc/base/views.rb +13 -6
- data/lib/nanoc/base/views/{item_rep_collection_view.rb → basic_item_rep_collection_view.rb} +6 -6
- data/lib/nanoc/base/views/{item_rep_view.rb → basic_item_rep_view.rb} +8 -29
- data/lib/nanoc/base/views/{item_without_reps_view.rb → basic_item_view.rb} +3 -3
- data/lib/nanoc/base/views/compilation_item_rep_collection_view.rb +10 -0
- data/lib/nanoc/base/views/compilation_item_rep_view.rb +42 -0
- data/lib/nanoc/base/views/{mixins/with_reps_view_mixin.rb → compilation_item_view.rb} +3 -3
- data/lib/nanoc/base/views/item_collection_with_reps_view.rb +1 -1
- data/lib/nanoc/base/views/item_collection_without_reps_view.rb +1 -1
- data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +1 -1
- data/lib/nanoc/base/views/mutable_item_view.rb +1 -1
- data/lib/nanoc/base/views/post_compile_item_rep_collection_view.rb +1 -1
- data/lib/nanoc/base/views/post_compile_item_rep_view.rb +7 -2
- data/lib/nanoc/base/views/post_compile_item_view.rb +1 -1
- data/lib/nanoc/base/views/{view_context.rb → view_context_for_compilation.rb} +10 -1
- data/lib/nanoc/base/views/view_context_for_pre_compilation.rb +18 -0
- data/lib/nanoc/base/views/view_context_for_shell.rb +23 -0
- data/lib/nanoc/checking/check.rb +5 -1
- data/lib/nanoc/checking/runner.rb +1 -1
- data/lib/nanoc/cli.rb +1 -0
- data/lib/nanoc/cli/command_runner.rb +1 -7
- data/lib/nanoc/cli/commands/check.rb +2 -2
- data/lib/nanoc/cli/commands/compile.rb +8 -47
- data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +9 -0
- data/lib/nanoc/cli/commands/compile_listeners/aggregate.rb +49 -0
- data/lib/nanoc/cli/commands/deploy.rb +2 -1
- data/lib/nanoc/cli/commands/prune.rb +5 -4
- data/lib/nanoc/cli/commands/shell.rb +4 -6
- data/lib/nanoc/cli/commands/show-data.rb +20 -27
- data/lib/nanoc/cli/commands/show-rules.rb +20 -22
- data/lib/nanoc/cli/error_handler.rb +0 -17
- data/lib/nanoc/data_sources/filesystem.rb +4 -2
- data/lib/nanoc/deploying/deployers/fog.rb +4 -1
- data/lib/nanoc/helpers/link_to.rb +1 -1
- data/lib/nanoc/rule_dsl/action_provider.rb +8 -11
- data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +14 -5
- data/lib/nanoc/rule_dsl/recording_executor.rb +4 -0
- data/lib/nanoc/rule_dsl/rule.rb +14 -9
- data/lib/nanoc/rule_dsl/rule_context.rb +4 -4
- data/lib/nanoc/spec.rb +27 -19
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/checksummer_spec.rb +19 -11
- data/spec/nanoc/base/compiler_spec.rb +18 -14
- data/spec/nanoc/base/filter_spec.rb +7 -6
- data/spec/nanoc/base/repos/outdatedness_store_spec.rb +3 -32
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +2 -1
- data/spec/nanoc/base/services/compiler/stages/determine_outdatedness_spec.rb +148 -0
- data/spec/nanoc/base/services/compiler/stages/preprocess_spec.rb +110 -0
- data/spec/nanoc/base/services/executor_spec.rb +6 -6
- data/spec/nanoc/base/views/basic_item_rep_collection_view_spec.rb +8 -0
- data/spec/nanoc/base/views/basic_item_rep_view_spec.rb +9 -0
- data/spec/nanoc/base/views/compilation_item_rep_collection_view_spec.rb +8 -0
- data/spec/nanoc/base/views/compilation_item_rep_view_spec.rb +136 -0
- data/spec/nanoc/base/views/config_view_spec.rb +5 -5
- data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +4 -2
- data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +4 -2
- data/spec/nanoc/base/views/item_view_spec.rb +13 -11
- data/spec/nanoc/base/views/layout_collection_view_spec.rb +3 -1
- data/spec/nanoc/base/views/layout_view_spec.rb +3 -1
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +5 -2
- data/spec/nanoc/base/views/mutable_item_view_spec.rb +2 -0
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +5 -2
- data/spec/nanoc/base/views/mutable_layout_view_spec.rb +2 -0
- data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +2 -0
- data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +9 -3
- data/spec/nanoc/base/views/{document_view_spec.rb → support/document_view_examples.rb} +5 -5
- data/spec/nanoc/base/views/{identifiable_collection_view_spec.rb → support/identifiable_collection_view_examples.rb} +4 -4
- data/spec/nanoc/base/views/{item_rep_collection_view_spec.rb → support/item_rep_collection_view_examples.rb} +3 -8
- data/spec/nanoc/base/views/{item_rep_view_spec.rb → support/item_rep_view_examples.rb} +10 -111
- data/spec/nanoc/base/views/{mutable_document_view_spec.rb → support/mutable_document_view_examples.rb} +7 -6
- data/spec/nanoc/base/views/{mutable_identifiable_collection_view_spec.rb → support/mutable_identifiable_collection_view_examples.rb} +1 -1
- data/spec/nanoc/cli/commands/compile/abstract_spec.rb +80 -0
- data/spec/nanoc/cli/commands/compile_spec.rb +30 -51
- data/spec/nanoc/cli/commands/show_data_spec.rb +2 -23
- data/spec/nanoc/cli/commands/show_rules_spec.rb +4 -2
- data/spec/nanoc/regressions/gh_767_spec.rb +1 -1
- data/spec/nanoc/regressions/gh_776_spec.rb +2 -1
- data/spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb +25 -12
- data/spec/nanoc/rule_dsl/rule_context_spec.rb +16 -6
- data/test/base/test_data_source.rb +0 -18
- data/test/checking/checks/test_external_links.rb +4 -6
- data/test/checking/checks/test_internal_links.rb +6 -9
- data/test/cli/commands/test_compile.rb +0 -35
- data/test/cli/test_cleaning_stream.rb +1 -1
- data/test/data_sources/test_filesystem.rb +16 -0
- data/test/filters/test_kramdown.rb +4 -4
- data/test/filters/test_sass.rb +1 -1
- data/test/filters/test_slim.rb +7 -5
- data/test/filters/test_xsl.rb +10 -8
- data/test/helpers/test_blogging.rb +5 -5
- data/test/helpers/test_capturing.rb +8 -6
- data/test/helpers/test_link_to.rb +4 -4
- data/test/helpers/test_xml_sitemap.rb +19 -19
- metadata +25 -15
- data/lib/nanoc/base/views/item_with_reps_view.rb +0 -7
- data/spec/nanoc/base/core_ext/pathname_spec.rb +0 -0
@@ -94,7 +94,7 @@ shared_examples 'an item rep collection view' do
|
|
94
94
|
let(:name) { 'foo' }
|
95
95
|
|
96
96
|
it 'raises' do
|
97
|
-
expect { subject }.to raise_error(ArgumentError, 'expected
|
97
|
+
expect { subject }.to raise_error(ArgumentError, 'expected BasicItemRepCollectionView#[] to be called with a symbol')
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -102,7 +102,7 @@ shared_examples 'an item rep collection view' do
|
|
102
102
|
let(:name) { 0 }
|
103
103
|
|
104
104
|
it 'raises' do
|
105
|
-
expect { subject }.to raise_error(ArgumentError, 'expected
|
105
|
+
expect { subject }.to raise_error(ArgumentError, 'expected BasicItemRepCollectionView#[] to be called with a symbol (you likely want `.reps[:default]` rather than `.reps[0]`)')
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
@@ -114,7 +114,7 @@ shared_examples 'an item rep collection view' do
|
|
114
114
|
let(:name) { :donkey }
|
115
115
|
|
116
116
|
it 'raises' do
|
117
|
-
expect { subject }.to raise_error(Nanoc::
|
117
|
+
expect { subject }.to raise_error(Nanoc::BasicItemRepCollectionView::NoSuchItemRepError)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -138,8 +138,3 @@ shared_examples 'an item rep collection view' do
|
|
138
138
|
it { is_expected.to eql('<' + described_class.name + '>') }
|
139
139
|
end
|
140
140
|
end
|
141
|
-
|
142
|
-
describe Nanoc::ItemRepCollectionView do
|
143
|
-
it_behaves_like 'an item rep collection view'
|
144
|
-
let(:expected_view_class) { Nanoc::ItemRepView }
|
145
|
-
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
shared_examples 'an item rep view' do
|
4
|
+
# needs expected_item_view_class
|
5
|
+
|
4
6
|
let(:view_context) do
|
5
|
-
Nanoc::
|
6
|
-
reps:
|
7
|
-
items:
|
8
|
-
dependency_tracker:
|
7
|
+
Nanoc::ViewContextForCompilation.new(
|
8
|
+
reps: Nanoc::Int::ItemRepRepo.new,
|
9
|
+
items: Nanoc::Int::ItemCollection.new(config),
|
10
|
+
dependency_tracker: dependency_tracker,
|
9
11
|
compilation_context: compilation_context,
|
10
|
-
snapshot_repo:
|
12
|
+
snapshot_repo: snapshot_repo,
|
11
13
|
)
|
12
14
|
end
|
13
15
|
|
14
|
-
let(:reps) { double(:reps) }
|
15
|
-
let(:items) { double(:items) }
|
16
16
|
let(:compilation_context) { double(:compilation_context) }
|
17
17
|
let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
|
18
18
|
|
@@ -211,49 +211,6 @@ describe Nanoc::ItemRepView do
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
describe '#compiled_content' do
|
215
|
-
subject { view.compiled_content }
|
216
|
-
|
217
|
-
let(:view) { described_class.new(rep, view_context) }
|
218
|
-
|
219
|
-
let(:rep) do
|
220
|
-
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
221
|
-
ir.compiled = true
|
222
|
-
ir.snapshot_defs = [
|
223
|
-
Nanoc::Int::SnapshotDef.new(:last, binary: false),
|
224
|
-
]
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
let(:item) do
|
229
|
-
Nanoc::Int::Item.new('content', {}, '/asdf.md')
|
230
|
-
end
|
231
|
-
|
232
|
-
before do
|
233
|
-
snapshot_repo.set(rep, :last, Nanoc::Int::TextualContent.new('Hallo'))
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'creates a dependency' do
|
237
|
-
expect { subject }
|
238
|
-
.to change { dependency_store.objects_causing_outdatedness_of(base_item) }
|
239
|
-
.from([])
|
240
|
-
.to([item])
|
241
|
-
end
|
242
|
-
|
243
|
-
it 'creates a dependency with the right props' do
|
244
|
-
subject
|
245
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
246
|
-
|
247
|
-
expect(dep.props.compiled_content?).to eq(true)
|
248
|
-
|
249
|
-
expect(dep.props.raw_content?).to eq(false)
|
250
|
-
expect(dep.props.attributes?).to eq(false)
|
251
|
-
expect(dep.props.path?).to eq(false)
|
252
|
-
end
|
253
|
-
|
254
|
-
it { should eq('Hallo') }
|
255
|
-
end
|
256
|
-
|
257
214
|
describe '#path' do
|
258
215
|
subject { view.path }
|
259
216
|
|
@@ -289,64 +246,6 @@ describe Nanoc::ItemRepView do
|
|
289
246
|
it { should eq('/about/') }
|
290
247
|
end
|
291
248
|
|
292
|
-
describe '#raw_path' do
|
293
|
-
subject { Fiber.new { view.raw_path }.resume }
|
294
|
-
|
295
|
-
let(:view) { described_class.new(rep, view_context) }
|
296
|
-
|
297
|
-
let(:rep) do
|
298
|
-
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
299
|
-
ir.raw_paths = {
|
300
|
-
last: ['output/about/index.html'],
|
301
|
-
}
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
let(:item) do
|
306
|
-
Nanoc::Int::Item.new('content', {}, '/asdf.md')
|
307
|
-
end
|
308
|
-
|
309
|
-
context 'rep is not compiled' do
|
310
|
-
it 'creates a dependency' do
|
311
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([item])
|
312
|
-
end
|
313
|
-
|
314
|
-
it 'creates a dependency with the right props' do
|
315
|
-
subject
|
316
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
317
|
-
|
318
|
-
expect(dep.props.compiled_content?).to eq(true)
|
319
|
-
|
320
|
-
expect(dep.props.raw_content?).to eq(false)
|
321
|
-
expect(dep.props.attributes?).to eq(false)
|
322
|
-
expect(dep.props.path?).to eq(false)
|
323
|
-
end
|
324
|
-
|
325
|
-
it { should be_a(Nanoc::Int::Errors::UnmetDependency) }
|
326
|
-
end
|
327
|
-
|
328
|
-
context 'rep is compiled' do
|
329
|
-
before { rep.compiled = true }
|
330
|
-
|
331
|
-
it 'creates a dependency' do
|
332
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([item])
|
333
|
-
end
|
334
|
-
|
335
|
-
it 'creates a dependency with the right props' do
|
336
|
-
subject
|
337
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
338
|
-
|
339
|
-
expect(dep.props.compiled_content?).to eq(true)
|
340
|
-
|
341
|
-
expect(dep.props.raw_content?).to eq(false)
|
342
|
-
expect(dep.props.attributes?).to eq(false)
|
343
|
-
expect(dep.props.path?).to eq(false)
|
344
|
-
end
|
345
|
-
|
346
|
-
it { should eq('output/about/index.html') }
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
249
|
describe '#binary?' do
|
351
250
|
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
352
251
|
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo') }
|
@@ -389,7 +288,7 @@ describe Nanoc::ItemRepView do
|
|
389
288
|
subject { view.item }
|
390
289
|
|
391
290
|
it 'returns an item view' do
|
392
|
-
expect(subject).to be_a(
|
291
|
+
expect(subject).to be_a(expected_item_view_class)
|
393
292
|
end
|
394
293
|
|
395
294
|
it 'returns an item view with the right context' do
|
@@ -404,6 +303,6 @@ describe Nanoc::ItemRepView do
|
|
404
303
|
|
405
304
|
subject { view.inspect }
|
406
305
|
|
407
|
-
it { is_expected.to eql('<
|
306
|
+
it { is_expected.to eql('<' + described_class.to_s + ' item.identifier=/foo name=jacques>') }
|
408
307
|
end
|
409
308
|
end
|
@@ -4,17 +4,18 @@ shared_examples 'a mutable document view' do
|
|
4
4
|
let(:view) { described_class.new(document, view_context) }
|
5
5
|
|
6
6
|
let(:view_context) do
|
7
|
-
Nanoc::
|
8
|
-
reps:
|
9
|
-
items:
|
10
|
-
dependency_tracker:
|
7
|
+
Nanoc::ViewContextForCompilation.new(
|
8
|
+
reps: Nanoc::Int::ItemRepRepo.new,
|
9
|
+
items: Nanoc::Int::ItemCollection.new(config),
|
10
|
+
dependency_tracker: dependency_tracker,
|
11
11
|
compilation_context: double(:compilation_context),
|
12
|
-
snapshot_repo:
|
12
|
+
snapshot_repo: snapshot_repo,
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:dependency_tracker) { Nanoc::Int::DependencyTracker.new(double(:dependency_store)) }
|
17
17
|
let(:snapshot_repo) { double(:snapshot_repo) }
|
18
|
+
let(:config) { Nanoc::Int::Configuration.new }
|
18
19
|
|
19
20
|
describe '#raw_content=' do
|
20
21
|
let(:document) { entity_class.new('content', {}, '/asdf') }
|
@@ -73,7 +74,7 @@ shared_examples 'a mutable document view' do
|
|
73
74
|
end
|
74
75
|
|
75
76
|
it 'disallows item views' do
|
76
|
-
item = Nanoc::
|
77
|
+
item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('content', {}, '/foo.md'), nil)
|
77
78
|
expect { view[:item] = item }.to raise_error(Nanoc::MutableDocumentViewMixin::DisallowedAttributeValueError)
|
78
79
|
end
|
79
80
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Nanoc::CLI::Commands::CompileListeners::Abstract do
|
4
|
+
subject { klass.new }
|
5
|
+
|
6
|
+
context 'abstract class' do
|
7
|
+
let(:klass) { described_class }
|
8
|
+
|
9
|
+
it 'errors on starting' do
|
10
|
+
expect { subject.start }.to raise_error(NotImplementedError)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'stops silently' do
|
14
|
+
subject.stop
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'concrete subclass' do
|
19
|
+
let(:klass) do
|
20
|
+
Class.new(described_class) do
|
21
|
+
attr_reader :started
|
22
|
+
attr_reader :stopped
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@started = false
|
26
|
+
@stopped = false
|
27
|
+
end
|
28
|
+
|
29
|
+
def start
|
30
|
+
@started = true
|
31
|
+
end
|
32
|
+
|
33
|
+
def stop
|
34
|
+
@stopped = true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'starts' do
|
40
|
+
subject.start
|
41
|
+
expect(subject.started).to be
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'stops' do
|
45
|
+
subject.start
|
46
|
+
subject.stop
|
47
|
+
expect(subject.stopped).to be
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'starts safely' do
|
51
|
+
subject.start_safely
|
52
|
+
expect(subject.started).to be
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'stops safely' do
|
56
|
+
subject.start_safely
|
57
|
+
subject.stop_safely
|
58
|
+
expect(subject.stopped).to be
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'listener that does not start or stop properly' do
|
63
|
+
let(:klass) do
|
64
|
+
Class.new(described_class) do
|
65
|
+
def start
|
66
|
+
raise 'boom'
|
67
|
+
end
|
68
|
+
|
69
|
+
def stop
|
70
|
+
raise 'boom'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'raises on start, but not stop' do
|
76
|
+
expect { subject.start_safely }.to raise_error(RuntimeError)
|
77
|
+
expect { subject.stop_safely }.not_to raise_error
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -1,66 +1,45 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
describe Nanoc::CLI::Commands::
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
describe Nanoc::CLI::Commands::Compile, site: true, stdio: true do
|
4
|
+
describe '#run' do
|
5
|
+
example do
|
6
|
+
test_listener_class = Class.new(::Nanoc::CLI::Commands::CompileListeners::Abstract) do
|
7
|
+
def start
|
8
|
+
@started = true
|
9
|
+
end
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
11
|
+
def stop
|
12
|
+
@stopped = true
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
def started?
|
16
|
+
@started
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
def stopped?
|
20
|
+
@stopped
|
21
|
+
end
|
20
22
|
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
subject { klass.new }
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
24
|
+
expect(Nanoc::CLI::Commands::CompileListeners::Aggregate)
|
25
|
+
.to receive(:default_listener_classes)
|
26
|
+
.and_return([test_listener_class])
|
30
27
|
|
31
|
-
|
32
|
-
subject.start
|
33
|
-
subject.stop
|
34
|
-
expect(subject.stopped).to be
|
35
|
-
end
|
28
|
+
listener = test_listener_class.new
|
36
29
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
30
|
+
expect(test_listener_class)
|
31
|
+
.to receive(:new)
|
32
|
+
.and_return(listener)
|
41
33
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
34
|
+
options = {}
|
35
|
+
arguments = []
|
36
|
+
cmd = nil
|
37
|
+
cmd_runner = Nanoc::CLI::Commands::Compile.new(options, arguments, cmd)
|
47
38
|
|
48
|
-
|
49
|
-
let(:klass) do
|
50
|
-
Class.new(described_class) do
|
51
|
-
def start
|
52
|
-
raise 'boom'
|
53
|
-
end
|
54
|
-
|
55
|
-
def stop
|
56
|
-
raise 'boom'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
39
|
+
cmd_runner.run
|
60
40
|
|
61
|
-
|
62
|
-
expect
|
63
|
-
expect { subject.stop_safely }.not_to raise_error
|
41
|
+
expect(listener).to be_started
|
42
|
+
expect(listener).to be_stopped
|
64
43
|
end
|
65
44
|
end
|
66
45
|
end
|
@@ -153,11 +153,7 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
describe '#print_item_rep_outdatedness' do
|
156
|
-
subject { runner.send(:print_item_rep_outdatedness, items,
|
157
|
-
|
158
|
-
before do
|
159
|
-
runner.instance_variable_set(:@site, site)
|
160
|
-
end
|
156
|
+
subject { runner.send(:print_item_rep_outdatedness, items, outdatedness_checker, reps) }
|
161
157
|
|
162
158
|
let(:runner) do
|
163
159
|
described_class.new(options, arguments, command)
|
@@ -186,7 +182,6 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
|
|
186
182
|
let(:item_rep_dog) { Nanoc::Int::ItemRep.new(item_dog, :default) }
|
187
183
|
|
188
184
|
let(:site) { double(:site) }
|
189
|
-
let(:compiler) { double(:compiler) }
|
190
185
|
let(:outdatedness_checker) { double(:outdatedness_checker) }
|
191
186
|
|
192
187
|
let(:reps) do
|
@@ -196,14 +191,6 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
|
|
196
191
|
}
|
197
192
|
end
|
198
193
|
|
199
|
-
before do
|
200
|
-
allow(runner).to receive(:site).and_return(site)
|
201
|
-
allow(site).to receive(:compiler).and_return(compiler)
|
202
|
-
allow(compiler).to receive(:create_outdatedness_checker).and_return(outdatedness_checker)
|
203
|
-
allow(compiler).to receive(:reps).and_return(reps)
|
204
|
-
allow(compiler).to receive(:calculate_checksums)
|
205
|
-
end
|
206
|
-
|
207
194
|
context 'not outdated' do
|
208
195
|
before do
|
209
196
|
allow(outdatedness_checker).to receive(:outdatedness_reasons_for).with(item_rep_about).and_return([])
|
@@ -248,7 +235,7 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
|
|
248
235
|
end
|
249
236
|
|
250
237
|
describe '#print_layouts' do
|
251
|
-
subject { runner.send(:print_layouts, layouts,
|
238
|
+
subject { runner.send(:print_layouts, layouts, outdatedness_checker) }
|
252
239
|
|
253
240
|
let(:runner) do
|
254
241
|
described_class.new(options, arguments, command)
|
@@ -267,16 +254,8 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
|
|
267
254
|
let(:layout) { Nanoc::Int::Layout.new('stuff', {}, '/default.erb') }
|
268
255
|
|
269
256
|
let(:site) { double(:site) }
|
270
|
-
let(:compiler) { double(:compiler) }
|
271
257
|
let(:outdatedness_checker) { double(:outdatedness_checker) }
|
272
258
|
|
273
|
-
before do
|
274
|
-
allow(runner).to receive(:site).and_return(site)
|
275
|
-
allow(site).to receive(:compiler).and_return(compiler)
|
276
|
-
allow(compiler).to receive(:create_outdatedness_checker).and_return(outdatedness_checker)
|
277
|
-
allow(compiler).to receive(:calculate_checksums)
|
278
|
-
end
|
279
|
-
|
280
259
|
context 'not outdated' do
|
281
260
|
before do
|
282
261
|
allow(outdatedness_checker).to receive(:outdatedness_reasons_for).with(layout).and_return([])
|