/
compiler_loader.rb
48 lines (39 loc) · 1.48 KB
/
compiler_loader.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module Nanoc::Int
# @api private
class CompilerLoader
def load(site, action_provider: nil)
rule_memory_store = Nanoc::Int::RuleMemoryStore.new(env_name: site.config.env_name)
dependency_store =
Nanoc::Int::DependencyStore.new(site.items.to_a + site.layouts.to_a, env_name: site.config.env_name)
objects = site.items.to_a + site.layouts.to_a + site.code_snippets + [site.config]
checksum_store =
Nanoc::Int::ChecksumStore.new(site: site, objects: objects)
item_rep_repo = Nanoc::Int::ItemRepRepo.new
action_provider ||= Nanoc::Int::ActionProvider.named(:rule_dsl).for(site)
outdatedness_checker =
Nanoc::Int::OutdatednessChecker.new(
site: site,
checksum_store: checksum_store,
dependency_store: dependency_store,
rule_memory_store: rule_memory_store,
action_provider: action_provider,
reps: item_rep_repo,
)
compiled_content_cache =
Nanoc::Int::CompiledContentCache.new(
env_name: site.config.env_name,
items: site.items,
)
params = {
compiled_content_cache: compiled_content_cache,
checksum_store: checksum_store,
rule_memory_store: rule_memory_store,
dependency_store: dependency_store,
outdatedness_checker: outdatedness_checker,
reps: item_rep_repo,
action_provider: action_provider,
}
Nanoc::Int::Compiler.new(site, params)
end
end
end