lib/nanoc/base/services/compiler.rb in nanoc-4.4.5 vs lib/nanoc/base/services/compiler.rb in nanoc-4.4.6
- old
+ new
@@ -73,11 +73,11 @@
end
end
# Provides functionality for (re)calculating the content of an item rep, without caching or
# outdatedness checking.
- class RecalculatingItemRepCompiler
+ class RecalculatePhase
include Nanoc::Int::ContractsSupport
def initialize(action_provider:, dependency_store:, compilation_context:)
@action_provider = action_provider
@dependency_store = dependency_store
@@ -96,23 +96,23 @@
when Nanoc::Int::ProcessingActions::Filter
executor.filter(action.filter_name, action.params)
when Nanoc::Int::ProcessingActions::Layout
executor.layout(action.layout_identifier, action.params)
when Nanoc::Int::ProcessingActions::Snapshot
- executor.snapshot(action.snapshot_name, final: action.final?, path: action.path)
+ executor.snapshot(action.snapshot_name)
else
raise Nanoc::Int::Errors::InternalInconsistency, "unknown action #{action.inspect}"
end
end
ensure
dependency_tracker.exit
end
end
# Provides functionality for (re)calculating the content of an item rep, with caching or
- # outdatedness checking. Delegates to RecalculatingItemRepCompiler if outdated or no cache available.
- class CachingItemRepCompiler
+ # outdatedness checking. Delegates to RecalculatePhase if outdated or no cache available.
+ class CachePhase
include Nanoc::Int::ContractsSupport
def initialize(compiled_content_cache:, wrapped:)
@compiled_content_cache = compiled_content_cache
@wrapped = wrapped
@@ -136,11 +136,11 @@
!is_outdated && !@compiled_content_cache[rep].nil?
end
end
# Provides functionality for suspending and resuming item rep compilation (using fibers).
- class ResumableItemRepCompiler
+ class ResumePhase
include Nanoc::Int::ContractsSupport
def initialize(wrapped:)
@wrapped = wrapped
end
@@ -180,11 +180,11 @@
@fibers[rep]
end
end
- class WritingItemRepCompiler
+ class WritePhase
include Nanoc::Int::ContractsSupport
def initialize(wrapped:)
@wrapped = wrapped
end
@@ -192,13 +192,11 @@
contract Nanoc::Int::ItemRep, C::KeywordArgs[is_outdated: C::Bool] => C::Any
def run(rep, is_outdated:)
@wrapped.run(rep, is_outdated: is_outdated)
rep.snapshot_defs.each do |sdef|
- if sdef.final?
- ItemRepWriter.new.write(rep, sdef.name)
- end
+ ItemRepWriter.new.write(rep, sdef.name)
end
end
end
include Nanoc::Int::ContractsSupport
@@ -342,26 +340,26 @@
item_rep_compiler.run(rep, is_outdated: is_outdated)
end
def item_rep_compiler
@_item_rep_compiler ||= begin
- recalculating_item_rep_compiler = RecalculatingItemRepCompiler.new(
+ recalculate_phase = RecalculatePhase.new(
action_provider: action_provider,
dependency_store: @dependency_store,
compilation_context: compilation_context,
)
- caching_item_rep_compiler = CachingItemRepCompiler.new(
+ cache_phase = CachePhase.new(
compiled_content_cache: compiled_content_cache,
- wrapped: recalculating_item_rep_compiler,
+ wrapped: recalculate_phase,
)
- resumable_item_rep_compiler = ResumableItemRepCompiler.new(
- wrapped: caching_item_rep_compiler,
+ resume_phase = ResumePhase.new(
+ wrapped: cache_phase,
)
- WritingItemRepCompiler.new(
- wrapped: resumable_item_rep_compiler,
+ WritePhase.new(
+ wrapped: resume_phase,
)
end
end
# Returns all stores that can load/store data that can be used for