Class: Kitchen::Transport::Exec::Connection
- Inherits:
-
Base::Connection
- Object
- Base::Connection
- Kitchen::Transport::Exec::Connection
- Includes:
- ShellOut
- Defined in:
- lib/kitchen/transport/exec.rb
Overview
Fake connection which just does local operations.
Instance Method Summary collapse
- #close ⇒ Object
- #execute(command) ⇒ Object
- #init_options(options) ⇒ Object
-
#upload(locals, remote) ⇒ Object
“Upload” the files by copying them locally.
Methods included from ShellOut
Methods inherited from Base::Connection
#download, #execute_with_retry, #initialize, #login_command, #retry?, #wait_until_ready
Methods included from Logging
#banner, #debug, #error, #fatal, #info, #warn
Constructor Details
This class inherits a constructor from Kitchen::Transport::Base::Connection
Instance Method Details
#close ⇒ Object
51 52 53 54 55 |
# File 'lib/kitchen/transport/exec.rb', line 51 def close if host_os_windows? FileUtils.remove(exec_script_file) end end |
#execute(command) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/kitchen/transport/exec.rb', line 40 def execute(command) return if command.nil? if host_os_windows? run_command(run_from_file_command(command)) close else run_command(command) end end |
#init_options(options) ⇒ Object
70 71 72 73 74 |
# File 'lib/kitchen/transport/exec.rb', line 70 def () super @instance_name = @options.delete(:instance_name) @kitchen_root = @options.delete(:kitchen_root) end |
#upload(locals, remote) ⇒ Object
“Upload” the files by copying them locally.
60 61 62 63 64 65 66 67 |
# File 'lib/kitchen/transport/exec.rb', line 60 def upload(locals, remote) # evaluate $env:temp on Windows real_remote = remote.to_s == "\$env:TEMP\\kitchen" ? kitchen_temp : remote FileUtils.mkdir_p(real_remote) Array(locals).each do |local| FileUtils.cp_r(local, real_remote) end end |