sshkit 0.0.19 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +14 -0
- data/README.md +4 -4
- data/lib/sshkit/backends/netssh.rb +8 -6
- data/lib/sshkit/configuration.rb +17 -4
- data/lib/sshkit/formatters/pretty.rb +1 -1
- data/lib/sshkit/version.rb +1 -1
- data/test/unit/backends/test_netssh.rb +1 -1
- data/test/unit/test_configuration.rb +5 -1
- metadata +31 -58
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8db213100be25113e238342987c5a12ed7412b15
|
4
|
+
data.tar.gz: 7067bc10963a3d8f98f45711075418bed865c590
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ab26645180f7f6ecc458735ec542b620024ee612d35738c0219d7add6a20fc7388e1b9f4c872370e9a2fb74dd100a7efc740d0b73d517b391a411b7f29104e92
|
7
|
+
data.tar.gz: f3f840a846d275c20ad325134eb37caa582cf20d7025bf15a69ca82c024ef10ee2c797505d26e4d7f284499b4a5707f46c2c783ac66534db9e2ccdad23fe4342
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,20 @@
|
|
3
3
|
This file is written in reverse chronological order, newer releases will
|
4
4
|
appear at the top.
|
5
5
|
|
6
|
+
## 0.0.21
|
7
|
+
|
8
|
+
* Fixed an issue with default formatter
|
9
|
+
* Modified SSHKit.config.output_verbosity= to accept different objects:
|
10
|
+
|
11
|
+
SSHKit.config.output_verbosity = Logger::INFO
|
12
|
+
SSHKit.config.output_verbosity = :info
|
13
|
+
SSHKit.config.output_verbosity = 1
|
14
|
+
|
15
|
+
## 0.0.20
|
16
|
+
|
17
|
+
* Fixed a bug where the log level would be assigned, not compared in the
|
18
|
+
pretty formatter, breaking the remainder of the output verbosity.
|
19
|
+
|
6
20
|
## 0.0.19
|
7
21
|
|
8
22
|
* Modified the `Pretty` formatter to include the log level in front of
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
![SSHKit Logo](https://raw.github.com/
|
1
|
+
![SSHKit Logo](https://raw.github.com/leehambley/sshkit/master/assets/images/logo.png)
|
2
2
|
|
3
3
|
**SSHKit** is a toolkit for running commands in a structured way on one or
|
4
4
|
more servers.
|
5
5
|
|
6
|
-
[![Build Status](https://travis-ci.org/
|
7
|
-
[![Dependency Status](https://gemnasium.com/
|
6
|
+
[![Build Status](https://travis-ci.org/leehambley/sshkit.png?branch=master)](https://travis-ci.org/leehambley/sshkit)
|
7
|
+
[![Dependency Status](https://gemnasium.com/leehambley/sshkit.png)](https://gemnasium.com/leehambley/sshkit)
|
8
8
|
|
9
9
|
## How might it work?
|
10
10
|
|
@@ -158,7 +158,7 @@ first argument before attempting to find it in the *command map*.
|
|
158
158
|
|
159
159
|
## Output Handling
|
160
160
|
|
161
|
-
![Example Output](https://raw.github.com/
|
161
|
+
![Example Output](https://raw.github.com/leehambley/sshkit/master/assets/images/example_output.png)
|
162
162
|
|
163
163
|
The output handling comprises two objects, first is the output itself, by
|
164
164
|
default this is *$stdout*, but can be any object responding to a
|
@@ -37,12 +37,14 @@ module SSHKit
|
|
37
37
|
_execute(*[*args, options]).stdout.strip
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
class << self
|
41
|
+
def configure
|
42
|
+
yield config
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
def config
|
46
|
+
@config ||= Configuration.new
|
47
|
+
end
|
46
48
|
end
|
47
49
|
|
48
50
|
private
|
@@ -52,7 +54,7 @@ module SSHKit
|
|
52
54
|
output << cmd
|
53
55
|
cmd.started = true
|
54
56
|
ssh.open_channel do |chan|
|
55
|
-
chan.request_pty if config.pty
|
57
|
+
chan.request_pty if Netssh.config.pty
|
56
58
|
chan.exec cmd.to_command do |ch, success|
|
57
59
|
chan.on_data do |ch, data|
|
58
60
|
cmd.stdout += data
|
data/lib/sshkit/configuration.rb
CHANGED
@@ -6,7 +6,7 @@ module SSHKit
|
|
6
6
|
attr_writer :output, :backend, :default_env, :command_map
|
7
7
|
|
8
8
|
def output
|
9
|
-
@output ||=
|
9
|
+
@output ||= formatter(:pretty)
|
10
10
|
end
|
11
11
|
|
12
12
|
def default_env
|
@@ -18,12 +18,15 @@ module SSHKit
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def output_verbosity
|
21
|
-
@output_verbosity ||=
|
21
|
+
@output_verbosity ||= logger(:info)
|
22
|
+
end
|
23
|
+
|
24
|
+
def output_verbosity=(verbosity)
|
25
|
+
@output_verbosity = logger(verbosity)
|
22
26
|
end
|
23
27
|
|
24
28
|
def format=(format)
|
25
|
-
|
26
|
-
self.output = formatter.new($stdout)
|
29
|
+
self.output = formatter(format)
|
27
30
|
end
|
28
31
|
|
29
32
|
def command_map
|
@@ -38,6 +41,16 @@ module SSHKit
|
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
44
|
+
private
|
45
|
+
|
46
|
+
def logger(verbosity)
|
47
|
+
verbosity.is_a?(Integer) ? verbosity : Logger.const_get(verbosity.upcase)
|
48
|
+
end
|
49
|
+
|
50
|
+
def formatter(format)
|
51
|
+
SSHKit::Formatter.const_get(format.capitalize).new($stdout)
|
52
|
+
end
|
53
|
+
|
41
54
|
end
|
42
55
|
|
43
56
|
end
|
@@ -13,7 +13,7 @@ module SSHKit
|
|
13
13
|
|
14
14
|
unless obj.started?
|
15
15
|
original_output << level(obj.verbosity) + uuid(obj) + "Running #{c.yellow(c.bold(String(obj)))} on #{c.blue(obj.host.to_s)}\n"
|
16
|
-
if SSHKit.config.output_verbosity
|
16
|
+
if SSHKit.config.output_verbosity == Logger::DEBUG
|
17
17
|
original_output << level(Logger::DEBUG) + uuid(obj) + c.white("Command: #{c.blue(obj.to_command)}") + "\n"
|
18
18
|
end
|
19
19
|
end
|
data/lib/sshkit/version.rb
CHANGED
@@ -23,7 +23,11 @@ module SSHKit
|
|
23
23
|
|
24
24
|
def test_output_verbosity
|
25
25
|
assert_equal Logger::INFO, SSHKit.config.output_verbosity
|
26
|
-
assert SSHKit.config.output_verbosity =
|
26
|
+
assert SSHKit.config.output_verbosity = :debug
|
27
|
+
assert_equal Logger::DEBUG, SSHKit.config.output_verbosity
|
28
|
+
assert SSHKit.config.output_verbosity = Logger::INFO
|
29
|
+
assert_equal Logger::INFO, SSHKit.config.output_verbosity
|
30
|
+
assert SSHKit.config.output_verbosity = 0
|
27
31
|
assert_equal Logger::DEBUG, SSHKit.config.output_verbosity
|
28
32
|
end
|
29
33
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sshkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.21
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Lee Hambley
|
@@ -10,46 +9,41 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-03-22 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: net-ssh
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: term-ansicolor
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: minitest
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - '>='
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: 2.11.3
|
55
49
|
- - <
|
@@ -58,9 +52,8 @@ dependencies:
|
|
58
52
|
type: :development
|
59
53
|
prerelease: false
|
60
54
|
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
55
|
requirements:
|
63
|
-
- -
|
56
|
+
- - '>='
|
64
57
|
- !ruby/object:Gem::Version
|
65
58
|
version: 2.11.3
|
66
59
|
- - <
|
@@ -69,145 +62,127 @@ dependencies:
|
|
69
62
|
- !ruby/object:Gem::Dependency
|
70
63
|
name: autotest
|
71
64
|
requirement: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
65
|
requirements:
|
74
|
-
- -
|
66
|
+
- - '>='
|
75
67
|
- !ruby/object:Gem::Version
|
76
68
|
version: '0'
|
77
69
|
type: :development
|
78
70
|
prerelease: false
|
79
71
|
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
72
|
requirements:
|
82
|
-
- -
|
73
|
+
- - '>='
|
83
74
|
- !ruby/object:Gem::Version
|
84
75
|
version: '0'
|
85
76
|
- !ruby/object:Gem::Dependency
|
86
77
|
name: rake
|
87
78
|
requirement: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
79
|
requirements:
|
90
|
-
- -
|
80
|
+
- - '>='
|
91
81
|
- !ruby/object:Gem::Version
|
92
82
|
version: '0'
|
93
83
|
type: :development
|
94
84
|
prerelease: false
|
95
85
|
version_requirements: !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
86
|
requirements:
|
98
|
-
- -
|
87
|
+
- - '>='
|
99
88
|
- !ruby/object:Gem::Version
|
100
89
|
version: '0'
|
101
90
|
- !ruby/object:Gem::Dependency
|
102
91
|
name: turn
|
103
92
|
requirement: !ruby/object:Gem::Requirement
|
104
|
-
none: false
|
105
93
|
requirements:
|
106
|
-
- -
|
94
|
+
- - '>='
|
107
95
|
- !ruby/object:Gem::Version
|
108
96
|
version: '0'
|
109
97
|
type: :development
|
110
98
|
prerelease: false
|
111
99
|
version_requirements: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
100
|
requirements:
|
114
|
-
- -
|
101
|
+
- - '>='
|
115
102
|
- !ruby/object:Gem::Version
|
116
103
|
version: '0'
|
117
104
|
- !ruby/object:Gem::Dependency
|
118
105
|
name: unindent
|
119
106
|
requirement: !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
107
|
requirements:
|
122
|
-
- -
|
108
|
+
- - '>='
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
type: :development
|
126
112
|
prerelease: false
|
127
113
|
version_requirements: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
114
|
requirements:
|
130
|
-
- -
|
115
|
+
- - '>='
|
131
116
|
- !ruby/object:Gem::Version
|
132
117
|
version: '0'
|
133
118
|
- !ruby/object:Gem::Dependency
|
134
119
|
name: mocha
|
135
120
|
requirement: !ruby/object:Gem::Requirement
|
136
|
-
none: false
|
137
121
|
requirements:
|
138
|
-
- -
|
122
|
+
- - '>='
|
139
123
|
- !ruby/object:Gem::Version
|
140
124
|
version: '0'
|
141
125
|
type: :development
|
142
126
|
prerelease: false
|
143
127
|
version_requirements: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
128
|
requirements:
|
146
|
-
- -
|
129
|
+
- - '>='
|
147
130
|
- !ruby/object:Gem::Version
|
148
131
|
version: '0'
|
149
132
|
- !ruby/object:Gem::Dependency
|
150
133
|
name: debugger
|
151
134
|
requirement: !ruby/object:Gem::Requirement
|
152
|
-
none: false
|
153
135
|
requirements:
|
154
|
-
- -
|
136
|
+
- - '>='
|
155
137
|
- !ruby/object:Gem::Version
|
156
138
|
version: '0'
|
157
139
|
type: :development
|
158
140
|
prerelease: false
|
159
141
|
version_requirements: !ruby/object:Gem::Requirement
|
160
|
-
none: false
|
161
142
|
requirements:
|
162
|
-
- -
|
143
|
+
- - '>='
|
163
144
|
- !ruby/object:Gem::Version
|
164
145
|
version: '0'
|
165
146
|
- !ruby/object:Gem::Dependency
|
166
147
|
name: vagrant
|
167
148
|
requirement: !ruby/object:Gem::Requirement
|
168
|
-
none: false
|
169
149
|
requirements:
|
170
|
-
- -
|
150
|
+
- - '>='
|
171
151
|
- !ruby/object:Gem::Version
|
172
152
|
version: '0'
|
173
153
|
type: :development
|
174
154
|
prerelease: false
|
175
155
|
version_requirements: !ruby/object:Gem::Requirement
|
176
|
-
none: false
|
177
156
|
requirements:
|
178
|
-
- -
|
157
|
+
- - '>='
|
179
158
|
- !ruby/object:Gem::Version
|
180
159
|
version: '0'
|
181
160
|
- !ruby/object:Gem::Dependency
|
182
161
|
name: yard
|
183
162
|
requirement: !ruby/object:Gem::Requirement
|
184
|
-
none: false
|
185
163
|
requirements:
|
186
|
-
- -
|
164
|
+
- - '>='
|
187
165
|
- !ruby/object:Gem::Version
|
188
166
|
version: '0'
|
189
167
|
type: :development
|
190
168
|
prerelease: false
|
191
169
|
version_requirements: !ruby/object:Gem::Requirement
|
192
|
-
none: false
|
193
170
|
requirements:
|
194
|
-
- -
|
171
|
+
- - '>='
|
195
172
|
- !ruby/object:Gem::Version
|
196
173
|
version: '0'
|
197
174
|
- !ruby/object:Gem::Dependency
|
198
175
|
name: redcarpet
|
199
176
|
requirement: !ruby/object:Gem::Requirement
|
200
|
-
none: false
|
201
177
|
requirements:
|
202
|
-
- -
|
178
|
+
- - '>='
|
203
179
|
- !ruby/object:Gem::Version
|
204
180
|
version: '0'
|
205
181
|
type: :development
|
206
182
|
prerelease: false
|
207
183
|
version_requirements: !ruby/object:Gem::Requirement
|
208
|
-
none: false
|
209
184
|
requirements:
|
210
|
-
- -
|
185
|
+
- - '>='
|
211
186
|
- !ruby/object:Gem::Version
|
212
187
|
version: '0'
|
213
188
|
description: A comprehensive toolkit for remotely running commands in a structured
|
@@ -269,27 +244,26 @@ files:
|
|
269
244
|
- test/unit/test_host.rb
|
270
245
|
homepage: http://wacku.github.com/sshkit
|
271
246
|
licenses: []
|
247
|
+
metadata: {}
|
272
248
|
post_install_message:
|
273
249
|
rdoc_options: []
|
274
250
|
require_paths:
|
275
251
|
- lib
|
276
252
|
required_ruby_version: !ruby/object:Gem::Requirement
|
277
|
-
none: false
|
278
253
|
requirements:
|
279
|
-
- -
|
254
|
+
- - '>='
|
280
255
|
- !ruby/object:Gem::Version
|
281
256
|
version: '0'
|
282
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
283
|
-
none: false
|
284
258
|
requirements:
|
285
|
-
- -
|
259
|
+
- - '>='
|
286
260
|
- !ruby/object:Gem::Version
|
287
261
|
version: '0'
|
288
262
|
requirements: []
|
289
263
|
rubyforge_project:
|
290
|
-
rubygems_version:
|
264
|
+
rubygems_version: 2.0.0
|
291
265
|
signing_key:
|
292
|
-
specification_version:
|
266
|
+
specification_version: 4
|
293
267
|
summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby
|
294
268
|
test_files:
|
295
269
|
- test/functional/backends/test_netssh.rb
|
@@ -303,4 +277,3 @@ test_files:
|
|
303
277
|
- test/unit/test_configuration.rb
|
304
278
|
- test/unit/test_coordinator.rb
|
305
279
|
- test/unit/test_host.rb
|
306
|
-
has_rdoc:
|