Class: Nanoc::Core::Compiler
- Inherits:
-
Object
- Object
- Nanoc::Core::Compiler
show all
- Includes:
- ContractsSupport
- Defined in:
- lib/nanoc/core/compiler.rb
Class Method Summary
collapse
Instance Method Summary
collapse
enabled?, included, setup_once, warn_about_performance
Constructor Details
#initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:) ⇒ Compiler
Returns a new instance of Compiler.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/nanoc/core/compiler.rb', line 8
def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:)
@site = site
@output_dirs = @site.config.output_dirs
@compiled_content_cache = compiled_content_cache
@checksum_store = checksum_store
@action_sequence_store = action_sequence_store
@dependency_store = dependency_store
@action_provider = action_provider
@outdatedness_store = outdatedness_store
@compiled_content_store = Nanoc::Core::CompiledContentStore.new
end
|
Class Method Details
.compile(site) ⇒ Object
25
26
27
|
# File 'lib/nanoc/core/compiler.rb', line 25
def self.compile(site)
new_for(site).run_until_end
end
|
Instance Method Details
#compilation_context(reps:) ⇒ Object
95
96
97
98
99
100
101
102
103
|
# File 'lib/nanoc/core/compiler.rb', line 95
def compilation_context(reps:)
Nanoc::Core::CompilationContext.new(
action_provider: @action_provider,
reps: reps,
site: @site,
compiled_content_cache: @compiled_content_cache,
compiled_content_store: @compiled_content_store,
)
end
|
#run_until_end ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/nanoc/core/compiler.rb', line 78
def run_until_end
res = run_until_precompiled
action_sequences = res.fetch(:action_sequences)
reps = res.fetch(:reps)
checksums = res.fetch(:checksums)
outdated_items = res.fetch(:outdated_items)
forget_outdated_dependencies_stage.call(outdated_items)
store_pre_compilation_state_stage(action_sequences, reps).call(checksums)
prune_stage(reps).call
compile_reps_stage(action_sequences, reps).call
store_post_compilation_state_stage.call
postprocess_stage.call(self)
ensure
cleanup_stage.call
end
|
#run_until_precompiled ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/nanoc/core/compiler.rb', line 54
def run_until_precompiled
@_res_precompiled ||= begin
prev = run_until_reps_built
action_sequences = prev.fetch(:action_sequences)
reps = prev.fetch(:reps)
load_stores_stage.call
checksums = calculate_checksums_stage.call
outdatedness_checker = create_outdatedness_checker(
checksums: checksums,
action_sequences: action_sequences,
reps: reps,
)
outdated_items = determine_outdatedness_stage(outdatedness_checker, reps).call
prev.merge(
checksums: checksums,
dependency_store: @dependency_store,
outdatedness_checker: outdatedness_checker,
outdated_items: outdated_items,
)
end
end
|
#run_until_preprocessed ⇒ Object
34
35
36
37
38
39
|
# File 'lib/nanoc/core/compiler.rb', line 34
def run_until_preprocessed
@_res_preprocessed ||= begin
preprocess_stage.call
{}
end
end
|
#run_until_reps_built ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/nanoc/core/compiler.rb', line 41
def run_until_reps_built
@_res_reps_built ||= begin
prev = run_until_preprocessed
res = build_reps_stage.call
prev.merge(
reps: res.fetch(:reps),
action_sequences: res.fetch(:action_sequences),
)
end
end
|