Class: Train::Transports::SSH

Inherits:
Object
  • Object
show all
Defined in:
lib/train/transports/ssh.rb,
lib/train/transports/ssh_connection.rb

Overview

A Transport which uses the SSH protocol to execute commands and transfer files.

Author:

Defined Under Namespace

Classes: Connection

Instance Method Summary collapse

Instance Method Details

#connection(state = {}, &block) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/train/transports/ssh.rb', line 65

def connection(state = {}, &block)
  opts = merge_options(options, state || {})
  validate_options(opts)
  conn_opts = connection_options(opts)

  if defined?(@connection) && @connection_options == conn_opts
    reuse_connection(&block)
  else
    create_new_connection(conn_opts, &block)
  end
end