Module: Krane::OptionsHelper

Defined in:
lib/krane/options_helper.rb

Defined Under Namespace

Classes: OptionsError

Constant Summary collapse

STDIN_TEMP_FILE =
"from_stdin.yml"

Class Method Summary collapse

Class Method Details

.with_processed_template_paths(template_paths, render_erb: false) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/krane/options_helper.rb', line 9

def with_processed_template_paths(template_paths, render_erb: false)
  validated_paths = []
  template_paths.uniq!
  template_paths.each do |template_path|
    next if template_path == '-'
    validated_paths << template_path
  end

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