class KuberKit::EnvFileReader::Strategies::ArtifactFile

Constants

PREPROCESS_EXTENSIONS

Public Instance Methods

read(shell, env_file) click to toggle source
# File lib/kuber_kit/env_file_reader/strategies/artifact_file.rb, line 10
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 Instance Methods

read_file(shell, file_path) click to toggle source
# File lib/kuber_kit/env_file_reader/strategies/artifact_file.rb, line 20
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