net-ssh-simple 1.5.9 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .rbenv-version
1
2
  *.gem
2
3
  .bundle
3
4
  Gemfile.lock
data/README.rdoc CHANGED
@@ -1,6 +1,4 @@
1
- {<img src="https://gemnasium.com/busyloop/net-ssh-simple.png" alt="Dependency Status" />}[https://gemnasium.com/busyloop/net-ssh-simple]
2
-
3
- = Net::SSH::Simple
1
+ = Net::SSH::Simple {<img src="https://gemnasium.com/busyloop/net-ssh-simple.png" alt="Dependency Status" />}[https://gemnasium.com/busyloop/net-ssh-simple]
4
2
 
5
3
  Net::SSH::Simple is a simple wrapper around Net::SSH and Net::SCP.
6
4
 
@@ -39,8 +37,8 @@ version with syntax highlighting.
39
37
  r = ssh 'example1.com', 'echo "Hello World."'
40
38
  puts r.stdout #=> "Hello World."
41
39
 
42
- scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
43
- scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
40
+ scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
41
+ scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
44
42
  end
45
43
 
46
44
  === Block Syntax (asynchronous)
@@ -48,11 +46,11 @@ version with syntax highlighting.
48
46
  require 'net/ssh/simple'
49
47
 
50
48
  t1 = Net::SSH::Simple.async do
51
- scp_ul 'example1.com', '/tmp/local_foo', '/tmp/remote_bar'
49
+ scp_put 'example1.com', '/tmp/local_foo', '/tmp/remote_bar'
52
50
  ssh 'example3.com', 'echo "Hello World A."'
53
51
  end
54
52
  t2 = Net::SSH::Simple.async do
55
- scp_dl 'example6.com', '/tmp/remote_foo', '/tmp/local_bar'
53
+ scp_get 'example6.com', '/tmp/remote_foo', '/tmp/local_bar'
56
54
  ssh 'example7.com', 'echo "Hello World B."'
57
55
  end
58
56
  r1 = t1.value # wait for t1 to finish and grab return value
@@ -67,8 +65,8 @@ version with syntax highlighting.
67
65
 
68
66
  s = Net::SSH::Simple.new
69
67
  s.ssh 'example1.com', 'echo "Hello World."'
70
- s.scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
71
- s.scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
68
+ s.scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
69
+ s.scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
72
70
  s.close
73
71
 
74
72
  == Thread safety
@@ -104,15 +102,15 @@ then the following idiom will provide the best performance:
104
102
  # The connections to example1-5.com are re-used across
105
103
  # multiple calls to this method.
106
104
  ss.ssh 'example1.com', 'echo "Hello World."', {:user => 'not_bob'}
107
- ss.scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
108
- ss.scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
105
+ ss.scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
106
+ ss.scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
109
107
 
110
108
  t = ss.async do
111
- scp_ul 'example4.com', '/tmp/local_foo', '/tmp/remote_bar'
109
+ scp_put 'example4.com', '/tmp/local_foo', '/tmp/remote_bar'
112
110
  end
113
111
 
114
112
  ss.sync do
115
- scp_ul 'example5.com', '/tmp/local_foo', '/tmp/remote_bar'
113
+ scp_put 'example5.com', '/tmp/local_foo', '/tmp/remote_bar'
116
114
  end
117
115
 
118
116
  # wait for our async call to finish
@@ -1,7 +1,7 @@
1
1
  module Net
2
2
  module SSH
3
3
  class Simple
4
- VERSION = "1.5.9"
4
+ VERSION = "1.6.0"
5
5
  end
6
6
  end
7
7
  end
@@ -38,18 +38,18 @@ module Net
38
38
  # puts r.stdout #=> "Hello World."
39
39
  # puts r.exit_code #=> 0
40
40
  #
41
- # scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
42
- # scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
41
+ # scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
42
+ # scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
43
43
  # end
44
44
  #
45
45
  # @example
46
46
  # # Block Syntax (asynchronous)
47
47
  # t1 = Net::SSH::Simple.async do
48
- # scp_ul 'example1.com', '/tmp/local_foo', '/tmp/remote_bar'
48
+ # scp_put 'example1.com', '/tmp/local_foo', '/tmp/remote_bar'
49
49
  # ssh 'example3.com', 'echo "Hello World A."'
50
50
  # end
51
51
  # t2 = Net::SSH::Simple.async do
52
- # scp_dl 'example6.com', '/tmp/remote_foo', '/tmp/local_bar'
52
+ # scp_get 'example6.com', '/tmp/remote_foo', '/tmp/local_bar'
53
53
  # ssh 'example7.com', 'echo "Hello World B."'
54
54
  # end
55
55
  # r1 = t1.value # wait for t1 to finish and grab return value
@@ -61,18 +61,18 @@ module Net
61
61
  # @example
62
62
  # # Using an instance
63
63
  # s = Net::SSH::Simple.new
64
- # s.ssh 'example1.com', 'echo "Hello World."'
65
- # s.scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
66
- # s.scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
64
+ # s.ssh 'example1.com', 'echo "Hello World."'
65
+ # s.scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
66
+ # s.scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
67
67
  # s.close
68
68
  #
69
69
  # @example
70
70
  # # Using no instance
71
71
  # # Note: This will create a new connection for each operation!
72
72
  # # Use instance- or block-syntax for better performance.
73
- # Net::SSH::Simple.ssh 'example1.com', 'echo "Hello World."'
74
- # Net::SSH::Simple.scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
75
- # Net::SSH::Simple.scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
73
+ # Net::SSH::Simple.ssh 'example1.com', 'echo "Hello World."'
74
+ # Net::SSH::Simple.scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
75
+ # Net::SSH::Simple.scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
76
76
  #
77
77
  # @example
78
78
  # # Error Handling with Block Syntax (synchronous)
@@ -83,12 +83,12 @@ module Net
83
83
  # puts "Success! I Helloed World."
84
84
  # end
85
85
  #
86
- # r = scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
86
+ # r = scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
87
87
  # if r.success and r.sent == r.total
88
88
  # puts "Success! Uploaded #{r.sent} of #{r.total} bytes."
89
89
  # end
90
90
  #
91
- # r = scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
91
+ # r = scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
92
92
  # if r.success and r.sent == r.total
93
93
  # puts "Success! Downloaded #{r.sent} of #{r.total} bytes."
94
94
  # end
@@ -108,9 +108,9 @@ module Net
108
108
  #
109
109
  # a = Net::SSH::Simple.async do
110
110
  # begin
111
- # ssh 'example1.com', 'echo "Hello World."'
112
- # scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
113
- # scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
111
+ # ssh 'example1.com', 'echo "Hello World."'
112
+ # scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
113
+ # scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
114
114
  # rescue Net::SSH::Simple::Error => e
115
115
  # # return our exception to the parent thread
116
116
  # e
@@ -132,12 +132,12 @@ module Net
132
132
  # puts "Success! I Helloed World."
133
133
  # end
134
134
  #
135
- # r = s.scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
135
+ # r = s.scp_put 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
136
136
  # if r.success and r.sent == r.total
137
137
  # puts "Success! Uploaded #{r.sent} of #{r.total} bytes."
138
138
  # end
139
139
  #
140
- # r = s.scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
140
+ # r = s.scp_get 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
141
141
  # if r.success and r.sent == r.total
142
142
  # puts "Success! Downloaded #{r.sent} of #{r.total} bytes."
143
143
  # end
@@ -161,13 +161,13 @@ module Net
161
161
  # Net::SSH::Simple.sync({:user => 'tom', :port => 1234}) do
162
162
  # # Both commands will inherit :user and :port
163
163
  # ssh('example1.com', 'echo "Hello World."', {:password => 'jerry'})
164
- # scp_ul('example2.com', '/tmp/a', '/tmp/a', {:password => 's3cr3t'})
164
+ # scp_put('example2.com', '/tmp/a', '/tmp/a', {:password => 's3cr3t'})
165
165
  # end
166
166
  #
167
167
  # @example
168
168
  # # Using the SCP progress callback
169
169
  # Net::SSH::Simple.sync do
170
- # scp_ul 'example1.com', '/tmp/local_foo', '/tmp/remote_bar' do |sent, total|
170
+ # scp_put 'example1.com', '/tmp/local_foo', '/tmp/remote_bar' do |sent, total|
171
171
  # puts "Bytes uploaded: #{sent} of #{total}"
172
172
  # end
173
173
  # end
@@ -278,20 +278,20 @@ module Net
278
278
  #
279
279
  # @example
280
280
  # # SCP Upload
281
- # Net::SSH::Simple.scp_ul('localhost', '/tmp/local_foo', '/tmp/remote_bar')
281
+ # Net::SSH::Simple.scp_put('localhost', '/tmp/local_foo', '/tmp/remote_bar')
282
282
  #
283
283
  # @example
284
284
  # # Pass a block to monitor progress
285
- # Net::SSH::Simple.scp_ul('localhost', '/tmp/local_foo', '/tmp/remote_bar') do |sent, total|
285
+ # Net::SSH::Simple.scp_put('localhost', '/tmp/local_foo', '/tmp/remote_bar') do |sent, total|
286
286
  # puts "Bytes uploaded: #{sent} of #{total}"
287
287
  # end
288
288
  #
289
- # @param (see Net::SSH::Simple#scp_ul)
289
+ # @param (see Net::SSH::Simple#scp_put)
290
290
  # @raise [Net::SSH::Simple::Error]
291
291
  # @return [Net::SSH::Simple::Result] Result
292
- def self.scp_ul(*args, &block)
292
+ def self.scp_put(*args, &block)
293
293
  s = self.new
294
- r = s.scp_ul(*args, &block)
294
+ r = s.scp_put(*args, &block)
295
295
  s.close
296
296
  r
297
297
  end
@@ -302,37 +302,50 @@ module Net
302
302
  #
303
303
  # @example
304
304
  # # SCP Download
305
- # Net::SSH::Simple.scp_dl('localhost', '/tmp/remote_foo', '/tmp/local_bar')
305
+ # Net::SSH::Simple.scp_get('localhost', '/tmp/remote_foo', '/tmp/local_bar')
306
306
  #
307
307
  # @example
308
308
  # # Pass a block to monitor progress
309
- # Net::SSH::Simple.scp_dl('localhost', '/tmp/remote_foo', '/tmp/local_bar') do |sent, total|
309
+ # Net::SSH::Simple.scp_get('localhost', '/tmp/remote_foo', '/tmp/local_bar') do |sent, total|
310
310
  # puts "Bytes downloaded: #{sent} of #{total}"
311
311
  # end
312
312
  #
313
- # @param (see Net::SSH::Simple#scp_dl)
313
+ # @param (see Net::SSH::Simple#scp_get)
314
314
  # @raise [Net::SSH::Simple::Error]
315
315
  # @return [Net::SSH::Simple::Result] Result
316
316
  #
317
- def self.scp_dl(*args, &block)
317
+ def self.scp_get(*args, &block)
318
318
  s = self.new
319
- r = s.scp_dl(*args, &block)
319
+ r = s.scp_get(*args, &block)
320
320
  s.close
321
321
  r
322
322
  end
323
323
 
324
+ # @deprecated Use scp_put instead.
325
+ def self.scp_ul(*args, &block)
326
+ warn "[DEPRECATION] Net::SSH::Simple.scp_ul is deprecated. Please use .scp_put instead (usage is identical, the method was only renamed)."
327
+ self.scp_put(*args, &block)
328
+ end
329
+
330
+ # @deprecated Use scp_get instead.
331
+ def self.scp_dl(*args, &block)
332
+ warn "[DEPRECATION] Net::SSH::Simple.scp_dl is deprecated. Please use .scp_get instead (usage is identical, the method was only renamed)."
333
+ self.scp_get(*args, &block)
334
+ end
335
+
324
336
  #
325
337
  # SCP upload to a remote host.
326
338
  # The underlying Net::SSH::Simple instance will re-use
327
339
  # existing connections for optimal performance.
328
340
  #
329
341
  # @param [String] host Destination hostname or ip-address
330
- # @param [String] cmd Shell command to execute
342
+ # @param [String] src Source path (on localhost)
343
+ # @param [String] dst Destination path (on remote host)
331
344
  # @param opts (see Net::SSH::Simple#ssh)
332
- # @param [Block] &block Progress callback (optional)
345
+ # @param [Block] block Progress callback (optional)
333
346
  # @return [Net::SSH::Simple::Result] Result
334
347
  #
335
- def scp_ul(host, src, dst, opts={}, &block)
348
+ def scp_put(host, src, dst, opts={}, &block)
336
349
  opts = @opts.merge(opts)
337
350
  scp(:upload, host, src, dst, opts, &block)
338
351
  end
@@ -343,17 +356,30 @@ module Net
343
356
  # existing connections for optimal performance.
344
357
  #
345
358
  # @param [String] host Destination hostname or ip-address
346
- # @param [String] cmd Shell command to execute
359
+ # @param [String] src Source path (on remote host)
360
+ # @param [String] dst Destination path (on localhost)
347
361
  # @param opts (see Net::SSH::Simple#ssh)
348
- # @param [Block] &block Progress callback (optional)
362
+ # @param [Block] block Progress callback (optional)
349
363
  # @return [Net::SSH::Simple::Result] Result
350
- # @see Net::SSH::Simple#scp_ul
364
+ # @see Net::SSH::Simple#scp_put
351
365
  #
352
- def scp_dl(host, src, dst, opts={}, &block)
366
+ def scp_get(host, src, dst, opts={}, &block)
353
367
  opts = @opts.merge(opts)
354
368
  scp(:download, host, src, dst, opts, &block)
355
369
  end
356
370
 
371
+ # @deprecated Use scp_put instead.
372
+ def scp_ul(host, src, dst, opts={}, &block)
373
+ warn "[DEPRECATION] Net::SSH::Simple#scp_ul is deprecated. Please use #scp_put instead (usage is identical, the method was only renamed)."
374
+ scp_put(host, src, dst, opts, &block)
375
+ end
376
+
377
+ # @deprecated Use scp_get instead.
378
+ def scp_dl(host, src, dst, opts={}, &block)
379
+ warn "[DEPRECATION] Net::SSH::Simple#scp_dl is deprecated. Please use #scp_get instead (usage is identical, the method was only renamed)."
380
+ scp_get(host, src, dst, opts, &block)
381
+ end
382
+
357
383
  #
358
384
  # Perform SSH operation on a remote host and capture the result.
359
385
  # The underlying Net::SSH::Simple instance will re-use
@@ -362,7 +388,7 @@ module Net
362
388
  # @return [Net::SSH::Simple::Result] Result
363
389
  # @param [String] host Destination hostname or ip-address
364
390
  # @param [String] cmd Shell command to execute
365
- # @param [Block] &block Use the event-API (see example above)
391
+ # @param [Block] block Use the event-API (see example above)
366
392
  # @param [Hash] opts SSH options
367
393
  # @option opts [Array] :auth_methods
368
394
  # an array of authentication methods to try
@@ -644,7 +670,7 @@ module Net
644
670
  opts[:scp_src] = src
645
671
  opts[:scp_dst] = dst
646
672
  @result = Result.new(
647
- { :op => :scp, :host => host, :opts => opts, :cmd => :scp_dl,
673
+ { :op => :scp, :host => host, :opts => opts, :cmd => mode,
648
674
  :last_event_at => Time.new, :start_at => Time.new, :success => false
649
675
  } )
650
676
  with_session(host, opts) do |session|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.required_ruby_version = '>= 1.9.2'
15
15
 
16
- s.add_dependency "net-ssh", "~> 2.6.2"
16
+ s.add_dependency "net-ssh", "~> 2.6.3"
17
17
  s.add_dependency "net-scp", "~> 1.0.4"
18
18
  s.add_dependency "blockenspiel", "~> 0.4.3"
19
19
  s.add_dependency "hashie", ">= 1.1.0"
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency "rake", "~> 10.0.3"
22
22
  s.add_development_dependency "rspec"
23
23
  s.add_development_dependency "simplecov"
24
+ s.add_development_dependency "yard"
24
25
 
25
26
  s.files = `git ls-files`.split("\n")
26
27
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -70,7 +70,24 @@ describe Net::SSH::Simple do
70
70
  raised.should == true
71
71
  end
72
72
 
73
- it "enforces operation timeout on scp_ul" do
73
+ it "enforces operation timeout on scp_put" do
74
+ raised = false
75
+ begin
76
+ r = Net::SSH::Simple.scp_put('localhost', '/tmp/ssh_test_in0',
77
+ '/tmp/ssh_test_out0', {:operation_timeout=>1}) \
78
+ do |sent,total|
79
+ sleep 5
80
+ end
81
+ rescue => e
82
+ raised = true
83
+ e.to_s.should match /^execution expired @ .*/
84
+ e.result.op == :ssh
85
+ e.result.timed_out.should == true
86
+ end
87
+ raised.should == true
88
+ end
89
+
90
+ it "enforces operation timeout on scp_ul [DEPRECATED]" do
74
91
  raised = false
75
92
  begin
76
93
  r = Net::SSH::Simple.scp_ul('localhost', '/tmp/ssh_test_in0',
@@ -87,7 +104,24 @@ describe Net::SSH::Simple do
87
104
  raised.should == true
88
105
  end
89
106
 
90
- it "enforces operation timeout on scp_dl" do
107
+ it "enforces operation timeout on scp_get" do
108
+ raised = false
109
+ begin
110
+ r = Net::SSH::Simple.scp_get('localhost', '/tmp/ssh_test_in0',
111
+ '/tmp/ssh_test_out0', {:operation_timeout=>1}) \
112
+ do |sent,total|
113
+ sleep 5
114
+ end
115
+ rescue => e
116
+ raised = true
117
+ e.to_s.should match /^execution expired @ .*/
118
+ e.result.op == :ssh
119
+ e.result.timed_out.should == true
120
+ end
121
+ raised.should == true
122
+ end
123
+
124
+ it "enforces operation timeout on scp_dl [DEPRECATED]" do
91
125
  raised = false
92
126
  begin
93
127
  r = Net::SSH::Simple.scp_dl('localhost', '/tmp/ssh_test_in0',
@@ -153,7 +187,17 @@ describe Net::SSH::Simple do
153
187
  Digest::MD5.hexdigest(long).should == 'dea9193b768319cbb4ff1a137ac03113'
154
188
  end
155
189
 
156
- it "uploads via scp" do
190
+ it "uploads via scp_put" do
191
+ mockback = mock(:progress_callback)
192
+ mockback.should_receive(:ping).at_least(:once)
193
+ r = Net::SSH::Simple.scp_put('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
194
+ mockback.ping
195
+ end
196
+ r.success.should == true
197
+ Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
198
+ end
199
+
200
+ it "uploads via scp_ul [DEPRECATED]" do
157
201
  mockback = mock(:progress_callback)
158
202
  mockback.should_receive(:ping).at_least(:once)
159
203
  r = Net::SSH::Simple.scp_ul('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
@@ -163,7 +207,17 @@ describe Net::SSH::Simple do
163
207
  Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
164
208
  end
165
209
 
166
- it "downloads via scp" do
210
+ it "downloads via scp_get" do
211
+ mockback = mock(:progress_callback)
212
+ mockback.should_receive(:ping).at_least(:once)
213
+ r = Net::SSH::Simple.scp_get('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
214
+ mockback.ping
215
+ end
216
+ r.success.should == true
217
+ Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
218
+ end
219
+
220
+ it "downloads via scp_dl [DEPRECATED]" do
167
221
  mockback = mock(:progress_callback)
168
222
  mockback.should_receive(:ping).at_least(:once)
169
223
  r = Net::SSH::Simple.scp_dl('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
@@ -216,7 +270,18 @@ describe Net::SSH::Simple do
216
270
  Digest::MD5.hexdigest(long).should == 'dea9193b768319cbb4ff1a137ac03113'
217
271
  end
218
272
 
219
- it "uploads via scp" do
273
+ it "uploads via scp_put" do
274
+ mockback = mock(:progress_callback)
275
+ mockback.should_receive(:ping).at_least(:once)
276
+ r = @s.scp_put('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
277
+ mockback.ping
278
+ end
279
+ r.success.should == true
280
+ r.op.should == :scp
281
+ Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
282
+ end
283
+
284
+ it "uploads via scp_ul [DEPRECATED]" do
220
285
  mockback = mock(:progress_callback)
221
286
  mockback.should_receive(:ping).at_least(:once)
222
287
  r = @s.scp_ul('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
@@ -227,7 +292,18 @@ describe Net::SSH::Simple do
227
292
  Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
228
293
  end
229
294
 
230
- it "downloads via scp" do
295
+ it "downloads via scp_get" do
296
+ mockback = mock(:progress_callback)
297
+ mockback.should_receive(:ping).at_least(:once)
298
+ r = @s.scp_get('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
299
+ mockback.ping
300
+ end
301
+ r.success.should == true
302
+ r.op.should == :scp
303
+ Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
304
+ end
305
+
306
+ it "downloads via scp_dl [DEPRECATED]" do
231
307
  mockback = mock(:progress_callback)
232
308
  mockback.should_receive(:ping).at_least(:once)
233
309
  r = @s.scp_dl('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
@@ -288,7 +364,19 @@ describe Net::SSH::Simple do
288
364
  end
289
365
  end
290
366
 
291
- it "uploads via scp" do
367
+ it "uploads via scp_put" do
368
+ Net::SSH::Simple.sync do
369
+ mockback = mock(:progress_callback)
370
+ mockback.should_receive(:ping).at_least(:once)
371
+ r = scp_put('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
372
+ mockback.ping
373
+ end
374
+ r.success.should == true
375
+ Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
376
+ end
377
+ end
378
+
379
+ it "uploads via scp_ul [DEPRECATED]" do
292
380
  Net::SSH::Simple.sync do
293
381
  mockback = mock(:progress_callback)
294
382
  mockback.should_receive(:ping).at_least(:once)
@@ -300,7 +388,19 @@ describe Net::SSH::Simple do
300
388
  end
301
389
  end
302
390
 
303
- it "downloads via scp" do
391
+ it "downloads via scp_get" do
392
+ Net::SSH::Simple.sync do
393
+ mockback = mock(:progress_callback)
394
+ mockback.should_receive(:ping).at_least(:once)
395
+ r = scp_get('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0') do |sent,total|
396
+ mockback.ping
397
+ end
398
+ r.success.should == true
399
+ Digest::MD5.file('/tmp/ssh_test_in0').should == Digest::MD5.file('/tmp/ssh_test_out0')
400
+ end
401
+ end
402
+
403
+ it "downloads via scp_dl [DEPRECATED]" do
304
404
  Net::SSH::Simple.sync do
305
405
  mockback = mock(:progress_callback)
306
406
  mockback.should_receive(:ping).at_least(:once)
@@ -338,11 +438,11 @@ describe Net::SSH::Simple do
338
438
  begin
339
439
  r = nil
340
440
  if 0 == i % 2
341
- r = scp_dl('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
441
+ r = scp_get('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
342
442
  mockback.ping
343
443
  end
344
444
  else
345
- r = scp_ul('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
445
+ r = scp_put('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
346
446
  mockback.ping
347
447
  end
348
448
  end
@@ -374,11 +474,11 @@ describe Net::SSH::Simple do
374
474
  mockback.should_receive(:ping).at_least(:once)
375
475
  r = nil
376
476
  if 0 == i % 2
377
- r = scp_dl('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
477
+ r = scp_get('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
378
478
  mockback.ping
379
479
  end
380
480
  else
381
- r = scp_ul('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
481
+ r = scp_put('localhost', "/tmp/ssh_test_in#{i}", "/tmp/ssh_test_out#{i}") do |sent,total|
382
482
  mockback.ping
383
483
  end
384
484
  end
@@ -427,6 +527,19 @@ describe Net::SSH::Simple do
427
527
  r.opts[:timeout].should == 7
428
528
  r.opts[:rekey_packet_limit].should == 42
429
529
 
530
+ r = s.scp_get('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
531
+ {:rekey_packet_limit => 42})
532
+ r.op.should == :scp
533
+ r.opts[:timeout].should == 7
534
+ r.opts[:rekey_packet_limit].should == 42
535
+
536
+ r = s.scp_put('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
537
+ {:rekey_packet_limit => 42})
538
+ r.op.should == :scp
539
+ r.opts[:timeout].should == 7
540
+ r.opts[:rekey_packet_limit].should == 42
541
+
542
+ # also test deprecated scp_dl and scp_ul
430
543
  r = s.scp_dl('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
431
544
  {:rekey_packet_limit => 42})
432
545
  r.op.should == :scp
@@ -438,6 +551,7 @@ describe Net::SSH::Simple do
438
551
  r.op.should == :scp
439
552
  r.opts[:timeout].should == 7
440
553
  r.opts[:rekey_packet_limit].should == 42
554
+ # /deprecated
441
555
 
442
556
  s.close
443
557
  end
@@ -450,6 +564,19 @@ describe Net::SSH::Simple do
450
564
  r.opts[:rekey_packet_limit].should == 42
451
565
  r.opts[:operation_timeout].should == 11
452
566
 
567
+ r = scp_put('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
568
+ {:rekey_packet_limit => 42})
569
+ r.opts[:timeout].should == 7
570
+ r.opts[:rekey_packet_limit].should == 42
571
+ r.opts[:operation_timeout].should == 11
572
+
573
+ r = scp_get('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
574
+ {:rekey_packet_limit => 42})
575
+ r.opts[:timeout].should == 7
576
+ r.opts[:rekey_packet_limit].should == 42
577
+ r.opts[:operation_timeout].should == 11
578
+
579
+ # also test deprecated scp_dl and scp_ul
453
580
  r = scp_ul('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
454
581
  {:rekey_packet_limit => 42})
455
582
  r.opts[:timeout].should == 7
@@ -461,6 +588,8 @@ describe Net::SSH::Simple do
461
588
  r.opts[:timeout].should == 7
462
589
  r.opts[:rekey_packet_limit].should == 42
463
590
  r.opts[:operation_timeout].should == 11
591
+ # /deprecated methods
592
+
464
593
  :happy
465
594
  end
466
595
  t.value.should == :happy
@@ -472,6 +601,17 @@ describe Net::SSH::Simple do
472
601
  r.opts[:timeout].should == 7
473
602
  r.opts[:rekey_packet_limit].should == 42
474
603
 
604
+ r = scp_put('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
605
+ {:rekey_packet_limit => 42})
606
+ r.opts[:timeout].should == 7
607
+ r.opts[:rekey_packet_limit].should == 42
608
+
609
+ r = scp_get('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
610
+ {:rekey_packet_limit => 42})
611
+ r.opts[:timeout].should == 7
612
+ r.opts[:rekey_packet_limit].should == 42
613
+
614
+ # also test deprecated scp_dl and scp_ul
475
615
  r = scp_ul('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
476
616
  {:rekey_packet_limit => 42})
477
617
  r.opts[:timeout].should == 7
@@ -481,6 +621,7 @@ describe Net::SSH::Simple do
481
621
  {:rekey_packet_limit => 42})
482
622
  r.opts[:timeout].should == 7
483
623
  r.opts[:rekey_packet_limit].should == 42
624
+ # /deprecated methods
484
625
  end
485
626
  end
486
627
 
@@ -490,6 +631,17 @@ describe Net::SSH::Simple do
490
631
  r.opts[:timeout].should == 7
491
632
  r.opts[:rekey_packet_limit].should == 42
492
633
 
634
+ r = scp_put('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
635
+ {:rekey_packet_limit => 42})
636
+ r.opts[:timeout].should == 7
637
+ r.opts[:rekey_packet_limit].should == 42
638
+
639
+ r = scp_get('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
640
+ {:rekey_packet_limit => 42})
641
+ r.opts[:timeout].should == 7
642
+ r.opts[:rekey_packet_limit].should == 42
643
+
644
+ # also test deprecated scp_dl and scp_ul
493
645
  r = scp_ul('localhost', '/tmp/ssh_test_in0', '/tmp/ssh_test_out0',
494
646
  {:rekey_packet_limit => 42})
495
647
  r.opts[:timeout].should == 7
@@ -499,6 +651,8 @@ describe Net::SSH::Simple do
499
651
  {:rekey_packet_limit => 42})
500
652
  r.opts[:timeout].should == 7
501
653
  r.opts[:rekey_packet_limit].should == 42
654
+ # /deprecated methods
655
+
502
656
  :happy
503
657
  end
504
658
  t.value.should == :happy
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.9
4
+ version: 1.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-19 00:00:00.000000000Z
12
+ date: 2013-01-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
16
- requirement: &22888160 !ruby/object:Gem::Requirement
16
+ requirement: &22685820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 2.6.2
21
+ version: 2.6.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22888160
24
+ version_requirements: *22685820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: net-scp
27
- requirement: &22887660 !ruby/object:Gem::Requirement
27
+ requirement: &22685360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *22887660
35
+ version_requirements: *22685360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: blockenspiel
38
- requirement: &22887080 !ruby/object:Gem::Requirement
38
+ requirement: &22684780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.4.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *22887080
46
+ version_requirements: *22684780
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hashie
49
- requirement: &22886120 !ruby/object:Gem::Requirement
49
+ requirement: &22684160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.1.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *22886120
57
+ version_requirements: *22684160
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &22885180 !ruby/object:Gem::Requirement
60
+ requirement: &22683440 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 10.0.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *22885180
68
+ version_requirements: *22683440
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &22884800 !ruby/object:Gem::Requirement
71
+ requirement: &22682740 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *22884800
79
+ version_requirements: *22682740
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: simplecov
82
- requirement: &22884200 !ruby/object:Gem::Requirement
82
+ requirement: &22680960 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,18 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *22884200
90
+ version_requirements: *22680960
91
+ - !ruby/object:Gem::Dependency
92
+ name: yard
93
+ requirement: &22680500 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *22680500
91
102
  description: Net::SSH::Simple is a simple wrapper around Net::SSH and Net::SCP.
92
103
  email:
93
104
  - moe@busyloop.net
@@ -123,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
134
  version: '0'
124
135
  segments:
125
136
  - 0
126
- hash: -1613519226124125474
137
+ hash: 510085356993968652
127
138
  requirements: []
128
139
  rubyforge_project:
129
140
  rubygems_version: 1.8.10
@@ -131,3 +142,4 @@ signing_key:
131
142
  specification_version: 3
132
143
  summary: SSH without the headache
133
144
  test_files: []
145
+ has_rdoc: