Class: Kitchen::Transport::Localhost::Connection

Inherits:
Base::Connection
  • Object
show all
Includes:
ShellOut
Defined in:
lib/kitchen/transport/localhost/connection.rb

Overview

Connection class for the Localhost transport.

Author:

Instance Method Summary collapse

Instance Method Details

#execute(command) ⇒ Object

Execute a given command by shelling out and just running it.

(see Base::Connection#execute)

Raises:



43
44
45
46
47
48
49
50
51
# File 'lib/kitchen/transport/localhost/connection.rb', line 43

def execute(command)
  return if command.nil?
  logger.debug("[Localhost] #{self} (#{command})")
  begin
    Bundler.with_clean_env { run_command(command) }
  rescue StandardError => err
    raise(Kitchen::Transport::LocalhostFailed, err.message)
  end
end

#upload(locals, remote) ⇒ Object

Upload a set of local files to a ‘remote’ (aka Kitchen temp dir)

(see Base::Connection#upload)



58
59
60
61
62
63
64
65
# File 'lib/kitchen/transport/localhost/connection.rb', line 58

def upload(locals, remote)
  FileUtils.mkdir_p(remote)
  Array(locals).each do |local|
    FileUtils.cp_r(local, remote)
    logger.debug("[Localhost] Copied '#{local}' to '#{remote}'")
  end
  logger.debug("[Localhost] File copying to '#{remote}' complete")
end