Class: Dployr::Scripts::Scp
- Inherits:
-
Object
- Object
- Dployr::Scripts::Scp
- Defined in:
- lib/dployr/scripts/scp.rb
Instance Method Summary collapse
-
#initialize(ip, host, username, private_key_path, script) ⇒ Scp
constructor
A new instance of Scp.
Constructor Details
#initialize(ip, host, username, private_key_path, script) ⇒ Scp
Returns a new instance of Scp.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dployr/scripts/scp.rb', line 7 def initialize(ip, host, username, private_key_path, script) begin puts "Connecting to #{host} (SCP)...".yellow Net::SCP.start(ip, username, :keys => [private_key_path]) do |scp| source = script["source"] target = script["target"] puts "Copying #{source} -> #{target}".yellow scp.upload(source, target, :recursive => true, :preserve => true) end rescue => e raise "Cannot copy to remote: #{e}" end end |