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.



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

def pool
  @pool
end

Class Method Details

.assert_valid_transfer_method!(method) ⇒ Object

Raises:

  • (ArgumentError)


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

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



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

def config
  @config ||= Configuration.new
end

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

Yields:



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

def configure
  yield config
end

Instance Method Details

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



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

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



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

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