From 6d469a9a61f63aed39910eed9a5c57c01084ff75 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Tue, 12 Mar 2013 16:54:46 +0100 Subject: [PATCH] Use passed blocks to handle scp callbacks. --- lib/fog/core/scp.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fog/core/scp.rb b/lib/fog/core/scp.rb index 83e361682..2f580a27b 100644 --- a/lib/fog/core/scp.rb +++ b/lib/fog/core/scp.rb @@ -66,11 +66,11 @@ module Fog @options = { :paranoid => false }.merge(options) end - def upload(local_path, remote_path, upload_options = {}) + def upload(local_path, remote_path, upload_options = {}, &block) begin Net::SCP.start(@address, @username, @options) do |scp| scp.upload!(local_path, remote_path, upload_options) do |ch, name, sent, total| - # TODO: handle progress display? + block.call(ch, name, sent, total) if block end end rescue Exception => error @@ -82,7 +82,7 @@ module Fog begin Net::SCP.start(@address, @username, @options) do |scp| scp.download!(remote_path, local_path, download_options) do |ch, name, sent, total| - # TODO: handle progress display? + block.call(ch, name, sent, total) if block end end rescue Exception => error