Module: KubernetesDeploy::OptionsHelper

Defined in:
lib/kubernetes-deploy/options_helper.rb

Defined Under Namespace

Classes: OptionsError

Constant Summary collapse

STDIN_TEMP_FILE =
"from_stdin.yml.erb"

Class Method Summary collapse

Class Method Details

.with_processed_template_paths(template_paths, require_explicit_path: false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kubernetes-deploy/options_helper.rb', line 9

def with_processed_template_paths(template_paths, require_explicit_path: false)
  validated_paths = []
  if template_paths.empty? && !require_explicit_path
    validated_paths << default_template_dir
  else
    template_paths.uniq!
    template_paths.each do |template_path|
      next if template_path == '-'
      validated_paths << template_path
    end
  end

  if template_paths.include?("-")
    Dir.mktmpdir("kubernetes-deploy") do |dir|
      template_dir_from_stdin(temp_dir: dir)
      validated_paths << dir
      yield validated_paths
    end
  else
    yield validated_paths
  end
end