nanoc 4.7.3 → 4.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -5
  3. data/NEWS.md +7 -0
  4. data/lib/nanoc/base/entities.rb +1 -1
  5. data/lib/nanoc/base/entities/{rule_memory.rb → action_sequence.rb} +19 -1
  6. data/lib/nanoc/base/entities/outdatedness_reasons.rb +12 -4
  7. data/lib/nanoc/base/entities/outdatedness_status.rb +1 -1
  8. data/lib/nanoc/base/repos.rb +1 -1
  9. data/lib/nanoc/base/repos/{rule_memory_store.rb → action_sequence_store.rb} +12 -12
  10. data/lib/nanoc/base/repos/checksum_store.rb +3 -3
  11. data/lib/nanoc/base/services/action_provider.rb +1 -9
  12. data/lib/nanoc/base/services/checksummer.rb +4 -2
  13. data/lib/nanoc/base/services/compiler.rb +11 -11
  14. data/lib/nanoc/base/services/compiler/phases/recalculate.rb +3 -3
  15. data/lib/nanoc/base/services/compiler/stages/cleanup.rb +1 -1
  16. data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +3 -3
  17. data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +7 -2
  18. data/lib/nanoc/base/services/compiler_loader.rb +3 -3
  19. data/lib/nanoc/base/services/item_rep_builder.rb +4 -2
  20. data/lib/nanoc/base/services/item_rep_router.rb +7 -2
  21. data/lib/nanoc/base/services/outdatedness_checker.rb +30 -7
  22. data/lib/nanoc/base/services/outdatedness_rule.rb +7 -4
  23. data/lib/nanoc/base/services/outdatedness_rules.rb +9 -161
  24. data/lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb +34 -0
  25. data/lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb +26 -0
  26. data/lib/nanoc/base/services/outdatedness_rules/configuration_modified.rb +23 -0
  27. data/lib/nanoc/base/services/outdatedness_rules/content_modified.rb +15 -0
  28. data/lib/nanoc/base/services/outdatedness_rules/not_written.rb +11 -0
  29. data/lib/nanoc/base/services/outdatedness_rules/paths_modified.rb +20 -0
  30. data/lib/nanoc/base/services/outdatedness_rules/rules_modified.rb +13 -0
  31. data/lib/nanoc/base/services/outdatedness_rules/uses_always_outdated_filter.rb +20 -0
  32. data/lib/nanoc/rule_dsl.rb +1 -1
  33. data/lib/nanoc/rule_dsl/action_provider.rb +7 -11
  34. data/lib/nanoc/rule_dsl/{rule_memory_calculator.rb → action_sequence_calculator.rb} +21 -39
  35. data/lib/nanoc/rule_dsl/recording_executor.rb +7 -7
  36. data/lib/nanoc/spec.rb +7 -7
  37. data/lib/nanoc/version.rb +1 -1
  38. data/spec/nanoc/base/checksummer_spec.rb +20 -0
  39. data/spec/nanoc/base/compiler_spec.rb +7 -10
  40. data/spec/nanoc/base/entities/action_sequence_spec.rb +278 -0
  41. data/spec/nanoc/base/repos/checksum_store_spec.rb +22 -2
  42. data/spec/nanoc/base/services/compiler/stages/cleanup_spec.rb +2 -2
  43. data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +5 -9
  44. data/spec/nanoc/base/services/executor_spec.rb +5 -5
  45. data/spec/nanoc/base/services/item_rep_router_spec.rb +36 -18
  46. data/spec/nanoc/base/services/outdatedness_checker_spec.rb +74 -30
  47. data/spec/nanoc/base/services/outdatedness_rules_spec.rb +78 -18
  48. data/spec/nanoc/helpers/rendering_spec.rb +4 -4
  49. data/spec/nanoc/rule_dsl/{rule_memory_calculator_spec.rb → action_sequence_calculator_spec.rb} +6 -61
  50. data/spec/nanoc/rule_dsl/recording_executor_spec.rb +45 -45
  51. data/test/base/test_outdatedness_checker.rb +1 -1
  52. data/test/rule_dsl/test_action_provider.rb +3 -3
  53. metadata +15 -7
  54. data/spec/nanoc/base/entities/rule_memory_spec.rb +0 -167
@@ -2,7 +2,7 @@ describe Nanoc::Helpers::Rendering, helper: true do
2
2
  describe '#render' do
3
3
  subject { helper.instance_eval { render('/partial.erb') } }
4
4
 
5
- let(:rule_memory_for_layout) do
5
+ let(:action_sequence_for_layout) do
6
6
  [Nanoc::Int::ProcessingActions::Filter.new(:erb, {})]
7
7
  end
8
8
 
@@ -11,7 +11,7 @@ describe Nanoc::Helpers::Rendering, helper: true do
11
11
 
12
12
  before do
13
13
  ctx.create_layout(layout_content, {}, layout_identifier)
14
- ctx.update_rule_memory(layout, rule_memory_for_layout)
14
+ ctx.update_action_sequence(layout, action_sequence_for_layout)
15
15
  end
16
16
 
17
17
  context 'legacy identifier' do
@@ -87,7 +87,7 @@ describe Nanoc::Helpers::Rendering, helper: true do
87
87
  end
88
88
 
89
89
  context 'layout with unknown filter' do
90
- let(:rule_memory_for_layout) do
90
+ let(:action_sequence_for_layout) do
91
91
  [Nanoc::Int::ProcessingActions::Filter.new(:donkey, {})]
92
92
  end
93
93
 
@@ -99,7 +99,7 @@ describe Nanoc::Helpers::Rendering, helper: true do
99
99
  end
100
100
 
101
101
  context 'layout without filter' do
102
- let(:rule_memory_for_layout) do
102
+ let(:action_sequence_for_layout) do
103
103
  [Nanoc::Int::ProcessingActions::Filter.new(nil, {})]
104
104
  end
105
105
 
@@ -1,5 +1,5 @@
1
- describe(Nanoc::RuleDSL::RuleMemoryCalculator) do
2
- subject(:rule_memory_calculator) do
1
+ describe(Nanoc::RuleDSL::ActionSequenceCalculator) do
2
+ subject(:action_sequence_calculator) do
3
3
  described_class.new(site: site, rules_collection: rules_collection)
4
4
  end
5
5
 
@@ -7,7 +7,7 @@ describe(Nanoc::RuleDSL::RuleMemoryCalculator) do
7
7
  let(:site) { double(:site) }
8
8
 
9
9
  describe '#[]' do
10
- subject { rule_memory_calculator[obj] }
10
+ subject { action_sequence_calculator[obj] }
11
11
 
12
12
  context 'with item rep' do
13
13
  let(:obj) { Nanoc::Int::ItemRep.new(item, :csv) }
@@ -27,7 +27,7 @@ describe(Nanoc::RuleDSL::RuleMemoryCalculator) do
27
27
 
28
28
  context 'no rules exist' do
29
29
  it 'raises error' do
30
- error = Nanoc::RuleDSL::RuleMemoryCalculator::NoRuleMemoryForItemRepException
30
+ error = Nanoc::RuleDSL::ActionSequenceCalculator::NoActionSequenceForItemRepException
31
31
  expect { subject }.to raise_error(error)
32
32
  end
33
33
  end
@@ -142,7 +142,7 @@ describe(Nanoc::RuleDSL::RuleMemoryCalculator) do
142
142
 
143
143
  context 'no rules exist' do
144
144
  it 'raises error' do
145
- error = Nanoc::RuleDSL::RuleMemoryCalculator::NoRuleMemoryForLayoutException
145
+ error = Nanoc::RuleDSL::ActionSequenceCalculator::NoActionSequenceForLayoutException
146
146
  expect { subject }.to raise_error(error)
147
147
  end
148
148
  end
@@ -166,64 +166,9 @@ describe(Nanoc::RuleDSL::RuleMemoryCalculator) do
166
166
  let(:obj) { :donkey }
167
167
 
168
168
  it 'errors' do
169
- error = Nanoc::RuleDSL::RuleMemoryCalculator::UnsupportedObjectTypeException
169
+ error = Nanoc::RuleDSL::ActionSequenceCalculator::UnsupportedObjectTypeException
170
170
  expect { subject }.to raise_error(error)
171
171
  end
172
172
  end
173
173
  end
174
-
175
- describe '#snapshots_defs_for' do
176
- subject { rule_memory_calculator.snapshots_defs_for(rep) }
177
-
178
- let(:rep) { Nanoc::Int::ItemRep.new(item, :csv) }
179
-
180
- let(:item) { Nanoc::Int::Item.new('content', {}, Nanoc::Identifier.from('/list.md')) }
181
- let(:config) { Nanoc::Int::Configuration.new.with_defaults }
182
- let(:items) { Nanoc::Int::IdentifiableCollection.new(config) }
183
- let(:layouts) { Nanoc::Int::IdentifiableCollection.new(config) }
184
- let(:site) { double(:site, items: items, layouts: layouts, config: config, compiler: compiler) }
185
- let(:compiler) { double(:compiler, compilation_context: compilation_context) }
186
- let(:compilation_context) { double(:compilation_context) }
187
- let(:view_context) { double(:view_context) }
188
-
189
- before do
190
- Class.new(Nanoc::Filter) do
191
- identifier :rule_memory_calculator_spec_snapshot_def_test
192
- type text: :binary
193
-
194
- def run(content, params = {})
195
- # …
196
- end
197
- end
198
-
199
- rules_proc = proc do
200
- filter :erb, speed: :over_9000
201
- layout '/default.*'
202
- filter :rule_memory_calculator_spec_snapshot_def_test
203
- end
204
- rule = Nanoc::RuleDSL::Rule.new(Nanoc::Int::Pattern.from('/list.*'), :csv, rules_proc)
205
- rules_collection.add_item_compilation_rule(rule)
206
-
207
- expect(compilation_context).to receive(:create_view_context).and_return(view_context)
208
- end
209
-
210
- it 'creates snapshot defs' do
211
- expect(subject.size).to eql(4)
212
- expect(subject).to all(be_a(Nanoc::Int::SnapshotDef))
213
- end
214
-
215
- it 'has the right names' do
216
- expect(subject[0].name).to eql(:raw)
217
- expect(subject[1].name).to eql(:pre)
218
- expect(subject[2].name).to eql(:post)
219
- expect(subject[3].name).to eql(:last)
220
- end
221
-
222
- it 'has the right binary-ness' do
223
- expect(subject[0]).not_to be_binary
224
- expect(subject[1]).not_to be_binary
225
- expect(subject[2]).to be_binary
226
- expect(subject[3]).to be_binary
227
- end
228
- end
229
174
  end
@@ -1,26 +1,26 @@
1
1
  describe Nanoc::RuleDSL::RecordingExecutor do
2
- let(:executor) { described_class.new(rule_memory) }
2
+ let(:executor) { described_class.new(action_sequence) }
3
3
 
4
- let(:rule_memory) { Nanoc::Int::RuleMemory.new(rep) }
4
+ let(:action_sequence) { Nanoc::Int::ActionSequence.new(rep) }
5
5
  let(:rep) { double(:rep) }
6
6
 
7
7
  describe '#filter' do
8
8
  it 'records filter call without arguments' do
9
9
  executor.filter(:erb)
10
10
 
11
- expect(rule_memory.size).to eql(1)
12
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Filter)
13
- expect(rule_memory[0].filter_name).to eql(:erb)
14
- expect(rule_memory[0].params).to eql({})
11
+ expect(action_sequence.size).to eql(1)
12
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Filter)
13
+ expect(action_sequence[0].filter_name).to eql(:erb)
14
+ expect(action_sequence[0].params).to eql({})
15
15
  end
16
16
 
17
17
  it 'records filter call with arguments' do
18
18
  executor.filter(:erb, x: 123)
19
19
 
20
- expect(rule_memory.size).to eql(1)
21
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Filter)
22
- expect(rule_memory[0].filter_name).to eql(:erb)
23
- expect(rule_memory[0].params).to eql(x: 123)
20
+ expect(action_sequence.size).to eql(1)
21
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Filter)
22
+ expect(action_sequence[0].filter_name).to eql(:erb)
23
+ expect(action_sequence[0].params).to eql(x: 123)
24
24
  end
25
25
  end
26
26
 
@@ -28,29 +28,29 @@ describe Nanoc::RuleDSL::RecordingExecutor do
28
28
  it 'records layout call without arguments' do
29
29
  executor.layout('/default.*')
30
30
 
31
- expect(rule_memory.size).to eql(2)
31
+ expect(action_sequence.size).to eql(2)
32
32
 
33
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
34
- expect(rule_memory[0].snapshot_names).to eql([:pre])
35
- expect(rule_memory[0].paths).to be_empty
33
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
34
+ expect(action_sequence[0].snapshot_names).to eql([:pre])
35
+ expect(action_sequence[0].paths).to be_empty
36
36
 
37
- expect(rule_memory[1]).to be_a(Nanoc::Int::ProcessingActions::Layout)
38
- expect(rule_memory[1].layout_identifier).to eql('/default.*')
39
- expect(rule_memory[1].params).to eql({})
37
+ expect(action_sequence[1]).to be_a(Nanoc::Int::ProcessingActions::Layout)
38
+ expect(action_sequence[1].layout_identifier).to eql('/default.*')
39
+ expect(action_sequence[1].params).to eql({})
40
40
  end
41
41
 
42
42
  it 'records layout call with arguments' do
43
43
  executor.layout('/default.*', donkey: 123)
44
44
 
45
- expect(rule_memory.size).to eql(2)
45
+ expect(action_sequence.size).to eql(2)
46
46
 
47
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
48
- expect(rule_memory[0].snapshot_names).to eql([:pre])
49
- expect(rule_memory[0].paths).to be_empty
47
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
48
+ expect(action_sequence[0].snapshot_names).to eql([:pre])
49
+ expect(action_sequence[0].paths).to be_empty
50
50
 
51
- expect(rule_memory[1]).to be_a(Nanoc::Int::ProcessingActions::Layout)
52
- expect(rule_memory[1].layout_identifier).to eql('/default.*')
53
- expect(rule_memory[1].params).to eql(donkey: 123)
51
+ expect(action_sequence[1]).to be_a(Nanoc::Int::ProcessingActions::Layout)
52
+ expect(action_sequence[1].layout_identifier).to eql('/default.*')
53
+ expect(action_sequence[1].params).to eql(donkey: 123)
54
54
  end
55
55
 
56
56
  it 'fails when passed a symbol' do
@@ -75,10 +75,10 @@ describe Nanoc::RuleDSL::RecordingExecutor do
75
75
 
76
76
  it 'records' do
77
77
  subject
78
- expect(rule_memory.size).to eql(1)
79
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
80
- expect(rule_memory[0].snapshot_names).to eql([:foo])
81
- expect(rule_memory[0].paths).to be_empty
78
+ expect(action_sequence.size).to eql(1)
79
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
80
+ expect(action_sequence[0].snapshot_names).to eql([:foo])
81
+ expect(action_sequence[0].paths).to be_empty
82
82
  end
83
83
  end
84
84
 
@@ -90,10 +90,10 @@ describe Nanoc::RuleDSL::RecordingExecutor do
90
90
  context 'no explicit path given' do
91
91
  it 'records' do
92
92
  subject
93
- expect(rule_memory.size).to eql(1)
94
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
95
- expect(rule_memory[0].snapshot_names).to eql([:foo])
96
- expect(rule_memory[0].paths).to be_empty
93
+ expect(action_sequence.size).to eql(1)
94
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
95
+ expect(action_sequence[0].snapshot_names).to eql([:foo])
96
+ expect(action_sequence[0].paths).to be_empty
97
97
  end
98
98
  end
99
99
 
@@ -102,10 +102,10 @@ describe Nanoc::RuleDSL::RecordingExecutor do
102
102
 
103
103
  it 'records' do
104
104
  subject
105
- expect(rule_memory.size).to eql(1)
106
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
107
- expect(rule_memory[0].snapshot_names).to eql([:foo])
108
- expect(rule_memory[0].paths).to eql(['/routed-foo.html'])
105
+ expect(action_sequence.size).to eql(1)
106
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
107
+ expect(action_sequence[0].snapshot_names).to eql([:foo])
108
+ expect(action_sequence[0].paths).to eql(['/routed-foo.html'])
109
109
  end
110
110
  end
111
111
 
@@ -114,10 +114,10 @@ describe Nanoc::RuleDSL::RecordingExecutor do
114
114
 
115
115
  it 'records' do
116
116
  subject
117
- expect(rule_memory.size).to eql(1)
118
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
119
- expect(rule_memory[0].snapshot_names).to eql([:foo])
120
- expect(rule_memory[0].paths).to eql(['/routed-foo.html'])
117
+ expect(action_sequence.size).to eql(1)
118
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
119
+ expect(action_sequence[0].snapshot_names).to eql([:foo])
120
+ expect(action_sequence[0].paths).to eql(['/routed-foo.html'])
121
121
  end
122
122
  end
123
123
  end
@@ -132,11 +132,11 @@ describe Nanoc::RuleDSL::RecordingExecutor do
132
132
  executor.snapshot(:foo)
133
133
  executor.snapshot(:bar)
134
134
 
135
- expect(rule_memory.size).to eql(2)
136
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
137
- expect(rule_memory[0].snapshot_names).to eql([:foo])
138
- expect(rule_memory[1]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
139
- expect(rule_memory[1].snapshot_names).to eql([:bar])
135
+ expect(action_sequence.size).to eql(2)
136
+ expect(action_sequence[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
137
+ expect(action_sequence[0].snapshot_names).to eql([:foo])
138
+ expect(action_sequence[1]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
139
+ expect(action_sequence[1].snapshot_names).to eql([:bar])
140
140
  end
141
141
  end
142
142
  end
@@ -124,7 +124,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
124
124
  site.compiler.load_stores
125
125
  outdatedness_checker = site.compiler.send :outdatedness_checker
126
126
  rep = site.compiler.reps[site.items.find { |i| i.identifier == '/new/' }][0]
127
- assert_equal ::Nanoc::Int::OutdatednessReasons::AttributesModified, outdatedness_checker.outdatedness_reason_for(rep)
127
+ assert_equal ::Nanoc::Int::OutdatednessReasons::AttributesModified, outdatedness_checker.outdatedness_reason_for(rep).class
128
128
  end
129
129
  end
130
130
 
@@ -4,13 +4,13 @@ class Nanoc::RuleDSL::ActionProviderTest < Nanoc::TestCase
4
4
  def new_action_provider(site)
5
5
  rules_collection = Nanoc::RuleDSL::RulesCollection.new
6
6
 
7
- rule_memory_calculator =
8
- Nanoc::RuleDSL::RuleMemoryCalculator.new(
7
+ action_sequence_calculator =
8
+ Nanoc::RuleDSL::ActionSequenceCalculator.new(
9
9
  rules_collection: rules_collection, site: site,
10
10
  )
11
11
 
12
12
  action_provider = Nanoc::RuleDSL::ActionProvider.new(
13
- rules_collection, rule_memory_calculator
13
+ rules_collection, action_sequence_calculator
14
14
  )
15
15
 
16
16
  Nanoc::RuleDSL::RulesLoader.new(site.config, rules_collection).load
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.7.3
4
+ version: 4.7.4
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-03-26 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -131,6 +131,7 @@ files:
131
131
  - lib/nanoc/base/core_ext/pathname.rb
132
132
  - lib/nanoc/base/core_ext/string.rb
133
133
  - lib/nanoc/base/entities.rb
134
+ - lib/nanoc/base/entities/action_sequence.rb
134
135
  - lib/nanoc/base/entities/code_snippet.rb
135
136
  - lib/nanoc/base/entities/configuration.rb
136
137
  - lib/nanoc/base/entities/content.rb
@@ -153,7 +154,6 @@ files:
153
154
  - lib/nanoc/base/entities/processing_actions/layout.rb
154
155
  - lib/nanoc/base/entities/processing_actions/snapshot.rb
155
156
  - lib/nanoc/base/entities/props.rb
156
- - lib/nanoc/base/entities/rule_memory.rb
157
157
  - lib/nanoc/base/entities/site.rb
158
158
  - lib/nanoc/base/entities/snapshot_def.rb
159
159
  - lib/nanoc/base/error.rb
@@ -161,6 +161,7 @@ files:
161
161
  - lib/nanoc/base/feature.rb
162
162
  - lib/nanoc/base/memoization.rb
163
163
  - lib/nanoc/base/repos.rb
164
+ - lib/nanoc/base/repos/action_sequence_store.rb
164
165
  - lib/nanoc/base/repos/aggregate_data_source.rb
165
166
  - lib/nanoc/base/repos/checksum_store.rb
166
167
  - lib/nanoc/base/repos/compiled_content_cache.rb
@@ -171,7 +172,6 @@ files:
171
172
  - lib/nanoc/base/repos/item_rep_repo.rb
172
173
  - lib/nanoc/base/repos/outdatedness_store.rb
173
174
  - lib/nanoc/base/repos/prefixed_data_source.rb
174
- - lib/nanoc/base/repos/rule_memory_store.rb
175
175
  - lib/nanoc/base/repos/site_loader.rb
176
176
  - lib/nanoc/base/repos/snapshot_repo.rb
177
177
  - lib/nanoc/base/repos/store.rb
@@ -204,6 +204,14 @@ files:
204
204
  - lib/nanoc/base/services/outdatedness_checker.rb
205
205
  - lib/nanoc/base/services/outdatedness_rule.rb
206
206
  - lib/nanoc/base/services/outdatedness_rules.rb
207
+ - lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb
208
+ - lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
209
+ - lib/nanoc/base/services/outdatedness_rules/configuration_modified.rb
210
+ - lib/nanoc/base/services/outdatedness_rules/content_modified.rb
211
+ - lib/nanoc/base/services/outdatedness_rules/not_written.rb
212
+ - lib/nanoc/base/services/outdatedness_rules/paths_modified.rb
213
+ - lib/nanoc/base/services/outdatedness_rules/rules_modified.rb
214
+ - lib/nanoc/base/services/outdatedness_rules/uses_always_outdated_filter.rb
207
215
  - lib/nanoc/base/services/pruner.rb
208
216
  - lib/nanoc/base/services/temp_filename_factory.rb
209
217
  - lib/nanoc/base/views.rb
@@ -334,11 +342,11 @@ files:
334
342
  - lib/nanoc/helpers/xml_sitemap.rb
335
343
  - lib/nanoc/rule_dsl.rb
336
344
  - lib/nanoc/rule_dsl/action_provider.rb
345
+ - lib/nanoc/rule_dsl/action_sequence_calculator.rb
337
346
  - lib/nanoc/rule_dsl/compiler_dsl.rb
338
347
  - lib/nanoc/rule_dsl/recording_executor.rb
339
348
  - lib/nanoc/rule_dsl/rule.rb
340
349
  - lib/nanoc/rule_dsl/rule_context.rb
341
- - lib/nanoc/rule_dsl/rule_memory_calculator.rb
342
350
  - lib/nanoc/rule_dsl/rules_collection.rb
343
351
  - lib/nanoc/rule_dsl/rules_loader.rb
344
352
  - lib/nanoc/spec.rb
@@ -355,6 +363,7 @@ files:
355
363
  - spec/nanoc/base/checksummer_spec.rb
356
364
  - spec/nanoc/base/compiler_spec.rb
357
365
  - spec/nanoc/base/directed_graph_spec.rb
366
+ - spec/nanoc/base/entities/action_sequence_spec.rb
358
367
  - spec/nanoc/base/entities/configuration_spec.rb
359
368
  - spec/nanoc/base/entities/content_spec.rb
360
369
  - spec/nanoc/base/entities/document_spec.rb
@@ -371,7 +380,6 @@ files:
371
380
  - spec/nanoc/base/entities/processing_actions/layout_spec.rb
372
381
  - spec/nanoc/base/entities/processing_actions/snapshot_spec.rb
373
382
  - spec/nanoc/base/entities/props_spec.rb
374
- - spec/nanoc/base/entities/rule_memory_spec.rb
375
383
  - spec/nanoc/base/entities/site_spec.rb
376
384
  - spec/nanoc/base/errors/dependency_cycle_spec.rb
377
385
  - spec/nanoc/base/feature_spec.rb
@@ -500,9 +508,9 @@ files:
500
508
  - spec/nanoc/regressions/gh_970b_spec.rb
501
509
  - spec/nanoc/regressions/gh_974_spec.rb
502
510
  - spec/nanoc/regressions/gh_981_spec.rb
511
+ - spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb
503
512
  - spec/nanoc/rule_dsl/recording_executor_spec.rb
504
513
  - spec/nanoc/rule_dsl/rule_context_spec.rb
505
- - spec/nanoc/rule_dsl/rule_memory_calculator_spec.rb
506
514
  - spec/nanoc/rule_dsl/rules_collection_spec.rb
507
515
  - spec/nanoc/spec_spec.rb
508
516
  - spec/nanoc/telemetry/counter_spec.rb
@@ -1,167 +0,0 @@
1
- describe Nanoc::Int::RuleMemory do
2
- let(:rule_memory) { described_class.new(rep) }
3
- let(:rep) { double(:rep) }
4
-
5
- describe '#size' do
6
- subject { rule_memory.size }
7
-
8
- context 'no actions' do
9
- it { is_expected.to eql(0) }
10
- end
11
-
12
- context 'some actions' do
13
- before do
14
- rule_memory.add_filter(:foo, {})
15
- end
16
-
17
- it { is_expected.to eql(1) }
18
- end
19
- end
20
-
21
- describe '#[]' do
22
- subject { rule_memory[index] }
23
- let(:index) { 0 }
24
-
25
- context 'no actions' do
26
- it { is_expected.to be_nil }
27
- end
28
-
29
- context 'some actions' do
30
- before do
31
- rule_memory.add_filter(:foo, {})
32
- end
33
-
34
- it { is_expected.to be_a(Nanoc::Int::ProcessingActions::Filter) }
35
- end
36
- end
37
-
38
- describe '#add_filter' do
39
- example do
40
- rule_memory.add_filter(:foo, donkey: 123)
41
-
42
- expect(rule_memory.size).to eql(1)
43
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Filter)
44
- expect(rule_memory[0].filter_name).to eql(:foo)
45
- expect(rule_memory[0].params).to eql(donkey: 123)
46
- end
47
- end
48
-
49
- describe '#add_layout' do
50
- example do
51
- rule_memory.add_layout('/foo.*', donkey: 123)
52
-
53
- expect(rule_memory.size).to eql(1)
54
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Layout)
55
- expect(rule_memory[0].layout_identifier).to eql('/foo.*')
56
- expect(rule_memory[0].params).to eql(donkey: 123)
57
- end
58
- end
59
-
60
- describe '#add_snapshot' do
61
- context 'snapshot does not yet exist' do
62
- example do
63
- rule_memory.add_snapshot(:before_layout, '/foo.md')
64
-
65
- expect(rule_memory.size).to eql(1)
66
- expect(rule_memory[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
67
- expect(rule_memory[0].snapshot_names).to eql([:before_layout])
68
- expect(rule_memory[0].paths).to eql(['/foo.md'])
69
- end
70
- end
71
-
72
- context 'snapshot already exist' do
73
- before do
74
- rule_memory.add_snapshot(:before_layout, '/bar.md')
75
- end
76
-
77
- it 'raises' do
78
- expect { rule_memory.add_snapshot(:before_layout, '/foo.md') }
79
- .to raise_error(Nanoc::Int::Errors::CannotCreateMultipleSnapshotsWithSameName)
80
- end
81
- end
82
- end
83
-
84
- describe '#each' do
85
- before do
86
- rule_memory.add_filter(:erb, awesomeness: 'high')
87
- rule_memory.add_snapshot(:bar, '/foo.md')
88
- rule_memory.add_layout('/default.erb', somelayoutparam: 'yes')
89
- end
90
-
91
- example do
92
- actions = []
93
- rule_memory.each { |a| actions << a }
94
- expect(actions.size).to eq(3)
95
- end
96
- end
97
-
98
- describe '#map' do
99
- before do
100
- rule_memory.add_filter(:erb, awesomeness: 'high')
101
- rule_memory.add_snapshot(:bar, '/foo.md')
102
- rule_memory.add_layout('/default.erb', somelayoutparam: 'yes')
103
- end
104
-
105
- example do
106
- res = rule_memory.map { Nanoc::Int::ProcessingActions::Filter.new(:donkey, {}) }
107
- expect(res.to_a.size).to eq(3)
108
- expect(res.to_a).to all(be_a(Nanoc::Int::ProcessingActions::Filter))
109
- end
110
- end
111
-
112
- describe '#serialize' do
113
- subject { rule_memory.serialize }
114
-
115
- before do
116
- rule_memory.add_filter(:erb, awesomeness: 'high')
117
- rule_memory.add_snapshot(:bar, '/foo.md')
118
- rule_memory.add_layout('/default.erb', somelayoutparam: 'yes')
119
- end
120
-
121
- example do
122
- expect(subject).to eql(
123
- [
124
- [:filter, :erb, 'PeWUm2PtXYtqeHJdTqnY7kkwAow='],
125
- [:snapshot, [:bar], true, ['/foo.md']],
126
- [:layout, '/default.erb', '97LAe1pYTLKczxBsu+x4MmvqdkU='],
127
- ],
128
- )
129
- end
130
- end
131
-
132
- describe '#compact_snapshots' do
133
- subject { rule_memory.compact_snapshots }
134
-
135
- before do
136
- rule_memory.add_snapshot(:a1, nil)
137
- rule_memory.add_snapshot(:a2, '/a2.md')
138
- rule_memory.add_snapshot(:a3, nil)
139
- rule_memory.add_filter(:erb, awesomeness: 'high')
140
- rule_memory.add_snapshot(:b1, '/b1.md')
141
- rule_memory.add_snapshot(:b2, nil)
142
- rule_memory.add_snapshot(:b3, '/b3.md')
143
- rule_memory.add_filter(:erb, awesomeness: 'high')
144
- rule_memory.add_snapshot(:c, nil)
145
- end
146
-
147
- example do
148
- expect(subject[0]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
149
- expect(subject[0].snapshot_names).to eql(%i(a1 a2 a3))
150
- expect(subject[0].paths).to eql(['/a2.md'])
151
-
152
- expect(subject[1]).to be_a(Nanoc::Int::ProcessingActions::Filter)
153
-
154
- expect(subject[2]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
155
- expect(subject[2].snapshot_names).to eql(%i(b1 b2 b3))
156
- expect(subject[2].paths).to eql(['/b1.md', '/b3.md'])
157
-
158
- expect(subject[3]).to be_a(Nanoc::Int::ProcessingActions::Filter)
159
-
160
- expect(subject[4]).to be_a(Nanoc::Int::ProcessingActions::Snapshot)
161
- expect(subject[4].snapshot_names).to eql([:c])
162
- expect(subject[4].paths).to be_empty
163
-
164
- expect(subject.size).to eql(5)
165
- end
166
- end
167
- end