Class: LSync::Shells::SSH
- Inherits:
-
LSync::Shell
- Object
- LSync::Shell
- LSync::Shells::SSH
- Defined in:
- lib/lsync/shells/ssh.rb
Overview
SSH shell provides access to a remote server using SSH.
Instance Method Summary collapse
-
#command_arguments ⇒ Object
The connection options for ssh [‘:port`] The remote port to use.
- #connection_command(server, arguments = []) ⇒ Object
-
#initialize(options = {}) ⇒ SSH
constructor
A new instance of SSH.
Methods inherited from LSync::Shell
Constructor Details
#initialize(options = {}) ⇒ SSH
Returns a new instance of SSH.
8 9 10 |
# File 'lib/lsync/shells/ssh.rb', line 8 def initialize( = {}) super([:command] || "ssh", ) end |
Instance Method Details
#command_arguments ⇒ Object
The connection options for ssh
- ‘:port`
-
The remote port to use.
- ‘:key`
-
A specific key file to use.
- ‘:keys`
-
A specific array of key files to use.
- ‘:timeout`
-
How long to wait until connection fails if no response is received.
- ‘:compression`
-
Enable compression.
- ‘:user`
-
Connect as a specific user.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/lsync/shells/ssh.rb', line 19 def command_arguments args = [] @options.each do |k,v| case(k.to_sym) when :port args += ['-p', v.to_s] when :key args += ['-i', v] when :keys v.each { |key_path| args += ['-i', key_path] } when :timeout args += ['-o', "ConnectTimeout #{v.to_i}".to_cmd] when :compression args += ['-C'] if v when :user args += ['-l', v.to_s] end end return args end |
#connection_command(server, arguments = []) ⇒ Object
42 43 44 |
# File 'lib/lsync/shells/ssh.rb', line 42 def connection_command(server, arguments = []) super(server, arguments + command_arguments) end |