Module: Textus::Produce::Publisher

Defined in:
lib/textus/produce/publisher.rb

Class Method Summary collapse

Class Method Details

.call(container:, call:, key:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/textus/produce/publisher.rb', line 4

def self.call(container:, call:, key:)
  entry = container.manifest.resolver.resolve(key).entry
  return unless entry.publish_tree || !Array(entry.publish_to).empty?

  entry_path = container.manifest.resolver.resolve(key).path
  return unless entry.publish_tree || container.file_store.exists?(entry_path)

  reader = Textus::Store::Entry::Reader.from(container: container)
  pctx = Textus::Manifest::Entry::Base::PublishContext.new(
    container: container,
    call: call,
    reader: reader.method(:read),
  )
  entry.publish_via(pctx)
end