Class: SSHKit::Backend::Netssh

Inherits:
Abstract
  • Object
show all
Defined in:
lib/sshkit/backends/netssh.rb,
lib/sshkit/backends/netssh/known_hosts.rb,
lib/sshkit/backends/netssh/scp_transfer.rb,
lib/sshkit/backends/netssh/sftp_transfer.rb

Defined Under Namespace

Classes: Configuration, KnownHosts, KnownHostsKeys, ScpTransfer, SftpTransfer

Class Attribute Summary collapse

Attributes inherited from Abstract

#host

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

#as, #background, #capture, #execute, #initialize, #make, #rake, #redact, #run, #test, #with, #within

Constructor Details

This class inherits a constructor from SSHKit::Backend::Abstract

Class Attribute Details

.poolObject

Returns the value of attribute pool.



103
104
105
# File 'lib/sshkit/backends/netssh.rb', line 103

def pool
  @pool
end

Class Method Details

.assert_valid_transfer_method!(method) ⇒ Object

Raises:

  • (ArgumentError)


24
25
26
27
28
# File 'lib/sshkit/backends/netssh.rb', line 24

def self.assert_valid_transfer_method!(method)
  return if [:scp, :sftp].include?(method)

  raise ArgumentError, "#{method.inspect} is not a valid transfer method. Supported methods are :scp, :sftp."
end

.configObject



109
110
111
# File 'lib/sshkit/backends/netssh.rb', line 109

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



105
106
107
# File 'lib/sshkit/backends/netssh.rb', line 105

def configure
  yield config
end

Instance Method Details

#download!(remote, local = nil, options = {}) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/sshkit/backends/netssh.rb', line 87

def download!(remote, local=nil, options = {})
  summarizer = transfer_summarizer('Downloading', options)
  remote = File.join(pwd_path, remote) unless remote.to_s.start_with?("/") || pwd_path.nil?
  with_transfer(summarizer) do |transfer|
    transfer.download!(remote, local, options)
  end
end

#upload!(local, remote, options = {}) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/sshkit/backends/netssh.rb', line 79

def upload!(local, remote, options = {})
  summarizer = transfer_summarizer('Uploading', options)
  remote = File.join(pwd_path, remote) unless remote.to_s.start_with?("/") || pwd_path.nil?
  with_transfer(summarizer) do |transfer|
    transfer.upload!(local, remote, options)
  end
end