mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Use passed blocks to handle scp callbacks.
This commit is contained in:
parent
8116689537
commit
6d469a9a61
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue