net-ssh-simple 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +10 -9
- data/lib/net/ssh/simple/core.rb +19 -19
- data/lib/net/ssh/simple/version.rb +1 -1
- metadata +16 -16
data/README.rdoc
CHANGED
@@ -33,18 +33,19 @@ Net::SSH::Simple is a simple wrapper around Net::SSH and Net::SCP.
|
|
33
33
|
|
34
34
|
require 'net/ssh/simple'
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
|
36
|
+
t1 = Net::SSH::Simple.async do
|
37
|
+
scp_ul 'example1.com', '/tmp/local_foo', '/tmp/remote_bar'
|
38
|
+
ssh 'example3.com', 'echo "Hello World A."'
|
40
39
|
end
|
41
|
-
|
42
|
-
ssh 'example4.com', 'echo "Hello World."'
|
43
|
-
scp_ul 'example5.com', '/tmp/local_foo', '/tmp/remote_bar'
|
40
|
+
t2 = Net::SSH::Simple.async do
|
44
41
|
scp_dl 'example6.com', '/tmp/remote_foo', '/tmp/local_bar'
|
42
|
+
ssh 'example7.com', 'echo "Hello World B."'
|
45
43
|
end
|
46
|
-
|
47
|
-
|
44
|
+
r1 = t1.value # wait for t1 to finish and grab return value
|
45
|
+
r2 = t2.value # wait for t1 to finish and grab return value
|
46
|
+
|
47
|
+
puts r1.stdout #=> "Hello World A."
|
48
|
+
puts r2.stdout #=> "Hello World B."
|
48
49
|
|
49
50
|
=== Using an instance
|
50
51
|
|
data/lib/net/ssh/simple/core.rb
CHANGED
@@ -15,18 +15,19 @@ module Net
|
|
15
15
|
#
|
16
16
|
# @example
|
17
17
|
# # Block Syntax (asynchronous)
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
|
18
|
+
# t1 = Net::SSH::Simple.async do
|
19
|
+
# scp_ul 'example1.com', '/tmp/local_foo', '/tmp/remote_bar'
|
20
|
+
# ssh 'example3.com', 'echo "Hello World A."'
|
22
21
|
# end
|
23
|
-
#
|
24
|
-
# ssh 'example4.com', 'echo "Hello World."'
|
25
|
-
# scp_ul 'example5.com', '/tmp/local_foo', '/tmp/remote_bar'
|
22
|
+
# t2 = Net::SSH::Simple.async do
|
26
23
|
# scp_dl 'example6.com', '/tmp/remote_foo', '/tmp/local_bar'
|
24
|
+
# ssh 'example7.com', 'echo "Hello World B."'
|
27
25
|
# end
|
28
|
-
#
|
29
|
-
#
|
26
|
+
# r1 = t1.value # wait for t1 to finish and grab return value
|
27
|
+
# r2 = t2.value # wait for t1 to finish and grab return value
|
28
|
+
#
|
29
|
+
# puts r1.stdout #=> "Hello World A."
|
30
|
+
# puts r2.stdout #=> "Hello World B."
|
30
31
|
#
|
31
32
|
# @example
|
32
33
|
# # Using an instance
|
@@ -53,12 +54,12 @@ module Net
|
|
53
54
|
# puts "Success! I Helloed World."
|
54
55
|
# end
|
55
56
|
#
|
56
|
-
# scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
|
57
|
+
# r = scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
|
57
58
|
# if r.success and r.sent == r.total
|
58
59
|
# puts "Success! Uploaded #{r.sent} of #{r.total} bytes."
|
59
60
|
# end
|
60
61
|
#
|
61
|
-
# scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
|
62
|
+
# r = scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
|
62
63
|
# if r.success and r.sent == r.total
|
63
64
|
# puts "Success! Downloaded #{r.sent} of #{r.total} bytes."
|
64
65
|
# end
|
@@ -67,29 +68,28 @@ module Net
|
|
67
68
|
# puts "Something bad happened!"
|
68
69
|
# puts e # Human readable error
|
69
70
|
# puts e.wrapped # Original Exception
|
70
|
-
# puts e.result # Net::SSH::Simple::Result
|
71
|
+
# puts e.result # Net::SSH::Simple::Result
|
71
72
|
# end
|
72
73
|
#
|
73
74
|
# @example
|
74
75
|
# # Error Handling with Block Syntax (asynchronous)
|
75
76
|
# #
|
76
|
-
# # Exceptions are
|
77
|
+
# # Exceptions are raised inside your thread.
|
77
78
|
# # You are free to handle them or pass them outwards.
|
78
|
-
# #
|
79
79
|
#
|
80
80
|
# a = Net::SSH::Simple.async do
|
81
81
|
# begin
|
82
82
|
# ssh 'example1.com', 'echo "Hello World."'
|
83
83
|
# scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
|
84
84
|
# scp_dl 'example3.com', '/tmp/remote_foo', '/tmp/local_bar'
|
85
|
-
# rescue Net::SSH::
|
85
|
+
# rescue Net::SSH::Simple::Error => e
|
86
86
|
# # return our exception to the parent thread
|
87
87
|
# e
|
88
88
|
# end
|
89
89
|
# end
|
90
90
|
# r = a.value # Wait for thread to finish and capture result
|
91
91
|
#
|
92
|
-
# unless r.is_a? Net::SSH::Result
|
92
|
+
# unless r.is_a? Net::SSH::Simple::Result
|
93
93
|
# puts "Something bad happened!"
|
94
94
|
# puts r
|
95
95
|
# end
|
@@ -122,7 +122,7 @@ module Net
|
|
122
122
|
# end
|
123
123
|
#
|
124
124
|
# @example
|
125
|
-
# #
|
125
|
+
# # Parameters
|
126
126
|
# Net::SSH::Simple.sync do
|
127
127
|
# ssh('example1.com', 'echo "Hello World."',
|
128
128
|
# {:user => 'tom', :password => 'jerry', :port => 1234})
|
@@ -590,13 +590,13 @@ module Net
|
|
590
590
|
# Reference to the underlying Exception
|
591
591
|
attr_reader :wrapped
|
592
592
|
|
593
|
-
# Context
|
593
|
+
# Context of the operation that failed, as an Array: [host, opts, result].
|
594
594
|
#
|
595
595
|
# @deprecated
|
596
596
|
# This will be removed soon, use {#result} instead!
|
597
597
|
attr_reader :context
|
598
598
|
|
599
|
-
# {Net::SSH::Simple::Result}
|
599
|
+
# {Net::SSH::Simple::Result} of the interrupted operation.
|
600
600
|
attr_reader :result
|
601
601
|
|
602
602
|
def initialize(msg, e=$!)
|
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.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-25 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
16
|
-
requirement: &
|
16
|
+
requirement: &17315940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.1.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *17315940
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: net-scp
|
27
|
-
requirement: &
|
27
|
+
requirement: &17315180 !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: *
|
35
|
+
version_requirements: *17315180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: blockenspiel
|
38
|
-
requirement: &
|
38
|
+
requirement: &17314420 !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: *
|
46
|
+
version_requirements: *17314420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: hashie
|
49
|
-
requirement: &
|
49
|
+
requirement: &17311140 !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: *
|
57
|
+
version_requirements: *17311140
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &17310360 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.9.2.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *17310360
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &17309700 !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: *
|
79
|
+
version_requirements: *17309700
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: cover_me
|
82
|
-
requirement: &
|
82
|
+
requirement: &17308880 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *17308880
|
91
91
|
description: Net::SSH::Simple is a simple wrapper around Net::SSH and Net::SCP.
|
92
92
|
email:
|
93
93
|
- moe@busyloop.net
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
segments:
|
126
126
|
- 0
|
127
|
-
hash:
|
127
|
+
hash: -219310430856691553
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
130
|
rubygems_version: 1.8.10
|