Module: Cirrus::SCP
Defined Under Namespace
Classes: SCPUnavailable
Instance Method Summary collapse
-
#connect(host, username) ⇒ Object
Opens an SCP connection and yields it so that you can download and upload files.
Instance Method Details
#connect(host, username) ⇒ Object
Opens an SCP connection and yields it so that you can download and upload files.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cirrus/scp.rb', line 12 def connect(host, username) Cirrus::SSH.connect(host, username) do |connection| scp = Net::SCP.new(connection) return yield scp end rescue Net::SCP::Error => e # If we get the exit code of 127, then this means SCP is unavailable. raise SCPUnavailable if e. =~ /\(127\)/ # Otherwise, just raise the error up raise e end |