ztk 1.6.24 → 1.6.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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 = 12
18
- sep = ("=" * count)
19
- header = [sep, "[ #{what} ]", sep, "[ #{tag} ]", sep, "[ #{what} ]", sep].join
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
 
@@ -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
@@ -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 = 12
59
- sep = ("=" * count)
60
- header = [sep, "[ #{what} ]", sep, "[ #{tag} ]", sep, "[ #{what} ]", sep].join
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
 
@@ -1,6 +1,6 @@
1
1
  module ZTK
2
2
 
3
3
  # ZTK Version String
4
- VERSION = "1.6.24"
4
+ VERSION = "1.6.25"
5
5
 
6
6
  end
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.24
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-15 00:00:00.000000000 Z
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: -2990163974537273160
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: -2990163974537273160
287
+ hash: 1433051494902520817
288
288
  requirements: []
289
289
  rubyforge_project:
290
290
  rubygems_version: 1.8.25