module Kitchen::Pulumi

Namespace for Kitchen-Pulumi logic @author Jacob Learned

Constants

VERSION

Public Class Methods

with_temp_conf(config_file = '') { |''| ... } click to toggle source

Copies the contents of the given config file to a temporary file and yields the

path of the temporary file to the block given

@param config_file [String] the path to the config file to copy into the temp file

for block {|temp_conf| … } @yield [temp_conf] gives the path to the temporary config file

# File lib/kitchen/pulumi.rb, line 17
def self.with_temp_conf(config_file = '')
  temp_conf = Tempfile.new(['kitchen-pulumi', '.yaml'])

  if config_file.empty?
    yield('') if block_given?
  else
    begin
      IO.copy_stream(config_file, temp_conf.path)
      yield(temp_conf.path) if block_given?
    ensure
      temp_conf.close
      temp_conf.unlink
    end
  end
end