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:, focus:) ⇒ Compiler
Returns a new instance of Compiler.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/nanoc/core/compiler.rb', line 18
def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:, focus:)
@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
@focus = focus
@compiled_content_store = Nanoc::Core::CompiledContentStore.new
end
|
Class Method Details
.compile(site, focus: nil) ⇒ Object
9
10
11
|
# File 'lib/nanoc/core/compiler.rb', line 9
def self.compile(site, focus: nil)
new_for(site, focus:).run_until_end
end
|
.new_for(site, focus: nil) ⇒ Object
14
15
16
|
# File 'lib/nanoc/core/compiler.rb', line 14
def self.new_for(site, focus: nil)
Nanoc::Core::CompilerLoader.new.load(site, focus:)
end
|
Instance Method Details
#compilation_context(reps:) ⇒ Object
96
97
98
99
100
101
102
103
104
|
# File 'lib/nanoc/core/compiler.rb', line 96
def compilation_context(reps:)
Nanoc::Core::CompilationContext.new(
action_provider: @action_provider,
reps:,
site: @site,
compiled_content_cache: @compiled_content_cache,
compiled_content_store: @compiled_content_store,
)
end
|
#run_until_end ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/nanoc/core/compiler.rb', line 79
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/nanoc/core/compiler.rb', line 55
def run_until_precompiled
@_run_until_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:,
action_sequences:,
reps:,
)
outdated_items = determine_outdatedness_stage(outdatedness_checker, reps).call
prev.merge(
checksums:,
dependency_store: @dependency_store,
outdatedness_checker:,
outdated_items:,
)
end
end
|
#run_until_preprocessed ⇒ Object
35
36
37
38
39
40
|
# File 'lib/nanoc/core/compiler.rb', line 35
def run_until_preprocessed
@_run_until_preprocessed ||= begin
preprocess_stage.call
{}
end
end
|
#run_until_reps_built ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/nanoc/core/compiler.rb', line 42
def run_until_reps_built
@_run_until_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
|