ztk 1.6.24 → 1.6.25
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ztk/command/exec.rb +3 -3
- data/lib/ztk/command/private.rb +4 -4
- data/lib/ztk/ssh/exec.rb +3 -3
- data/lib/ztk/ssh/private.rb +10 -9
- data/lib/ztk/version.rb +1 -1
- metadata +4 -4
data/lib/ztk/command/exec.rb
CHANGED
@@ -71,7 +71,7 @@ module ZTK
|
|
71
71
|
|
72
72
|
direct_log(:info) { log_header("COMMAND") }
|
73
73
|
direct_log(:info) { "#{command.inspect}\n" }
|
74
|
-
direct_log(:info) { log_header("STARTED") }
|
74
|
+
direct_log(:info) { log_header("STARTED", "-") }
|
75
75
|
|
76
76
|
begin
|
77
77
|
Timeout.timeout(options.timeout) do
|
@@ -88,7 +88,7 @@ module ZTK
|
|
88
88
|
case reader_writer_key[pipe]
|
89
89
|
when :stdout then
|
90
90
|
if !stdout_header
|
91
|
-
direct_log(:info) { log_header("STDOUT") }
|
91
|
+
direct_log(:info) { log_header("STDOUT", "-") }
|
92
92
|
stdout_header = true
|
93
93
|
stderr_header = false
|
94
94
|
end
|
@@ -97,7 +97,7 @@ module ZTK
|
|
97
97
|
|
98
98
|
when :stderr then
|
99
99
|
if !stderr_header
|
100
|
-
direct_log(:warn) { log_header("STDERR") }
|
100
|
+
direct_log(:warn) { log_header("STDERR", "-") }
|
101
101
|
stderr_header = true
|
102
102
|
stdout_header = false
|
103
103
|
end
|
data/lib/ztk/command/private.rb
CHANGED
@@ -13,10 +13,10 @@ module ZTK
|
|
13
13
|
|
14
14
|
# Formats a header suitable for writing to the direct logger when logging
|
15
15
|
# sessions.
|
16
|
-
def log_header(what)
|
17
|
-
count =
|
18
|
-
sep = (
|
19
|
-
header = [sep, "[ #{
|
16
|
+
def log_header(what, char="=")
|
17
|
+
count = 16
|
18
|
+
sep = (char * count)
|
19
|
+
header = [sep, "[ #{tag} >>> #{what} ]", sep].join
|
20
20
|
"#{header}\n"
|
21
21
|
end
|
22
22
|
|
data/lib/ztk/ssh/exec.rb
CHANGED
@@ -63,14 +63,14 @@ module ZTK
|
|
63
63
|
|
64
64
|
direct_log(:info) { log_header("COMMAND") }
|
65
65
|
direct_log(:info) { "#{command}\n" }
|
66
|
-
direct_log(:info) { log_header("OPENED") }
|
66
|
+
direct_log(:info) { log_header("OPENED", "-") }
|
67
67
|
|
68
68
|
chan.exec(command) do |ch, success|
|
69
69
|
success or log_and_raise(SSHError, "Could not execute '#{command}'.")
|
70
70
|
|
71
71
|
ch.on_data do |c, data|
|
72
72
|
if !stdout_header
|
73
|
-
direct_log(:info) { log_header("STDOUT") }
|
73
|
+
direct_log(:info) { log_header("STDOUT", "-") }
|
74
74
|
stdout_header = true
|
75
75
|
stderr_header = false
|
76
76
|
end
|
@@ -84,7 +84,7 @@ module ZTK
|
|
84
84
|
|
85
85
|
ch.on_extended_data do |c, type, data|
|
86
86
|
if !stderr_header
|
87
|
-
direct_log(:warn) { log_header("STDERR") }
|
87
|
+
direct_log(:warn) { log_header("STDERR", "-") }
|
88
88
|
stderr_header = true
|
89
89
|
stdout_header = false
|
90
90
|
end
|
data/lib/ztk/ssh/private.rb
CHANGED
@@ -40,24 +40,25 @@ module ZTK
|
|
40
40
|
def tag
|
41
41
|
tags = Array.new
|
42
42
|
|
43
|
+
user_host = "#{config.user}@#{config.host_name}"
|
44
|
+
port = (config.port ? ":#{config.port}" : nil)
|
45
|
+
tags << [user_host, port].compact.join
|
46
|
+
|
43
47
|
if config.proxy_host_name
|
48
|
+
tags << " via "
|
49
|
+
|
44
50
|
proxy_user_host = "#{config.proxy_user}@#{config.proxy_host_name}"
|
45
51
|
proxy_port = (config.proxy_port ? ":#{config.proxy_port}" : nil)
|
46
52
|
tags << [proxy_user_host, proxy_port].compact.join
|
47
|
-
tags << " >>> "
|
48
53
|
end
|
49
54
|
|
50
|
-
user_host = "#{config.user}@#{config.host_name}"
|
51
|
-
port = (config.port ? ":#{config.port}" : nil)
|
52
|
-
tags << [user_host, port].compact.join
|
53
|
-
|
54
55
|
tags.join.strip
|
55
56
|
end
|
56
57
|
|
57
|
-
def log_header(what)
|
58
|
-
count =
|
59
|
-
sep = (
|
60
|
-
header = [sep, "[ #{
|
58
|
+
def log_header(what, char='=')
|
59
|
+
count = 16
|
60
|
+
sep = (char * count)
|
61
|
+
header = [sep, "[ #{tag} >>> #{what} ]", sep].join
|
61
62
|
"#{header}\n"
|
62
63
|
end
|
63
64
|
|
data/lib/ztk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ztk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.25
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -275,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
275
|
version: '0'
|
276
276
|
segments:
|
277
277
|
- 0
|
278
|
-
hash:
|
278
|
+
hash: 1433051494902520817
|
279
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
280
|
none: false
|
281
281
|
requirements:
|
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
284
|
version: '0'
|
285
285
|
segments:
|
286
286
|
- 0
|
287
|
-
hash:
|
287
|
+
hash: 1433051494902520817
|
288
288
|
requirements: []
|
289
289
|
rubyforge_project:
|
290
290
|
rubygems_version: 1.8.25
|