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-1.1.2 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-1.2.1 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-1.2.0 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-1.1.1 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-1.0.1 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-1.0.0 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.9 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.8 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.7 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.6 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.5 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.4 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.3 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.2 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.1 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.9.0 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.8 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.7 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.6 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb
kuber_kit-0.8.5 lib/kuber_kit/env_file_reader/strategies/artifact_file.rb