open4ssh 0.1.4 → 0.2.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +15 -1
- data/CHANGELOG.md +6 -1
- data/README.md +2 -2
- data/Rakefile +2 -0
- data/lib/open4ssh/version.rb +1 -1
- data/lib/open4ssh.rb +10 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccf88f70ce6864212bb272081720505b596accb1
|
4
|
+
data.tar.gz: 2316152b8b85d3457e36f23c9ea7c2ad5b31cab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2adc8f816a6ddc7823b9d097ee58cc943ddaa62d150a01cbf82842d16ba4424f089f7b6f26802c7760f54bf15a7cea115e4840b1df081e175c6b17f08297973
|
7
|
+
data.tar.gz: 33742e1cf386283107c3e1132904f75aa8a7dfb278c5422e7d443846811b012cc4baae0c940665ff013d16831d21e929a4222dddbfe62df6e0f263395ca2d570
|
data/.travis.yml
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
rvm:
|
3
4
|
- 2.2.0
|
4
|
-
|
5
|
+
- 2.3.0
|
6
|
+
|
7
|
+
sudo: required
|
8
|
+
|
9
|
+
services:
|
10
|
+
- docker
|
11
|
+
|
12
|
+
before_install:
|
13
|
+
- gem install bundler -v 1.10.6
|
14
|
+
- docker pull keto/ssh
|
15
|
+
- docker run -d -p 2222:22 -e SSH_PASSWORD=secret -e SSH_USERNAME=nane keto/ssh
|
16
|
+
|
17
|
+
script:
|
18
|
+
- bundle exec rake test
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,8 +16,8 @@ sequence of commands and returns their exit codes, standard out and standard err
|
|
16
16
|
Open4ssh is most useful in remote automation scenarios which are triggered from Ruby environments.
|
17
17
|
|
18
18
|
- [RubyGems](https://rubygems.org/gems/open4ssh)
|
19
|
-
- [
|
20
|
-
- [
|
19
|
+
- Master: [](https://travis-ci.org/nkratzke/open4ssh)
|
20
|
+
- Develop: [](https://travis-ci.org/nkratzke/open4ssh)
|
21
21
|
|
22
22
|
## Installation
|
23
23
|
|
data/Rakefile
CHANGED
data/lib/open4ssh/version.rb
CHANGED
data/lib/open4ssh.rb
CHANGED
@@ -37,6 +37,7 @@ module Open4ssh
|
|
37
37
|
# @param cmd [String] valid shell command string to be executed on host (required)
|
38
38
|
#
|
39
39
|
# @return [String] console output of executed command (output includes stdout and stderr)
|
40
|
+
# @raise [One of Net::SSH::Exceptions] In case of net::ssh errors due to connection problems, authentication errors, timeouts, ....
|
40
41
|
#
|
41
42
|
# @example
|
42
43
|
# stdout = Open4ssh.capture(
|
@@ -69,6 +70,7 @@ module Open4ssh
|
|
69
70
|
# @param verbose [Bool] console outputs are plotted to stdout/stderr if set (defaults to false)
|
70
71
|
#
|
71
72
|
# @return [exit_code, std_out, std_err] exit_code, stdout, stderr of executed command
|
73
|
+
# @raise [One of Net::SSH::Exceptions] In case of net::ssh errors due to connection problems, authentication errors, timeouts, ....
|
72
74
|
#
|
73
75
|
# @example
|
74
76
|
# exit_code, std_err, std_out = Open4ssh.capture3(
|
@@ -98,6 +100,7 @@ module Open4ssh
|
|
98
100
|
# @param verbose [Bool] console outputs are plotted to stdout/stderr if set (defaults to false)
|
99
101
|
#
|
100
102
|
# @return [Array<exit_code, std_out, std_err, command>] List of exit_code, stdout, stderr and executed commands
|
103
|
+
# @raise [One of Net::SSH::Exceptions] In case of net::ssh errors due to connection problems, authentication errors, timeouts, ....
|
101
104
|
#
|
102
105
|
# @example
|
103
106
|
# exit_code, stderr, stdout, command = Open4ssh.capture4(
|
@@ -179,8 +182,7 @@ module Open4ssh
|
|
179
182
|
# end
|
180
183
|
#
|
181
184
|
def self.success(results)
|
182
|
-
results.select { |result| result[0] != 0 }
|
183
|
-
.empty?
|
185
|
+
results.select { |result| result[0] != 0 }.empty?
|
184
186
|
end
|
185
187
|
|
186
188
|
# Collects all stdout messages of a list of executed shell commands.
|
@@ -208,9 +210,8 @@ module Open4ssh
|
|
208
210
|
# end
|
209
211
|
#
|
210
212
|
def self.stdout(results)
|
211
|
-
|
212
|
-
|
213
|
-
output.strip
|
213
|
+
results.map { |result| result[1] }
|
214
|
+
.select { |stdout| not stdout.strip.empty? } * ''
|
214
215
|
end
|
215
216
|
|
216
217
|
# Collects all stderr messages of a list of executed shell commands.
|
@@ -238,9 +239,8 @@ module Open4ssh
|
|
238
239
|
# end
|
239
240
|
#
|
240
241
|
def self.stderr(results)
|
241
|
-
|
242
|
-
|
243
|
-
output.strip
|
242
|
+
results.map { |result| result[2] }
|
243
|
+
.select { |stderr| not stderr.strip.empty? } * ''
|
244
244
|
end
|
245
245
|
|
246
246
|
# Collects all console messages (stdout + stderr) of a list of executed shell commands.
|
@@ -265,9 +265,7 @@ module Open4ssh
|
|
265
265
|
# puts Open4ssh.console(ecodes) # Print collected console messages of all executed commands
|
266
266
|
#
|
267
267
|
def self.console(results)
|
268
|
-
|
269
|
-
|
270
|
-
output.strip
|
268
|
+
results.map { |result| "#{result[1]}#{result[2]}" }
|
269
|
+
.select { |console| not console.strip.empty? } * ''
|
271
270
|
end
|
272
|
-
|
273
271
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open4ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nane Kratzke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.5.1
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Wrapper around net-ssh for plain execution of remote shell commands.
|