Sha256: a3c51c34b6806e3cc00386010ba926bc462c277384ca1d1eba329ba4d1bf5ea1

Contents?: true

Size: 847 Bytes

Versions: 57

Compression:

Stored size: 847 Bytes

Contents

class KuberKit::EnvFileReader::Strategies::ArtifactFile < KuberKit::EnvFileReader::Strategies::Abstract
  include KuberKit::Import[
    "core.artifact_store",
    "env_file_reader.env_file_parser",
    "preprocessing.text_preprocessor"
  ]

  PREPROCESS_EXTENSIONS = [".erb"]

  def read(shell, env_file)
    artifact = artifact_store.get(env_file.artifact_name)

    file_parts = [artifact.cloned_path, env_file.file_path].compact
    file_path  = File.join(*file_parts)

    read_file(shell, file_path)
  end

  private
    def read_file(shell, file_path)
      result = {}
      content = shell.read(file_path)
      enable_preprocessing = PREPROCESS_EXTENSIONS.any?{ |e| e == File.extname(file_path) }
      if enable_preprocessing
        content = text_preprocessor.compile(content)
      end

      env_file_parser.call(content)
    end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
kuber_kit-0.8.4 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.3 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.2 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.1 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.0 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.7.1 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.7.0 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.6.4 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.6.3 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.6.2 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.6.1 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.6.0 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.5.10 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.5.9 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.5.8 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.5.7 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.5.6 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb