sshkit 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  This file is written in reverse chronological order, newer releases will
4
4
  appear at the top.
5
5
 
6
+ ## 0.0.25
7
+
8
+ * `upload!` and `download!` now log to different levels depending on
9
+ completion percentage. When the upload is 0 percent complete or a number
10
+ indivisible by 10, the message is logged to `Logger::DEBUG` otherwise the
11
+ message is logged to `Logger::INFO`, this should mean that normal users at
12
+ a sane log level should see upload progress jump to `100%` for small
13
+ files, and otherwise for larger files they'll see output every `10%`.
14
+
6
15
  ## 0.0.24
7
16
 
8
17
  * Pretty output now streams stdout and stderr. Previous versions would
@@ -40,13 +40,23 @@ module SSHKit
40
40
 
41
41
  def upload!(local, remote, options = {})
42
42
  ssh.scp.upload!(local, remote, options) do |ch, name, sent, total|
43
- info "Uploading #{name} #{(sent.to_f * 100 / total.to_f).to_i}%"
43
+ percentage = (sent.to_f * 100 / total.to_f).to_i
44
+ if percentage > 0 && percentage % 10 == 0
45
+ info "Uploading #{name} #{percentage}%"
46
+ else
47
+ debug "Uploading #{name} #{percentage}%"
48
+ end
44
49
  end
45
50
  end
46
51
 
47
52
  def download!(remote, local=nil, options = {})
48
53
  ssh.scp.download!(remote, local, options) do |ch, name, received, total|
49
- info "Downloading #{name} #{(received.to_f * 100 / total.to_f).to_i}%"
54
+ percentage = (received.to_f * 100 / total.to_f).to_i
55
+ if percentage > 0 && percentage % 10 == 0
56
+ info "Downloading #{name} #{percentage}%"
57
+ else
58
+ debug "Downloading #{name} #{percentage}%"
59
+ end
50
60
  end
51
61
  end
52
62
 
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: