32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/textus/builder/pipeline.rb', line 32
def self.run(store:, mentry:, template_loader:)
data =
if mentry.projection
Projection.new(store, mentry.projection).run
else
{ "entries" => [], "count" => 0, "generated_at" => Time.now.utc.iso8601 }
end
data = data.merge("intro" => Intro.run(store)) if mentry.inject_intro
klass = renderers[mentry.format] or
raise UsageError.new("builder: unsupported format #{mentry.format.inspect} for '#{mentry.key}'")
bytes = klass.new(template_loader: template_loader).call(mentry: mentry, data: data)
target_path = Key::Path.resolve(store.manifest, mentry)
FileUtils.mkdir_p(File.dirname(target_path))
File.binwrite(target_path, bytes)
target_path
end
|