ubalo 0.12 → 0.13
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.
- data/bin/ubalo +4 -1
- data/lib/ubalo/pod.rb +3 -8
- data/lib/ubalo/tailer.rb +41 -0
- data/lib/ubalo/task.rb +13 -11
- data/lib/ubalo/util.rb +12 -4
- data/lib/ubalo/version.rb +1 -1
- data/lib/ubalo.rb +1 -0
- metadata +13 -12
data/bin/ubalo
CHANGED
@@ -174,8 +174,11 @@ command :run do |c|
|
|
174
174
|
c.action do |global_options,options,args|
|
175
175
|
logger.puts "Running #{pod.fullname}."
|
176
176
|
task = pod.run(args.shift)
|
177
|
-
|
177
|
+
|
178
|
+
tailer = Ubalo::Tailer.new(logger)
|
179
|
+
tailer.poll_on("Waiting for task #{task.label.inspect}") do
|
178
180
|
task.refresh!
|
181
|
+
tailer.update(task.process_output)
|
179
182
|
task.complete?
|
180
183
|
end
|
181
184
|
puts task.printable_result
|
data/lib/ubalo/pod.rb
CHANGED
@@ -90,14 +90,9 @@ module Ubalo
|
|
90
90
|
if compilation_process
|
91
91
|
s << "status: #{compilation_process.fetch('exit_result')}\n"
|
92
92
|
|
93
|
-
if
|
94
|
-
s << "stdout:\n"
|
95
|
-
s << Util.indent(
|
96
|
-
end
|
97
|
-
|
98
|
-
if stderr = compilation_process.fetch('stderr') and stderr.length > 0
|
99
|
-
s << "stderr:\n"
|
100
|
-
s << Util.indent(stderr)
|
93
|
+
if process_output = compilation_process.fetch('output') and process_output.length > 0
|
94
|
+
s << "stdout/stderr:\n"
|
95
|
+
s << Util.indent(process_output)
|
101
96
|
end
|
102
97
|
end
|
103
98
|
s
|
data/lib/ubalo/tailer.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
module Ubalo
|
2
|
+
class Tailer
|
3
|
+
def initialize(logger)
|
4
|
+
@logger = logger
|
5
|
+
@output_position = 0
|
6
|
+
@lines = 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def poll_on(message)
|
10
|
+
@message = message
|
11
|
+
|
12
|
+
@logger.puts "stdout/stderr: "
|
13
|
+
@logger.poll do
|
14
|
+
yield
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def update(output)
|
19
|
+
@lines.times do
|
20
|
+
@logger.print "\e[A"
|
21
|
+
@logger.print " " * ENV.fetch("COLUMNS", 80)
|
22
|
+
@logger.print "\r"
|
23
|
+
end
|
24
|
+
|
25
|
+
@lines = 0
|
26
|
+
|
27
|
+
if output
|
28
|
+
@logger.print output[@output_position..-1]
|
29
|
+
@output_position = output.length
|
30
|
+
end
|
31
|
+
|
32
|
+
puts ""
|
33
|
+
puts @message
|
34
|
+
end
|
35
|
+
|
36
|
+
def puts(str)
|
37
|
+
@lines += 1
|
38
|
+
@logger.puts str
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/ubalo/task.rb
CHANGED
@@ -59,16 +59,9 @@ module Ubalo
|
|
59
59
|
|
60
60
|
s << " time: #{'%.1f' % elapsed_time} s\n"
|
61
61
|
|
62
|
-
if
|
63
|
-
|
64
|
-
|
65
|
-
s << Util.indent(stdout)
|
66
|
-
end
|
67
|
-
|
68
|
-
if stderr = container_process.fetch('stderr') and stderr.length > 0
|
69
|
-
s << "stderr:\n"
|
70
|
-
s << Util.indent(stderr)
|
71
|
-
end
|
62
|
+
if process_output
|
63
|
+
s << "stdout/stderr:\n"
|
64
|
+
s << Util.indent(process_output)
|
72
65
|
end
|
73
66
|
|
74
67
|
if output?
|
@@ -82,9 +75,18 @@ module Ubalo
|
|
82
75
|
s
|
83
76
|
end
|
84
77
|
|
85
|
-
|
78
|
+
def process_output
|
79
|
+
if container_process
|
80
|
+
if data = container_process.fetch('output')
|
81
|
+
data
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
86
|
attr_reader :container_process
|
87
87
|
|
88
|
+
private
|
89
|
+
|
88
90
|
def update_attributes(attributes)
|
89
91
|
@state = attributes['state']
|
90
92
|
@arg = attributes['arg']
|
data/lib/ubalo/util.rb
CHANGED
@@ -38,20 +38,28 @@ module Ubalo
|
|
38
38
|
@incomplete_line = false
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
self.print message
|
41
|
+
def poll
|
43
42
|
600.times do
|
44
43
|
if result = yield
|
45
|
-
self.puts " done."
|
46
44
|
return result
|
47
45
|
end
|
48
|
-
self.print '.'
|
49
46
|
sleep 0.5
|
50
47
|
end
|
51
48
|
|
52
49
|
self.complete_line
|
53
50
|
raise Ubalo::Error, "timed-out polling on #{message}"
|
54
51
|
end
|
52
|
+
|
53
|
+
def poll_on(message)
|
54
|
+
self.print message
|
55
|
+
result = poll do
|
56
|
+
self.print '.'
|
57
|
+
yield
|
58
|
+
end
|
59
|
+
|
60
|
+
self.puts " done."
|
61
|
+
result
|
62
|
+
end
|
55
63
|
end
|
56
64
|
|
57
65
|
class << self
|
data/lib/ubalo/version.rb
CHANGED
data/lib/ubalo.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ubalo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.13'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
16
|
-
requirement: &
|
16
|
+
requirement: &70189316806960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70189316806960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: highline
|
27
|
-
requirement: &
|
27
|
+
requirement: &70189316806180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70189316806180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70189316805280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70189316805280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rest-client
|
49
|
-
requirement: &
|
49
|
+
requirement: &70189316804040 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.6.3
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70189316804040
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: archive-tar-minitar
|
60
|
-
requirement: &
|
60
|
+
requirement: &70189316803080 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70189316803080
|
69
69
|
description: CLI and API client for Ubalo
|
70
70
|
email: dev@ubalo.com
|
71
71
|
executables:
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/ubalo/pod.rb
|
78
78
|
- lib/ubalo/pod_archive.rb
|
79
79
|
- lib/ubalo/pod_dir.rb
|
80
|
+
- lib/ubalo/tailer.rb
|
80
81
|
- lib/ubalo/task.rb
|
81
82
|
- lib/ubalo/util.rb
|
82
83
|
- lib/ubalo/version.rb
|