lib/nanoc/base/compilation/compiler.rb in nanoc-4.0.0b4 vs lib/nanoc/base/compilation/compiler.rb in nanoc-4.0.0rc1
- old
+ new
@@ -108,17 +108,14 @@
# @return [void]
def load
return if @loaded || @loading
@loading = true
- # Load site if necessary
- site.load
-
# Preprocess
rules_collection.load
preprocess
- site.setup_child_parent_links
+ Nanoc::Int::SiteLoader.new.setup_child_parent_links(site.items)
build_reps
route_reps
# Load auxiliary stores
stores.each(&:load)
@@ -141,15 +138,12 @@
stores.each(&:unload)
@stack = []
items.each { |item| item.reps.clear }
- site.teardown_child_parent_links
rules_collection.unload
- site.unload
-
@loaded = false
@unloading = false
end
# Store the modified helper data used for compiling the site.
@@ -258,13 +252,13 @@
# operation
#
# @api private
def assigns_for(rep)
if rep.binary?
- content_or_filename_assigns = { filename: rep.content_snapshots[:last].filename }
+ content_or_filename_assigns = { filename: rep.snapshot_contents[:last].filename }
else
- content_or_filename_assigns = { content: rep.content_snapshots[:last].string }
+ content_or_filename_assigns = { content: rep.snapshot_contents[:last].string }
end
# TODO: Do not expose @site (necessary for captures store though…)
content_or_filename_assigns.merge({
item: Nanoc::ItemView.new(rep.item),
@@ -318,11 +312,11 @@
Nanoc::Int::NotificationCenter.on(:processing_started, self) { |obj| @stack.push(obj) }
Nanoc::Int::NotificationCenter.on(:processing_ended, self) { |_obj| @stack.pop }
# Assign snapshots
reps.each do |rep|
- rep.snapshots = rules_collection.snapshots_for(rep)
+ rep.snapshot_defs = rules_collection.snapshots_defs_for(rep)
end
# Attempt to compile all active reps
loop do
# Find rep to compile
@@ -371,22 +365,22 @@
rules_collection.new_rule_memory_for_rep(rep)
if !rep.item.forced_outdated? && !outdatedness_checker.outdated?(rep) && compiled_content_cache[rep]
# Reuse content
Nanoc::Int::NotificationCenter.post(:cached_content_used, rep)
- rep.content_snapshots = compiled_content_cache[rep]
+ rep.snapshot_contents = compiled_content_cache[rep]
else
# Recalculate content
executor.snapshot(rep, :raw)
executor.snapshot(rep, :pre, final: false)
rules_collection.compilation_rule_for(rep).apply_to(rep, executor: executor, compiler: self)
executor.snapshot(rep, :post) if rep.has_snapshot?(:post)
executor.snapshot(rep, :last)
end
rep.compiled = true
- compiled_content_cache[rep] = rep.content_snapshots
+ compiled_content_cache[rep] = rep.snapshot_contents
Nanoc::Int::NotificationCenter.post(:processing_ended, rep)
Nanoc::Int::NotificationCenter.post(:compilation_ended, rep)
rescue => e
rep.forget_progress
@@ -449,10 +443,10 @@
def stores
[
checksum_store,
compiled_content_cache,
dependency_tracker,
- rule_memory_store
+ rule_memory_store,
]
end
end
end