net-ssh-simple 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
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
- a = Net::SSH::Simple.async do
37
- ssh 'example1.com', 'echo "Hello World."'
38
- scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
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
- b = Net::SSH::Simple.async do
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
- a.value # Wait for thread A to finish and capture result
47
- b.value # Wait for thread B to finish and capture result
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
 
@@ -15,18 +15,19 @@ module Net
15
15
  #
16
16
  # @example
17
17
  # # Block Syntax (asynchronous)
18
- # a = Net::SSH::Simple.async do
19
- # ssh 'example1.com', 'echo "Hello World."'
20
- # scp_ul 'example2.com', '/tmp/local_foo', '/tmp/remote_bar'
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
- # b = Net::SSH::Simple.async do
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
- # a.value # Wait for thread A to finish and capture result
29
- # b.value # Wait for thread B to finish and capture result
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 (partial 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 thrown inside your thread.
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::Result => e
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
- # # Parametrizing Net::SSH
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 for the operation that failed, as an Array: [host, opts, result].
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} for the interrupted operation.
599
+ # {Net::SSH::Simple::Result} of the interrupted operation.
600
600
  attr_reader :result
601
601
 
602
602
  def initialize(msg, e=$!)
@@ -1,7 +1,7 @@
1
1
  module Net
2
2
  module SSH
3
3
  class Simple
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
6
6
  end
7
7
  end
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.0
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: &7024800 !ruby/object:Gem::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: *7024800
24
+ version_requirements: *17315940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: net-scp
27
- requirement: &7024140 !ruby/object:Gem::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: *7024140
35
+ version_requirements: *17315180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: blockenspiel
38
- requirement: &7023480 !ruby/object:Gem::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: *7023480
46
+ version_requirements: *17314420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hashie
49
- requirement: &7022900 !ruby/object:Gem::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: *7022900
57
+ version_requirements: *17311140
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &7022240 !ruby/object:Gem::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: *7022240
68
+ version_requirements: *17310360
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &7021660 !ruby/object:Gem::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: *7021660
79
+ version_requirements: *17309700
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cover_me
82
- requirement: &7020960 !ruby/object:Gem::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: *7020960
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: 2238180045890726956
127
+ hash: -219310430856691553
128
128
  requirements: []
129
129
  rubyforge_project:
130
130
  rubygems_version: 1.8.10