lib/nanoc/base/services/executor.rb in nanoc-4.11.0 vs lib/nanoc/base/services/executor.rb in nanoc-4.11.1
- old
+ new
@@ -11,28 +11,28 @@
def filter(filter_name, filter_args = {})
filter = filter_for_filtering(@rep, filter_name)
begin
- Nanoc::Int::NotificationCenter.post(:filtering_started, @rep, filter_name)
+ Nanoc::Core::NotificationCenter.post(:filtering_started, @rep, filter_name)
# Run filter
- last = @compilation_context.snapshot_repo.get(@rep, :last)
+ last = @compilation_context.compiled_content_store.get_current(@rep)
source = last.binary? ? last.filename : last.string
filter_args.freeze
result = filter.setup_and_run(source, filter_args)
last =
if filter.class.to_binary?
- Nanoc::Int::BinaryContent.new(filter.output_filename).tap(&:freeze)
+ Nanoc::Core::BinaryContent.new(filter.output_filename).tap(&:freeze)
else
- Nanoc::Int::TextualContent.new(result).tap(&:freeze)
+ Nanoc::Core::TextualContent.new(result).tap(&:freeze)
end
# Store
- @compilation_context.snapshot_repo.set(@rep, :last, last)
+ @compilation_context.compiled_content_store.set_current(@rep, last)
ensure
- Nanoc::Int::NotificationCenter.post(:filtering_ended, @rep, filter_name)
+ Nanoc::Core::NotificationCenter.post(:filtering_ended, @rep, filter_name)
end
end
def layout(layout_identifier, extra_filter_args = nil)
layout = find_layout(layout_identifier)
@@ -43,11 +43,11 @@
filter_args = filter_args.merge(extra_filter_args || {})
filter_args.freeze
# Check whether item can be laid out
- last = @compilation_context.snapshot_repo.get(@rep, :last)
+ last = @compilation_context.compiled_content_store.get_current(@rep)
raise Nanoc::Int::Errors::CannotLayoutBinaryItem.new(@rep) if last.binary?
# Create filter
klass = Nanoc::Filter.named!(filter_name)
view_context = @compilation_context.create_view_context(@dependency_tracker)
@@ -56,28 +56,29 @@
# Visit
@dependency_tracker.bounce(layout, raw_content: true)
begin
- Nanoc::Int::NotificationCenter.post(:filtering_started, @rep, filter_name)
+ Nanoc::Core::NotificationCenter.post(:filtering_started, @rep, filter_name)
# Layout
content = layout.content
arg = content.binary? ? content.filename : content.string
res = filter.setup_and_run(arg, filter_args)
# Store
- last = Nanoc::Int::TextualContent.new(res).tap(&:freeze)
- @compilation_context.snapshot_repo.set(@rep, :last, last)
+ last = Nanoc::Core::TextualContent.new(res).tap(&:freeze)
+ @compilation_context.compiled_content_store.set_current(@rep, last)
ensure
- Nanoc::Int::NotificationCenter.post(:filtering_ended, @rep, filter_name)
+ Nanoc::Core::NotificationCenter.post(:filtering_ended, @rep, filter_name)
end
end
def snapshot(snapshot_name)
- last = @compilation_context.snapshot_repo.get(@rep, :last)
- @compilation_context.snapshot_repo.set(@rep, snapshot_name, last)
+ last = @compilation_context.compiled_content_store.get_current(@rep)
+ @compilation_context.compiled_content_store.set(@rep, snapshot_name, last)
+ Nanoc::Core::NotificationCenter.post(:snapshot_created, @rep, snapshot_name)
end
def assigns_for(rep)
@compilation_context.assigns_for(rep, @dependency_tracker)
end
@@ -90,21 +91,21 @@
req_id = arg.__nanoc_cleaned_identifier
layout = layouts.find { |l| l.identifier == req_id }
return layout if layout
if use_globs?
- pat = Nanoc::Int::Pattern.from(arg)
+ pat = Nanoc::Core::Pattern.from(arg)
layout = layouts.find { |l| pat.match?(l.identifier) }
return layout if layout
end
raise Nanoc::Int::Errors::UnknownLayout.new(arg)
end
def filter_for_filtering(rep, filter_name)
klass = Nanoc::Filter.named!(filter_name)
- last = @compilation_context.snapshot_repo.get(@rep, :last)
+ last = @compilation_context.compiled_content_store.get_current(@rep)
if klass.from_binary? && !last.binary?
raise Nanoc::Int::Errors::CannotUseBinaryFilter.new(rep, klass)
elsif !klass.from_binary? && last.binary?
raise Nanoc::Int::Errors::CannotUseTextualFilter.new(rep, klass)
end