Class: Synco::Shells::SSH

Inherits:
Synco::Shell show all
Defined in:
lib/synco/shells/ssh.rb

Overview

SSH shell provides access to a remote server using SSH.

Instance Attribute Summary

Attributes inherited from Synco::Shell

#arguments

Instance Method Summary collapse

Methods inherited from Synco::Shell

#connection_command, #to_s

Constructor Details

#initialize(*command, arguments: [], port: nil, key: nil, user: nil, batch_mode: nil, **options) ⇒ SSH

Returns a new instance of SSH.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/synco/shells/ssh.rb', line 31

def initialize(*command, arguments: [], port: nil, key: nil, user: nil, batch_mode: nil, **options)
  if port
    arguments << '-p' << port
  end
  
  if key
    arguments << '-i' << key
  end
  
  if user
    arguments << '-l' << user
  end
  
  unless batch_mode.nil?
    arguments << '-o' << "BatchMode=#{batch_mode ? 'yes' : 'no'}"
  end
  
  super
end

Instance Method Details

#default_commandObject



27
28
29
# File 'lib/synco/shells/ssh.rb', line 27

def default_command
  ['ssh']
end