Module: Capistrano::TransferProgress

Included in:
Configuration
Defined in:
lib/capistrano-transfer_progress.rb,
lib/capistrano-transfer_progress/version.rb

Overview

Hooks on capistrano transfers and provides a callback that displays a progressbar with current transfer progress

Can handle:

  • Simultaneous transfers

  • SCP and SFTP

  • Multiple files (recursive)

  • Uploads & Downloads

Cannot handle:

  • SFTP Downloads as they do not report the total file size

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#track(*args) ⇒ Object

Tracks SCP or SFTP tranfer progress



27
28
29
30
31
32
33
# File 'lib/capistrano-transfer_progress.rb', line 27

def track(*args)
  if args[0].is_a?(Symbol) && args[1].is_a?(Net::SFTP::Operations::Upload)
    track_sftp_transfer(*args)
  elsif args[0].is_a?(Net::SSH::Connection::Channel)
    track_scp_transfer(*args)
  end
end

#transfer(*args) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/capistrano-transfer_progress.rb', line 17

def transfer(*args)
  if block_given?
    super(*args)
  else
    # Here we hook the tracking on our own by default if no progress block given to the transfer method
    super(*args) { |*a| track(*a) }
  end
end