net-ssh-session 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +0 -1
- data/CREDITS +7 -0
- data/README.md +11 -12
- data/lib/net-ssh-session/version.rb +1 -1
- data/lib/net/ssh/session.rb +7 -1
- data/net-ssh-session.gemspec +3 -3
- data/spec/session_helpers_spec.rb +2 -2
- metadata +16 -25
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c58dfc3590d61f2b7dfa37f5369dab38a7369d17
|
4
|
+
data.tar.gz: 2166f09668a2d8a4e43d9d3e1012391f14d21186
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 067415a237670c4aa42247babd13be00733bf8f4b41d09d3584927bcb5ba0d743c357417c9856414a9d310c37bb025b9a5177af2240060ac8c12499a982670d0
|
7
|
+
data.tar.gz: 694da321fbe86c3069ae94a4e4e926c85e7524183a7b8ac1cd5112d356773ca3b5fde10d9fb691540dc2456177d7ac879cef598b582efe50b2d5f298e3832f59
|
data/.travis.yml
CHANGED
data/CREDITS
ADDED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
A wrapper on top of `Net::SSH` and `Net::SSH::Shell` to provide a set of tools for ssh sessions
|
4
4
|
|
5
|
+
[![Build Status](https://travis-ci.org/sosedoff/net-ssh-session.png?branch=master)](https://travis-ci.org/sosedoff/net-ssh-session)
|
6
|
+
|
5
7
|
## Install
|
6
8
|
|
7
9
|
Install with rubygems:
|
@@ -23,8 +25,13 @@ Basic usage:
|
|
23
25
|
```ruby
|
24
26
|
require 'net/ssh/session'
|
25
27
|
|
26
|
-
#
|
28
|
+
# Initialize a new connection
|
27
29
|
session = Net::SSH::Session.new(host, user, password)
|
30
|
+
|
31
|
+
# Initialize connection on a different SSH port
|
32
|
+
session = Net::SSH::Session.new(host, user, password, :port => 5000)
|
33
|
+
|
34
|
+
# Connect to server
|
28
35
|
session.open
|
29
36
|
|
30
37
|
# If you want to set a connection timeout in seconds
|
@@ -193,16 +200,8 @@ session = Net::SSH::Session.new(host, user, password, :timeout => 10)
|
|
193
200
|
This will limit any command execution time to 10 seconds. Error `Timeout::Error`
|
194
201
|
will be raised when timeout is exceeded.
|
195
202
|
|
196
|
-
## Credits
|
197
|
-
|
198
|
-
Library code was extracted and modified from multiple sources:
|
199
|
-
|
200
|
-
- Dan Sosedoff (@sosedoff)
|
201
|
-
- Mitchell Hashimoto (@mitchellh)
|
202
|
-
- Michael Klishin (@michaelklishin)
|
203
|
-
- Sven Fuchs (@svenfuchs)
|
204
|
-
- Travis-CI (@travis-ci)
|
205
|
-
|
206
203
|
## License
|
207
204
|
|
208
|
-
|
205
|
+
The MIT License (MIT)
|
206
|
+
|
207
|
+
Copyright (c) 2013 Dan Sosedoff, <dan.sosedoff@gmail.com>
|
data/lib/net/ssh/session.rb
CHANGED
@@ -24,6 +24,7 @@ module Net
|
|
24
24
|
def initialize(host, user, password='', options={})
|
25
25
|
@host = host
|
26
26
|
@user = user
|
27
|
+
@port = options[:port] || 22
|
27
28
|
@password = password
|
28
29
|
@history = []
|
29
30
|
@track_history = true
|
@@ -154,7 +155,12 @@ module Net
|
|
154
155
|
private
|
155
156
|
|
156
157
|
def establish_connection
|
157
|
-
|
158
|
+
opts = {
|
159
|
+
:password => @password,
|
160
|
+
:port => @port
|
161
|
+
}
|
162
|
+
|
163
|
+
@connection = Net::SSH.start(host, user, opts)
|
158
164
|
@shell = @connection.shell
|
159
165
|
end
|
160
166
|
|
data/net-ssh-session.gemspec
CHANGED
@@ -9,9 +9,9 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Dan Sosedoff"]
|
10
10
|
s.email = ["dan.sosedoff@gmail.com"]
|
11
11
|
|
12
|
-
s.add_development_dependency 'rake'
|
13
|
-
s.add_development_dependency 'rspec', '~> 2.
|
14
|
-
s.add_development_dependency 'simplecov', '~> 0.
|
12
|
+
s.add_development_dependency 'rake', '~> 10'
|
13
|
+
s.add_development_dependency 'rspec', '~> 2.14'
|
14
|
+
s.add_development_dependency 'simplecov', '~> 0.7'
|
15
15
|
|
16
16
|
s.add_dependency 'net-ssh', '~> 2.6'
|
17
17
|
|
@@ -137,11 +137,11 @@ describe Net::SSH::SessionHelpers do
|
|
137
137
|
end
|
138
138
|
|
139
139
|
it 'raises timeout error if exceded' do
|
140
|
-
expect { session.with_timeout(0.5, &worker) }.to raise_error
|
140
|
+
expect { session.with_timeout(0.5, &worker) }.to raise_error
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'runs normally' do
|
144
|
-
expect { session.with_timeout(2, &worker) }.not_to raise_error
|
144
|
+
expect { session.with_timeout(2, &worker) }.not_to raise_error
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
metadata
CHANGED
@@ -1,68 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ssh-session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dan Sosedoff
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-12-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '10'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '10'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: '2.
|
33
|
+
version: '2.14'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: '2.
|
40
|
+
version: '2.14'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: simplecov
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
47
|
+
version: '0.7'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
54
|
+
version: '0.7'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: net-ssh
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -85,6 +76,7 @@ files:
|
|
85
76
|
- .gitignore
|
86
77
|
- .rspec
|
87
78
|
- .travis.yml
|
79
|
+
- CREDITS
|
88
80
|
- Gemfile
|
89
81
|
- LICENSE
|
90
82
|
- README.md
|
@@ -105,27 +97,26 @@ files:
|
|
105
97
|
- spec/spec_helper.rb
|
106
98
|
homepage: https://github.com/sosedoff/net-ssh-session
|
107
99
|
licenses: []
|
100
|
+
metadata: {}
|
108
101
|
post_install_message:
|
109
102
|
rdoc_options: []
|
110
103
|
require_paths:
|
111
104
|
- lib
|
112
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
106
|
requirements:
|
115
|
-
- -
|
107
|
+
- - '>='
|
116
108
|
- !ruby/object:Gem::Version
|
117
109
|
version: '0'
|
118
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
111
|
requirements:
|
121
|
-
- -
|
112
|
+
- - '>='
|
122
113
|
- !ruby/object:Gem::Version
|
123
114
|
version: '0'
|
124
115
|
requirements: []
|
125
116
|
rubyforge_project:
|
126
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 2.1.11
|
127
118
|
signing_key:
|
128
|
-
specification_version:
|
119
|
+
specification_version: 4
|
129
120
|
summary: Shell session for Net::SSH connections
|
130
121
|
test_files:
|
131
122
|
- spec/fixtures/.gitkeep
|