nanoc-core 4.11.12 → 4.11.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nanoc/core.rb +37 -0
  3. data/lib/nanoc/core/basic_item_rep_collection_view.rb +88 -0
  4. data/lib/nanoc/core/basic_item_rep_view.rb +83 -0
  5. data/lib/nanoc/core/basic_item_view.rb +54 -0
  6. data/lib/nanoc/core/changes_stream.rb +55 -0
  7. data/lib/nanoc/core/checksum_store.rb +1 -1
  8. data/lib/nanoc/core/checksummer.rb +4 -2
  9. data/lib/nanoc/core/compilation_item_rep_collection_view.rb +12 -0
  10. data/lib/nanoc/core/compilation_item_rep_view.rb +57 -0
  11. data/lib/nanoc/core/compilation_item_view.rb +47 -0
  12. data/lib/nanoc/core/compilation_phases/abstract.rb +48 -0
  13. data/lib/nanoc/core/compilation_phases/cache.rb +43 -0
  14. data/lib/nanoc/core/compilation_phases/mark_done.rb +23 -0
  15. data/lib/nanoc/core/compilation_phases/notify.rb +19 -0
  16. data/lib/nanoc/core/compilation_phases/recalculate.rb +49 -0
  17. data/lib/nanoc/core/compilation_phases/resume.rb +52 -0
  18. data/lib/nanoc/core/compilation_phases/write.rb +84 -0
  19. data/lib/nanoc/core/compilation_stages/build_reps.rb +36 -0
  20. data/lib/nanoc/core/compilation_stages/calculate_checksums.rb +42 -0
  21. data/lib/nanoc/core/compilation_stages/cleanup.rb +43 -0
  22. data/lib/nanoc/core/compilation_stages/compile_reps.rb +96 -0
  23. data/lib/nanoc/core/compilation_stages/determine_outdatedness.rb +49 -0
  24. data/lib/nanoc/core/compilation_stages/forget_outdated_dependencies.rb +20 -0
  25. data/lib/nanoc/core/compilation_stages/load_stores.rb +35 -0
  26. data/lib/nanoc/core/compilation_stages/postprocess.rb +21 -0
  27. data/lib/nanoc/core/compilation_stages/preprocess.rb +32 -0
  28. data/lib/nanoc/core/compilation_stages/prune.rb +30 -0
  29. data/lib/nanoc/core/compilation_stages/store_post_compilation_state.rb +20 -0
  30. data/lib/nanoc/core/compilation_stages/store_pre_compilation_state.rb +32 -0
  31. data/lib/nanoc/core/compiled_content_cache.rb +2 -2
  32. data/lib/nanoc/core/compiler.rb +214 -0
  33. data/lib/nanoc/core/compiler_loader.rb +48 -0
  34. data/lib/nanoc/core/config_loader.rb +95 -0
  35. data/lib/nanoc/core/config_view.rb +67 -0
  36. data/lib/nanoc/core/configuration.rb +2 -4
  37. data/lib/nanoc/core/contracts_support.rb +20 -0
  38. data/lib/nanoc/core/dependency_store.rb +3 -3
  39. data/lib/nanoc/core/document_view_mixin.rb +87 -0
  40. data/lib/nanoc/core/errors.rb +108 -0
  41. data/lib/nanoc/core/executor.rb +134 -0
  42. data/lib/nanoc/core/feature.rb +92 -0
  43. data/lib/nanoc/core/filter.rb +269 -0
  44. data/lib/nanoc/core/identifiable_collection_view.rb +111 -0
  45. data/lib/nanoc/core/item_collection_with_reps_view.rb +12 -0
  46. data/lib/nanoc/core/item_collection_without_reps_view.rb +12 -0
  47. data/lib/nanoc/core/item_rep_builder.rb +54 -0
  48. data/lib/nanoc/core/item_rep_selector.rb +67 -0
  49. data/lib/nanoc/core/item_rep_writer.rb +85 -0
  50. data/lib/nanoc/core/layout_collection_view.rb +12 -0
  51. data/lib/nanoc/core/layout_view.rb +9 -0
  52. data/lib/nanoc/core/mutable_config_view.rb +16 -0
  53. data/lib/nanoc/core/mutable_document_view_mixin.rb +60 -0
  54. data/lib/nanoc/core/mutable_identifiable_collection_view.rb +19 -0
  55. data/lib/nanoc/core/mutable_item_collection_view.rb +34 -0
  56. data/lib/nanoc/core/mutable_item_view.rb +9 -0
  57. data/lib/nanoc/core/mutable_layout_collection_view.rb +26 -0
  58. data/lib/nanoc/core/mutable_layout_view.rb +9 -0
  59. data/lib/nanoc/core/outdatedness_checker.rb +222 -0
  60. data/lib/nanoc/core/outdatedness_rules/attributes_modified.rb +41 -0
  61. data/lib/nanoc/core/outdatedness_rules/code_snippets_modified.rb +31 -0
  62. data/lib/nanoc/core/outdatedness_rules/content_modified.rb +21 -0
  63. data/lib/nanoc/core/outdatedness_rules/item_collection_extended.rb +20 -0
  64. data/lib/nanoc/core/outdatedness_rules/layout_collection_extended.rb +20 -0
  65. data/lib/nanoc/core/outdatedness_rules/not_written.rb +17 -0
  66. data/lib/nanoc/core/outdatedness_rules/rules_modified.rb +45 -0
  67. data/lib/nanoc/core/outdatedness_rules/uses_always_outdated_filter.rb +26 -0
  68. data/lib/nanoc/core/post_compile_item_collection_view.rb +12 -0
  69. data/lib/nanoc/core/post_compile_item_rep_collection_view.rb +12 -0
  70. data/lib/nanoc/core/post_compile_item_rep_view.rb +33 -0
  71. data/lib/nanoc/core/post_compile_item_view.rb +20 -0
  72. data/lib/nanoc/core/pruner.rb +123 -0
  73. data/lib/nanoc/core/site_loader.rb +102 -0
  74. data/lib/nanoc/core/trivial_error.rb +10 -0
  75. data/lib/nanoc/core/version.rb +1 -1
  76. data/lib/nanoc/core/view.rb +43 -0
  77. data/lib/nanoc/core/view_context_for_compilation.rb +6 -6
  78. metadata +97 -3
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class Cleanup < Nanoc::Core::CompilationStage
7
+ def initialize(output_dirs)
8
+ @output_dirs = output_dirs
9
+ end
10
+
11
+ def run
12
+ cleanup_temps(Nanoc::Core::Filter::TMP_BINARY_ITEMS_DIR)
13
+ cleanup_temps(Nanoc::Core::ItemRepWriter::TMP_TEXT_ITEMS_DIR)
14
+ cleanup_unused_stores
15
+ cleanup_old_stores
16
+ end
17
+
18
+ private
19
+
20
+ def cleanup_temps(dir)
21
+ Nanoc::Core::TempFilenameFactory.instance.cleanup(dir)
22
+ end
23
+
24
+ def cleanup_unused_stores
25
+ used_paths = @output_dirs.map { |d| Nanoc::Core::Store.tmp_path_prefix(d) }
26
+ all_paths = Dir.glob('tmp/nanoc/*')
27
+ (all_paths - used_paths).each do |obsolete_path|
28
+ FileUtils.rm_rf(obsolete_path)
29
+ end
30
+ end
31
+
32
+ def cleanup_old_stores
33
+ %w[checksums compiled_content dependencies outdatedness action_sequence].each do |fn|
34
+ full_fn = File.join('tmp', fn)
35
+ if File.file?(full_fn)
36
+ FileUtils.rm_f(full_fn)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class CompileReps < Nanoc::Core::CompilationStage
7
+ include Nanoc::Core::ContractsSupport
8
+ include Nanoc::Core::Assertions::Mixin
9
+
10
+ def initialize(reps:, outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:)
11
+ @reps = reps
12
+ @outdatedness_store = outdatedness_store
13
+ @dependency_store = dependency_store
14
+ @action_sequences = action_sequences
15
+ @compilation_context = compilation_context
16
+ @compiled_content_cache = compiled_content_cache
17
+ end
18
+
19
+ def run
20
+ outdated_reps = @reps.select { |r| @outdatedness_store.include?(r) }
21
+ selector = Nanoc::Core::ItemRepSelector.new(outdated_reps)
22
+ run_phase_stack do |phase_stack|
23
+ selector.each do |rep|
24
+ handle_errors_while(rep) do
25
+ compile_rep(rep, phase_stack: phase_stack, is_outdated: @outdatedness_store.include?(rep))
26
+ end
27
+ end
28
+ end
29
+
30
+ assert Nanoc::Core::Assertions::AllItemRepsHaveCompiledContent.new(
31
+ compiled_content_cache: @compiled_content_cache,
32
+ item_reps: @reps,
33
+ )
34
+ ensure
35
+ @outdatedness_store.store
36
+ @compiled_content_cache.prune(items: @reps.map(&:item).uniq)
37
+ @compiled_content_cache.store
38
+ end
39
+
40
+ private
41
+
42
+ def handle_errors_while(item_rep)
43
+ yield
44
+ rescue Exception => e # rubocop:disable Lint/RescueException
45
+ raise Nanoc::Core::Errors::CompilationError.new(e, item_rep)
46
+ end
47
+
48
+ def compile_rep(rep, phase_stack:, is_outdated:)
49
+ phase_stack.call(rep, is_outdated: is_outdated)
50
+ end
51
+
52
+ def run_phase_stack
53
+ phase_stack = build_phase_stack
54
+ phase_stack.start
55
+ yield(phase_stack)
56
+ ensure
57
+ phase_stack.stop
58
+ end
59
+
60
+ def build_phase_stack
61
+ recalculate_phase = Nanoc::Core::CompilationPhases::Recalculate.new(
62
+ action_sequences: @action_sequences,
63
+ dependency_store: @dependency_store,
64
+ compilation_context: @compilation_context,
65
+ )
66
+
67
+ cache_phase = Nanoc::Core::CompilationPhases::Cache.new(
68
+ compiled_content_cache: @compiled_content_cache,
69
+ compiled_content_store: @compilation_context.compiled_content_store,
70
+ wrapped: recalculate_phase,
71
+ )
72
+
73
+ resume_phase = Nanoc::Core::CompilationPhases::Resume.new(
74
+ wrapped: cache_phase,
75
+ )
76
+
77
+ write_phase = Nanoc::Core::CompilationPhases::Write.new(
78
+ compiled_content_store: @compilation_context.compiled_content_store,
79
+ wrapped: resume_phase,
80
+ )
81
+
82
+ mark_done_phase = Nanoc::Core::CompilationPhases::MarkDone.new(
83
+ wrapped: write_phase,
84
+ outdatedness_store: @outdatedness_store,
85
+ )
86
+
87
+ notify_phrase = Nanoc::Core::CompilationPhases::Notify.new(
88
+ wrapped: mark_done_phase,
89
+ )
90
+
91
+ notify_phrase
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class DetermineOutdatedness < Nanoc::Core::CompilationStage
7
+ include Nanoc::Core::ContractsSupport
8
+
9
+ def initialize(reps:, outdatedness_checker:, outdatedness_store:)
10
+ @reps = reps
11
+ @outdatedness_checker = outdatedness_checker
12
+ @outdatedness_store = outdatedness_store
13
+ end
14
+
15
+ contract C::None => C::Any
16
+ def run
17
+ outdated_items = select_outdated_items
18
+ outdated_reps = reps_of_items(outdated_items)
19
+
20
+ store_outdated_reps(outdated_reps)
21
+
22
+ outdated_items
23
+ end
24
+
25
+ private
26
+
27
+ def store_outdated_reps(reps)
28
+ @outdatedness_store.clear
29
+ reps.each { |r| @outdatedness_store.add(r) }
30
+ end
31
+
32
+ def select_outdated_items
33
+ @reps
34
+ .select { |r| outdated?(r) }
35
+ .map(&:item)
36
+ .uniq
37
+ end
38
+
39
+ def reps_of_items(items)
40
+ Set.new(items.flat_map { |i| @reps[i] })
41
+ end
42
+
43
+ def outdated?(rep)
44
+ @outdatedness_store.include?(rep) || @outdatedness_checker.outdated?(rep)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class ForgetOutdatedDependencies < Nanoc::Core::CompilationStage
7
+ include Nanoc::Core::ContractsSupport
8
+
9
+ def initialize(dependency_store:)
10
+ @dependency_store = dependency_store
11
+ end
12
+
13
+ contract C::IterOf[Nanoc::Core::Item] => C::Any
14
+ def run(outdated_items)
15
+ outdated_items.each { |i| @dependency_store.forget_dependencies_for(i) }
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class LoadStores < Nanoc::Core::CompilationStage
7
+ include Nanoc::Core::ContractsSupport
8
+
9
+ def initialize(checksum_store:, compiled_content_cache:, dependency_store:, action_sequence_store:, outdatedness_store:)
10
+ @checksum_store = checksum_store
11
+ @compiled_content_cache = compiled_content_cache
12
+ @dependency_store = dependency_store
13
+ @action_sequence_store = action_sequence_store
14
+ @outdatedness_store = outdatedness_store
15
+ end
16
+
17
+ contract C::None => C::Any
18
+ def run
19
+ load_store(@checksum_store)
20
+ load_store(@compiled_content_cache)
21
+ load_store(@dependency_store)
22
+ load_store(@action_sequence_store)
23
+ load_store(@outdatedness_store)
24
+ end
25
+
26
+ contract Nanoc::Core::Store => C::Any
27
+ def load_store(store)
28
+ Nanoc::Core::Instrumentor.call(:store_loaded, store.class) do
29
+ store.load
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class Postprocess < Nanoc::Core::CompilationStage
7
+ include Nanoc::Core::ContractsSupport
8
+
9
+ def initialize(action_provider:, site:)
10
+ @action_provider = action_provider
11
+ @site = site
12
+ end
13
+
14
+ contract Nanoc::Core::Compiler => C::Any
15
+ def run(compiler)
16
+ @action_provider.postprocess(@site, compiler)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class Preprocess < Nanoc::Core::CompilationStage
7
+ def initialize(action_provider:, site:, dependency_store:, checksum_store:)
8
+ @action_provider = action_provider
9
+ @site = site
10
+ @dependency_store = dependency_store
11
+ @checksum_store = checksum_store
12
+ end
13
+
14
+ def run
15
+ return if @site.preprocessed?
16
+
17
+ if @action_provider.need_preprocessing?
18
+ @site.data_source = Nanoc::Core::InMemoryDataSource.new(@site.items, @site.layouts, @site.data_source)
19
+ @action_provider.preprocess(@site)
20
+
21
+ @dependency_store.items = @site.items
22
+ @dependency_store.layouts = @site.layouts
23
+ @checksum_store.objects = @site.items.to_a + @site.layouts.to_a + @site.code_snippets + [@site.config]
24
+ end
25
+
26
+ @site.mark_as_preprocessed
27
+ @site.freeze
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class Prune < Nanoc::Core::CompilationStage
7
+ def initialize(config:, reps:)
8
+ @config = config
9
+ @reps = reps
10
+ end
11
+
12
+ def run
13
+ if @config[:prune][:auto_prune]
14
+ Nanoc::Core::Pruner.new(@config, @reps, exclude: prune_config_exclude).run
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def prune_config
21
+ @config[:prune] || {}
22
+ end
23
+
24
+ def prune_config_exclude
25
+ prune_config[:exclude] || {}
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class StorePostCompilationState < Nanoc::Core::CompilationStage
7
+ include Nanoc::Core::ContractsSupport
8
+
9
+ def initialize(dependency_store:)
10
+ @dependency_store = dependency_store
11
+ end
12
+
13
+ contract C::None => C::Any
14
+ def run
15
+ @dependency_store.store
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module CompilationStages
6
+ class StorePreCompilationState < Nanoc::Core::CompilationStage
7
+ include Nanoc::Core::ContractsSupport
8
+
9
+ def initialize(reps:, layouts:, checksum_store:, action_sequence_store:, action_sequences:)
10
+ @reps = reps
11
+ @layouts = layouts
12
+ @checksum_store = checksum_store
13
+ @action_sequence_store = action_sequence_store
14
+ @action_sequences = action_sequences
15
+ end
16
+
17
+ contract Nanoc::Core::ChecksumCollection => C::Any
18
+ def run(checksums)
19
+ # Calculate action sequence
20
+ (@reps.to_a + @layouts.to_a).each do |obj|
21
+ @action_sequence_store[obj] = @action_sequences[obj].serialize
22
+ end
23
+ @action_sequence_store.store
24
+
25
+ # Set checksums
26
+ @checksum_store.checksums = checksums.to_h
27
+ @checksum_store.store
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -46,8 +46,8 @@ module Nanoc
46
46
  @binary_cache[rep] = content.select { |_key, c| c.binary? }
47
47
  end
48
48
 
49
- def prune(*args)
50
- @wrapped_caches.each { |w| w.prune(*args) }
49
+ def prune(items:)
50
+ @wrapped_caches.each { |w| w.prune(items: items) }
51
51
  end
52
52
 
53
53
  # True if there is cached compiled content available for this item, and
@@ -0,0 +1,214 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ class Compiler
6
+ include Nanoc::Core::ContractsSupport
7
+
8
+ def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:)
9
+ @site = site
10
+
11
+ # Needed because configuration is mutable :(
12
+ @output_dirs = @site.config.output_dirs
13
+
14
+ @compiled_content_cache = compiled_content_cache
15
+ @checksum_store = checksum_store
16
+ @action_sequence_store = action_sequence_store
17
+ @dependency_store = dependency_store
18
+ @action_provider = action_provider
19
+ @outdatedness_store = outdatedness_store
20
+
21
+ @compiled_content_store = Nanoc::Core::CompiledContentStore.new
22
+ end
23
+
24
+ contract Nanoc::Core::Site => C::Any
25
+ def self.compile(site)
26
+ new_for(site).run_until_end
27
+ end
28
+
29
+ contract Nanoc::Core::Site => Nanoc::Core::Compiler
30
+ def self.new_for(site)
31
+ Nanoc::Core::CompilerLoader.new.load(site)
32
+ end
33
+
34
+ def run_until_preprocessed
35
+ @_res_preprocessed ||= begin
36
+ preprocess_stage.call
37
+ {}
38
+ end
39
+ end
40
+
41
+ def run_until_reps_built
42
+ @_res_reps_built ||= begin
43
+ prev = run_until_preprocessed
44
+
45
+ res = build_reps_stage.call
46
+
47
+ prev.merge(
48
+ reps: res.fetch(:reps),
49
+ action_sequences: res.fetch(:action_sequences),
50
+ )
51
+ end
52
+ end
53
+
54
+ def run_until_precompiled
55
+ @_res_precompiled ||= begin
56
+ prev = run_until_reps_built
57
+ action_sequences = prev.fetch(:action_sequences)
58
+ reps = prev.fetch(:reps)
59
+
60
+ load_stores_stage.call
61
+ checksums = calculate_checksums_stage.call
62
+ outdatedness_checker = create_outdatedness_checker(
63
+ checksums: checksums,
64
+ action_sequences: action_sequences,
65
+ reps: reps,
66
+ )
67
+ outdated_items = determine_outdatedness_stage(outdatedness_checker, reps).call
68
+
69
+ prev.merge(
70
+ checksums: checksums,
71
+ dependency_store: @dependency_store,
72
+ outdatedness_checker: outdatedness_checker,
73
+ outdated_items: outdated_items,
74
+ )
75
+ end
76
+ end
77
+
78
+ def run_until_end
79
+ res = run_until_precompiled
80
+ action_sequences = res.fetch(:action_sequences)
81
+ reps = res.fetch(:reps)
82
+ checksums = res.fetch(:checksums)
83
+ outdated_items = res.fetch(:outdated_items)
84
+
85
+ forget_outdated_dependencies_stage.call(outdated_items)
86
+ store_pre_compilation_state_stage(action_sequences, reps).call(checksums)
87
+ prune_stage(reps).call
88
+ compile_reps_stage(action_sequences, reps).call
89
+ store_post_compilation_state_stage.call
90
+ postprocess_stage.call(self)
91
+ ensure
92
+ cleanup_stage.call
93
+ end
94
+
95
+ def compilation_context(reps:)
96
+ Nanoc::Core::CompilationContext.new(
97
+ action_provider: @action_provider,
98
+ reps: reps,
99
+ site: @site,
100
+ compiled_content_cache: @compiled_content_cache,
101
+ compiled_content_store: @compiled_content_store,
102
+ )
103
+ end
104
+
105
+ private
106
+
107
+ def create_outdatedness_checker(checksums:, action_sequences:, reps:)
108
+ Nanoc::Core::OutdatednessChecker.new(
109
+ site: @site,
110
+ checksum_store: @checksum_store,
111
+ dependency_store: @dependency_store,
112
+ action_sequence_store: @action_sequence_store,
113
+ action_sequences: action_sequences,
114
+ checksums: checksums,
115
+ reps: reps,
116
+ )
117
+ end
118
+
119
+ def preprocess_stage
120
+ @_preprocess_stage ||= ::Nanoc::Core::CompilationStages::Preprocess.new(
121
+ action_provider: @action_provider,
122
+ site: @site,
123
+ dependency_store: @dependency_store,
124
+ checksum_store: @checksum_store,
125
+ )
126
+ end
127
+
128
+ def build_reps_stage
129
+ @_build_reps_stage ||= ::Nanoc::Core::CompilationStages::BuildReps.new(
130
+ site: @site,
131
+ action_provider: @action_provider,
132
+ )
133
+ end
134
+
135
+ def prune_stage(reps)
136
+ @_prune_stage ||= ::Nanoc::Core::CompilationStages::Prune.new(
137
+ config: @site.config,
138
+ reps: reps,
139
+ )
140
+ end
141
+
142
+ def load_stores_stage
143
+ @_load_stores_stage ||= ::Nanoc::Core::CompilationStages::LoadStores.new(
144
+ checksum_store: @checksum_store,
145
+ compiled_content_cache: @compiled_content_cache,
146
+ dependency_store: @dependency_store,
147
+ action_sequence_store: @action_sequence_store,
148
+ outdatedness_store: @outdatedness_store,
149
+ )
150
+ end
151
+
152
+ def calculate_checksums_stage
153
+ @_calculate_checksums_stage ||= ::Nanoc::Core::CompilationStages::CalculateChecksums.new(
154
+ items: @site.items,
155
+ layouts: @site.layouts,
156
+ code_snippets: @site.code_snippets,
157
+ config: @site.config,
158
+ )
159
+ end
160
+
161
+ def determine_outdatedness_stage(outdatedness_checker, reps)
162
+ @_determine_outdatedness_stage ||= ::Nanoc::Core::CompilationStages::DetermineOutdatedness.new(
163
+ reps: reps,
164
+ outdatedness_checker: outdatedness_checker,
165
+ outdatedness_store: @outdatedness_store,
166
+ )
167
+ end
168
+
169
+ def store_pre_compilation_state_stage(action_sequences, reps)
170
+ @_store_pre_compilation_state_stage ||= ::Nanoc::Core::CompilationStages::StorePreCompilationState.new(
171
+ reps: reps,
172
+ layouts: @site.layouts,
173
+ checksum_store: @checksum_store,
174
+ action_sequence_store: @action_sequence_store,
175
+ action_sequences: action_sequences,
176
+ )
177
+ end
178
+
179
+ def compile_reps_stage(action_sequences, reps)
180
+ @_compile_reps_stage ||= ::Nanoc::Core::CompilationStages::CompileReps.new(
181
+ reps: reps,
182
+ outdatedness_store: @outdatedness_store,
183
+ dependency_store: @dependency_store,
184
+ action_sequences: action_sequences,
185
+ compilation_context: compilation_context(reps: reps),
186
+ compiled_content_cache: @compiled_content_cache,
187
+ )
188
+ end
189
+
190
+ def store_post_compilation_state_stage
191
+ @_store_post_compilation_state_stage ||= ::Nanoc::Core::CompilationStages::StorePostCompilationState.new(
192
+ dependency_store: @dependency_store,
193
+ )
194
+ end
195
+
196
+ def postprocess_stage
197
+ @_postprocess_stage ||= ::Nanoc::Core::CompilationStages::Postprocess.new(
198
+ action_provider: @action_provider,
199
+ site: @site,
200
+ )
201
+ end
202
+
203
+ def cleanup_stage
204
+ @_cleanup_stage ||= ::Nanoc::Core::CompilationStages::Cleanup.new(@output_dirs)
205
+ end
206
+
207
+ def forget_outdated_dependencies_stage
208
+ @_forget_outdated_dependencies_stage ||= ::Nanoc::Core::CompilationStages::ForgetOutdatedDependencies.new(
209
+ dependency_store: @dependency_store,
210
+ )
211
+ end
212
+ end
213
+ end
214
+ end