Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Capistrano function to upload files displaying a progress percentage.
desc "Uploads a file displaying the progress"
def upload_progress(source, target)
upload(source, target, :via => :sftp) do |event, options, *others|
if event.to_s == "put"
print ("\r * " + (("#{others[1]}".to_f / "#{others[0].size}".to_f) * 100).round(2).to_s + "%").ljust(10, ' ')
elsif event.to_s == "close"
print "\r"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.