sshkit 1.13.1 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -2
- data/README.md +1 -1
- data/Rakefile +0 -2
- data/lib/sshkit/backends/netssh.rb +6 -4
- data/lib/sshkit/command.rb +3 -12
- data/lib/sshkit/version.rb +1 -1
- data/sshkit.gemspec +5 -1
- data/test/unit/test_command.rb +6 -1
- metadata +46 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b21b9fc05481526fd6470265cb3afb51fcc0691a
|
4
|
+
data.tar.gz: 4a093de329e546b6410c01c03ab8fe8379c8c53f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7ba415cd0b373c356ab99e1ca0624bcca5265c328e2b060def73684541eaf041b539162779a7463691428162e5758bcc025bbe8c6966f3deca4cb95aaa9f8e
|
7
|
+
data.tar.gz: f2907bc157c0cacfa2309725aa637deff3bf43079b5dbe255c7d00049997f46cdb574823d8ee8bd848c6e12b24a0c5bb02d8ed66e8196bb87d5fff2b14c41380
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,16 @@ appear at the top.
|
|
7
7
|
|
8
8
|
* Your contribution here!
|
9
9
|
|
10
|
+
## [1.14.0][] (2017-06-30)
|
11
|
+
|
12
|
+
### Breaking changes
|
13
|
+
|
14
|
+
* None
|
15
|
+
|
16
|
+
### New features
|
17
|
+
|
18
|
+
* [#401](https://github.com/capistrano/sshkit/pull/401): Add :log_percent option to specify upload!/download! transfer log percentage - [@aubergene](https://github.com/aubergene)
|
19
|
+
|
10
20
|
## [1.13.1][] (2017-03-31)
|
11
21
|
|
12
22
|
### Breaking changes
|
@@ -15,7 +25,7 @@ appear at the top.
|
|
15
25
|
|
16
26
|
### Bug fixes
|
17
27
|
|
18
|
-
* [#397](https://github.com/capistrano/
|
28
|
+
* [#397](https://github.com/capistrano/sshkit/pull/397): Fix NoMethodError assign_defaults with net-ssh older than 4.0.0 - [@shirosaki](https://github.com/shirosaki)
|
19
29
|
|
20
30
|
## [1.13.0][] (2017-03-24)
|
21
31
|
|
@@ -697,7 +707,8 @@ version `0.0.5`.
|
|
697
707
|
|
698
708
|
First release.
|
699
709
|
|
700
|
-
[Unreleased]: https://github.com/capistrano/sshkit/compare/v1.
|
710
|
+
[Unreleased]: https://github.com/capistrano/sshkit/compare/v1.14.0...HEAD
|
711
|
+
[1.14.0]: https://github.com/capistrano/sshkit/compare/v1.13.1...v1.14.0
|
701
712
|
[1.13.1]: https://github.com/capistrano/sshkit/compare/v1.13.0...v1.13.1
|
702
713
|
[1.13.0]: https://github.com/capistrano/sshkit/compare/v1.12.0...v1.13.0
|
703
714
|
[1.12.0]: https://github.com/capistrano/sshkit/compare/v1.11.5...v1.12.0
|
data/README.md
CHANGED
@@ -72,7 +72,7 @@ For the remote backend, the file is tranferred with scp.
|
|
72
72
|
```ruby
|
73
73
|
on '1.example.com' do
|
74
74
|
upload! 'some_local_file.txt', '/home/some_user/somewhere'
|
75
|
-
download! '/home/some_user/some_remote_file.txt', 'somewhere_local'
|
75
|
+
download! '/home/some_user/some_remote_file.txt', 'somewhere_local', :log_percent 25
|
76
76
|
end
|
77
77
|
```
|
78
78
|
|
data/Rakefile
CHANGED
@@ -62,14 +62,14 @@ module SSHKit
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def upload!(local, remote, options = {})
|
65
|
-
summarizer = transfer_summarizer('Uploading')
|
65
|
+
summarizer = transfer_summarizer('Uploading', options)
|
66
66
|
with_ssh do |ssh|
|
67
67
|
ssh.scp.upload!(local, remote, options, &summarizer)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
def download!(remote, local=nil, options = {})
|
72
|
-
summarizer = transfer_summarizer('Downloading')
|
72
|
+
summarizer = transfer_summarizer('Downloading', options)
|
73
73
|
with_ssh do |ssh|
|
74
74
|
ssh.scp.download!(remote, local, options, &summarizer)
|
75
75
|
end
|
@@ -96,14 +96,16 @@ module SSHKit
|
|
96
96
|
|
97
97
|
private
|
98
98
|
|
99
|
-
def transfer_summarizer(action)
|
99
|
+
def transfer_summarizer(action, options = {})
|
100
|
+
log_percent = options[:log_percent] || 10
|
101
|
+
log_percent = 100 if log_percent <= 0
|
100
102
|
last_name = nil
|
101
103
|
last_percentage = nil
|
102
104
|
proc do |_ch, name, transferred, total|
|
103
105
|
percentage = (transferred.to_f * 100 / total.to_f)
|
104
106
|
unless percentage.nan?
|
105
107
|
message = "#{action} #{name} #{percentage.round(2)}%"
|
106
|
-
percentage_r = (percentage /
|
108
|
+
percentage_r = (percentage / log_percent).truncate * log_percent
|
107
109
|
if percentage_r > 0 && (last_name != name || last_percentage != percentage_r)
|
108
110
|
info message
|
109
111
|
last_name = name
|
data/lib/sshkit/command.rb
CHANGED
@@ -21,10 +21,9 @@ module SSHKit
|
|
21
21
|
def initialize(*args)
|
22
22
|
raise ArgumentError, "Must pass arguments to Command.new" if args.empty?
|
23
23
|
@options = default_options.merge(args.extract_options!)
|
24
|
-
@command = args.shift
|
24
|
+
@command = sanitize_command(args.shift)
|
25
25
|
@args = args
|
26
26
|
@options.symbolize_keys!
|
27
|
-
sanitize_command!
|
28
27
|
@stdout, @stderr, @full_stdout, @full_stderr = String.new, String.new, String.new, String.new
|
29
28
|
end
|
30
29
|
|
@@ -222,16 +221,8 @@ module SSHKit
|
|
222
221
|
}
|
223
222
|
end
|
224
223
|
|
225
|
-
def sanitize_command
|
226
|
-
|
227
|
-
if command.to_s.match("\n")
|
228
|
-
@command = String.new.tap do |cs|
|
229
|
-
command.to_s.lines.each do |line|
|
230
|
-
cs << line.strip
|
231
|
-
cs << '; ' unless line == command.to_s.lines.to_a.last
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
224
|
+
def sanitize_command(cmd)
|
225
|
+
cmd.to_s.lines.map(&:strip).join("; ")
|
235
226
|
end
|
236
227
|
|
237
228
|
def call_interaction_handler(stream_name, data, channel)
|
data/lib/sshkit/version.rb
CHANGED
data/sshkit.gemspec
CHANGED
@@ -25,6 +25,10 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.add_development_dependency('minitest-reporters')
|
26
26
|
gem.add_development_dependency('rainbow', '~> 2.1.0')
|
27
27
|
gem.add_development_dependency('rake')
|
28
|
-
gem.add_development_dependency('rubocop')
|
28
|
+
gem.add_development_dependency('rubocop', "~> 0.49.1")
|
29
29
|
gem.add_development_dependency('mocha')
|
30
|
+
|
31
|
+
gem.add_development_dependency('bcrypt_pbkdf')
|
32
|
+
gem.add_development_dependency('rbnacl', '~> 3.4')
|
33
|
+
gem.add_development_dependency('rbnacl-libsodium')
|
30
34
|
end
|
data/test/unit/test_command.rb
CHANGED
@@ -16,7 +16,7 @@ module SSHKit
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def test_multiple_lines_are_stripped_of_extra_space_and_joined_by_semicolons
|
20
20
|
c = Command.new <<-EOHEREDOC
|
21
21
|
if test ! -d /var/log; then
|
22
22
|
echo "Example"
|
@@ -25,6 +25,11 @@ module SSHKit
|
|
25
25
|
assert_equal "if test ! -d /var/log; then; echo \"Example\"; fi", c.to_command
|
26
26
|
end
|
27
27
|
|
28
|
+
def test_leading_and_trailing_space_is_stripped
|
29
|
+
c = Command.new(" echo hi ")
|
30
|
+
assert_equal "echo hi", c.to_command
|
31
|
+
end
|
32
|
+
|
28
33
|
def test_including_the_env
|
29
34
|
SSHKit.config = nil
|
30
35
|
c = Command.new(:rails, 'server', env: {rails_env: :production})
|
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: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Hambley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -111,6 +111,20 @@ dependencies:
|
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: rubocop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.49.1
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.49.1
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: mocha
|
114
128
|
requirement: !ruby/object:Gem::Requirement
|
115
129
|
requirements:
|
116
130
|
- - ">="
|
@@ -124,7 +138,35 @@ dependencies:
|
|
124
138
|
- !ruby/object:Gem::Version
|
125
139
|
version: '0'
|
126
140
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
141
|
+
name: bcrypt_pbkdf
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: rbnacl
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '3.4'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '3.4'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: rbnacl-libsodium
|
128
170
|
requirement: !ruby/object:Gem::Requirement
|
129
171
|
requirements:
|
130
172
|
- - ">="
|
@@ -251,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
293
|
version: '0'
|
252
294
|
requirements: []
|
253
295
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.6.
|
296
|
+
rubygems_version: 2.6.12
|
255
297
|
signing_key:
|
256
298
|
specification_version: 4
|
257
299
|
summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby
|