Sha256: 39160f7f70b891fe56a5b14dc23b1991a53d09d198066542821f6f1adf9ec520

Contents?: true

Size: 777 Bytes

Versions: 66

Compression:

Stored size: 777 Bytes

Contents

class KuberKit::ServiceReader::Reader
  include KuberKit::Import[
    "core.template_store",
    "core.context_helper_factory",
    "template_reader.reader",
    "preprocessing.text_preprocessor"
  ]

  AttributeNotSetError = Class.new(KuberKit::Error)

  Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service => Any
  def read(shell, service)
    if service.template_name.nil?
      raise AttributeNotSetError, "Please set template for service using #template method"
    end

    template = template_store.get(service.template_name)

    context_helper = context_helper_factory.build_service_context(shell, service)

    template = reader.read(shell, template)

    result = text_preprocessor.compile(template, context_helper: context_helper)

    result
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
kuber_kit-0.4.2 lib/kuber_kit/service_reader/reader.rb
kuber_kit-0.4.1 lib/kuber_kit/service_reader/reader.rb
kuber_kit-0.4.0 lib/kuber_kit/service_reader/reader.rb
kuber_kit-0.3.11 lib/kuber_kit/service_reader/reader.rb
kuber_kit-0.3.10 lib/kuber_kit/service_reader/reader.rb
kuber_kit-0.3.9 lib/kuber_kit/service_reader/reader.rb