ubalo 0.17 → 0.18
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 +3 -3
- data/lib/ubalo/container_process.rb +3 -37
- data/lib/ubalo/pod.rb +7 -12
- data/lib/ubalo/tailer.rb +11 -2
- data/lib/ubalo/task.rb +10 -15
- data/lib/ubalo/version.rb +1 -1
- metadata +13 -13
data/bin/ubalo
CHANGED
@@ -187,7 +187,7 @@ desc 'Show information about a pod'
|
|
187
187
|
command :pod do |c|
|
188
188
|
c.action do |global_options,options,args|
|
189
189
|
pod.refresh!
|
190
|
-
puts pod.
|
190
|
+
puts pod.printable_result
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
@@ -219,7 +219,7 @@ command :task do |c|
|
|
219
219
|
task = pod.latest_task
|
220
220
|
end
|
221
221
|
|
222
|
-
puts task.
|
222
|
+
puts task.printable_result
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
@@ -253,7 +253,7 @@ command 'task:stop' do |c|
|
|
253
253
|
task.refresh!
|
254
254
|
task.complete?
|
255
255
|
end
|
256
|
-
puts task.
|
256
|
+
puts task.printable_result
|
257
257
|
end
|
258
258
|
end
|
259
259
|
|
@@ -16,56 +16,22 @@ module Ubalo
|
|
16
16
|
|
17
17
|
def update_attributes(attributes)
|
18
18
|
@state = attributes.fetch('state')
|
19
|
-
@started_at = parse_datetime(attributes.fetch('started_at'))
|
20
|
-
@stopped_at = parse_datetime(attributes.fetch('stopped_at'))
|
21
19
|
@exit_type = attributes.fetch('exit_type')
|
22
20
|
@exit_result = attributes.fetch('exit_result')
|
23
21
|
@output = attributes.fetch('output')
|
24
22
|
end
|
25
23
|
|
26
|
-
def tail(
|
24
|
+
def tail(message)
|
27
25
|
tailer = Ubalo::Tailer.new(logger)
|
28
|
-
|
26
|
+
tailer.poll_on(message) do
|
29
27
|
yield
|
30
|
-
|
31
|
-
message = "(#{runtime}) #{running_message}..."
|
32
|
-
if completed?
|
33
|
-
message << "#{final_message}. Exit status: #{exit_result}"
|
34
|
-
end
|
35
|
-
|
36
|
-
tailer.update(@output, message)
|
28
|
+
tailer.update(@output)
|
37
29
|
completed?
|
38
30
|
end
|
39
31
|
end
|
40
32
|
|
41
|
-
def printable_result
|
42
|
-
s = ""
|
43
|
-
s << "status: #{exit_result}\n"
|
44
|
-
s << "runtime: #{runtime}\n"
|
45
|
-
|
46
|
-
if output and output.length > 0
|
47
|
-
s << "stdout/stderr:\n"
|
48
|
-
s << Util.indent(output)
|
49
|
-
end
|
50
|
-
s
|
51
|
-
end
|
52
|
-
|
53
33
|
def completed?
|
54
34
|
@state == 'complete'
|
55
35
|
end
|
56
|
-
|
57
|
-
def runtime
|
58
|
-
if @started_at
|
59
|
-
days = ((@stopped_at || DateTime.now) - @started_at)
|
60
|
-
minutes, seconds = (days * 86400).divmod(60)
|
61
|
-
"%d:%02d s" % [minutes, seconds]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def parse_datetime(string)
|
66
|
-
if string
|
67
|
-
DateTime.parse(string)
|
68
|
-
end
|
69
|
-
end
|
70
36
|
end
|
71
37
|
end
|
data/lib/ubalo/pod.rb
CHANGED
@@ -105,15 +105,9 @@ module Ubalo
|
|
105
105
|
compilation_process
|
106
106
|
end
|
107
107
|
|
108
|
-
|
109
|
-
compilation_process.tail("Compiling #{fullname}", "compiled") do
|
108
|
+
compilation_process.tail("Waiting for #{fullname.inspect} to compile") do
|
110
109
|
refresh!
|
111
110
|
end
|
112
|
-
|
113
|
-
logger.poll_on("Waiting for container to stop") do
|
114
|
-
refresh!
|
115
|
-
compiled?
|
116
|
-
end
|
117
111
|
end
|
118
112
|
|
119
113
|
def delete!
|
@@ -129,13 +123,14 @@ module Ubalo
|
|
129
123
|
s = ""
|
130
124
|
s << " name: #{fullname}\n"
|
131
125
|
s << " state: #{state}\n"
|
132
|
-
s
|
133
|
-
end
|
134
126
|
|
135
|
-
def full_printable_result
|
136
|
-
s = printable_result
|
137
127
|
if compilation_process
|
138
|
-
s << compilation_process.
|
128
|
+
s << "status: #{compilation_process.exit_result}\n"
|
129
|
+
|
130
|
+
if compilation_process.output and compilation_process.output.length > 0
|
131
|
+
s << "stdout/stderr:\n"
|
132
|
+
s << Util.indent(compilation_process.output)
|
133
|
+
end
|
139
134
|
end
|
140
135
|
s
|
141
136
|
end
|
data/lib/ubalo/tailer.rb
CHANGED
@@ -6,7 +6,16 @@ module Ubalo
|
|
6
6
|
@lines = 0
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
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)
|
10
19
|
@lines.times do
|
11
20
|
@logger.print "\e[A"
|
12
21
|
@logger.print " " * Integer(ENV.fetch("COLUMNS", 80))
|
@@ -21,7 +30,7 @@ module Ubalo
|
|
21
30
|
end
|
22
31
|
|
23
32
|
puts ""
|
24
|
-
puts message
|
33
|
+
puts @message
|
25
34
|
end
|
26
35
|
|
27
36
|
def puts(str)
|
data/lib/ubalo/task.rb
CHANGED
@@ -32,15 +32,9 @@ module Ubalo
|
|
32
32
|
container_process
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
container_process.tail("Running #{label.inspect}", "completed") do
|
35
|
+
container_process.tail("Waiting for task #{label.inspect}") do
|
37
36
|
refresh!
|
38
37
|
end
|
39
|
-
|
40
|
-
logger.poll_on("Waiting for container to stop") do
|
41
|
-
refresh!
|
42
|
-
complete?
|
43
|
-
end
|
44
38
|
end
|
45
39
|
|
46
40
|
def stop!
|
@@ -72,6 +66,15 @@ module Ubalo
|
|
72
66
|
s << " state: #{state}\n"
|
73
67
|
s << " time: #{'%.1f' % elapsed_time} s\n"
|
74
68
|
|
69
|
+
if container_process
|
70
|
+
s << "status: #{container_process.exit_result}\n"
|
71
|
+
|
72
|
+
if container_process.output and container_process.output.length > 0
|
73
|
+
s << "stdout/stderr:\n"
|
74
|
+
s << Util.indent(container_process.output)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
75
78
|
if output?
|
76
79
|
if @output_error
|
77
80
|
s << "! Parse error in output: #{@output_error.message}"
|
@@ -83,14 +86,6 @@ module Ubalo
|
|
83
86
|
s
|
84
87
|
end
|
85
88
|
|
86
|
-
def full_printable_result
|
87
|
-
s = printable_result
|
88
|
-
if container_process
|
89
|
-
s << container_process.printable_result
|
90
|
-
end
|
91
|
-
s
|
92
|
-
end
|
93
|
-
|
94
89
|
def pretty_argv
|
95
90
|
Shellwords.join(argv)
|
96
91
|
end
|
data/lib/ubalo/version.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.18'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
16
|
-
requirement: &
|
16
|
+
requirement: &70165820405740 !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: *70165820405740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: highline
|
27
|
-
requirement: &
|
27
|
+
requirement: &70165820404300 !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: *70165820404300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70165820403040 !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: *70165820403040
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rest-client
|
49
|
-
requirement: &
|
49
|
+
requirement: &70165820399420 !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: *70165820399420
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: archive-tar-minitar
|
60
|
-
requirement: &
|
60
|
+
requirement: &70165820397840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70165820397840
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: launchy
|
71
|
-
requirement: &
|
71
|
+
requirement: &70165820396300 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70165820396300
|
80
80
|
description: CLI and API client for Ubalo
|
81
81
|
email: dev@ubalo.com
|
82
82
|
executables:
|