ubalo 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ubalo +24 -3
- data/lib/ubalo/account.rb +5 -7
- data/lib/ubalo/pod.rb +9 -6
- data/lib/ubalo/pod_archive.rb +7 -1
- data/lib/ubalo/task.rb +5 -0
- data/lib/ubalo/util.rb +3 -1
- data/lib/ubalo/version.rb +1 -1
- metadata +15 -15
data/bin/ubalo
CHANGED
@@ -41,7 +41,7 @@ end
|
|
41
41
|
|
42
42
|
def pod
|
43
43
|
unless @pod
|
44
|
-
@pod = account.
|
44
|
+
@pod = account.pod_by_name(pod_dir.name)
|
45
45
|
end
|
46
46
|
@pod
|
47
47
|
end
|
@@ -154,7 +154,7 @@ command :init do |c|
|
|
154
154
|
|
155
155
|
c.action do |global_options,options,args|
|
156
156
|
name = options[:name] || hl.ask(" pod name: "){|q| q.echo = true}
|
157
|
-
pod = account.
|
157
|
+
pod = account.pod_by_name(name)
|
158
158
|
pod_dir.init(pod.fullname, logger)
|
159
159
|
logger.puts "Success! Next, run ubalo push."
|
160
160
|
end
|
@@ -176,6 +176,7 @@ end
|
|
176
176
|
desc 'Show information about a pod'
|
177
177
|
command :pod do |c|
|
178
178
|
c.action do |global_options,options,args|
|
179
|
+
pod.refresh!
|
179
180
|
puts pod.printable_result
|
180
181
|
end
|
181
182
|
end
|
@@ -204,6 +205,26 @@ command :task do |c|
|
|
204
205
|
end
|
205
206
|
end
|
206
207
|
|
208
|
+
desc 'Stop a task'
|
209
|
+
arg_name '<task label>'
|
210
|
+
command 'task:stop' do |c|
|
211
|
+
c.action do |global_options,options,args|
|
212
|
+
if label = args.shift
|
213
|
+
task = account.task_by_label!(label)
|
214
|
+
else
|
215
|
+
task = pod.latest_task
|
216
|
+
end
|
217
|
+
|
218
|
+
task.stop!
|
219
|
+
|
220
|
+
logger.poll_on("Stopping task #{task.label.inspect}...") do
|
221
|
+
task.refresh!
|
222
|
+
task.complete?
|
223
|
+
end
|
224
|
+
puts task.printable_result
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
207
228
|
desc 'Push files to Ubalo'
|
208
229
|
command :push do |c|
|
209
230
|
c.action do |global_options,options,args|
|
@@ -231,7 +252,7 @@ pre do |global,command,options,args|
|
|
231
252
|
end
|
232
253
|
|
233
254
|
if pod_name = global['pod']
|
234
|
-
@pod = account.
|
255
|
+
@pod = account.pod_by_name(pod_name)
|
235
256
|
end
|
236
257
|
|
237
258
|
@pod_dir = Ubalo::PodDir.new(global['pod-dir'] || ".")
|
data/lib/ubalo/account.rb
CHANGED
@@ -50,16 +50,14 @@ module Ubalo
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def pod_by_name
|
53
|
+
def pod_by_name(name)
|
54
54
|
pod_username, pod_name = Util.normalize_pod_name(username, name)
|
55
|
-
|
56
|
-
pod.refresh!
|
55
|
+
Pod.new(self, pod_username, pod_name, {})
|
57
56
|
end
|
58
57
|
|
59
|
-
def
|
60
|
-
|
61
|
-
pod
|
62
|
-
pod.update!
|
58
|
+
def pod_by_name!(name)
|
59
|
+
pod = pod_by_name(name)
|
60
|
+
pod.refresh!
|
63
61
|
end
|
64
62
|
|
65
63
|
def task_by_label!(label)
|
data/lib/ubalo/pod.rb
CHANGED
@@ -6,7 +6,7 @@ module Ubalo
|
|
6
6
|
new(account, json.fetch('user').fetch('username'), json.fetch('name'), json)
|
7
7
|
end
|
8
8
|
|
9
|
-
attr_reader :username, :name, :state, :archive, :updated_at, :
|
9
|
+
attr_reader :username, :name, :state, :archive, :updated_at, :compilation_process
|
10
10
|
|
11
11
|
def initialize(account, username, name, attributes)
|
12
12
|
@account = account
|
@@ -43,6 +43,8 @@ module Ubalo
|
|
43
43
|
:arg => UbaloJSON.dump(arg)
|
44
44
|
}
|
45
45
|
@account.task_from_json(request(:post, "/tasks", :params => params))
|
46
|
+
rescue RestClient::Conflict
|
47
|
+
raise Ubalo::Error, "Cannot run pod while compiling"
|
46
48
|
end
|
47
49
|
|
48
50
|
def latest_task
|
@@ -54,6 +56,7 @@ module Ubalo
|
|
54
56
|
end
|
55
57
|
|
56
58
|
def push_from(pod_dir)
|
59
|
+
update!
|
57
60
|
new_archive.activate_from(pod_dir)
|
58
61
|
refresh!
|
59
62
|
end
|
@@ -82,15 +85,15 @@ module Ubalo
|
|
82
85
|
s << " name: #{fullname}\n"
|
83
86
|
s << " state: #{state}\n"
|
84
87
|
|
85
|
-
if
|
86
|
-
s << "status: #{
|
88
|
+
if compilation_process
|
89
|
+
s << "status: #{compilation_process.fetch('exit_result')}\n"
|
87
90
|
|
88
|
-
if stdout =
|
91
|
+
if stdout = compilation_process.fetch('stdout') and stdout.length > 0
|
89
92
|
s << "stdout:\n"
|
90
93
|
s << Util.indent(stdout)
|
91
94
|
end
|
92
95
|
|
93
|
-
if stderr =
|
96
|
+
if stderr = compilation_process.fetch('stderr') and stderr.length > 0
|
94
97
|
s << "stderr:\n"
|
95
98
|
s << Util.indent(stderr)
|
96
99
|
end
|
@@ -109,7 +112,7 @@ module Ubalo
|
|
109
112
|
private
|
110
113
|
def update_attributes(attributes)
|
111
114
|
@state = attributes['state']
|
112
|
-
@
|
115
|
+
@compilation_process = attributes['compilation_process']
|
113
116
|
if archive_attr = attributes['archive']
|
114
117
|
@archive = @account.archive_from_json(archive_attr)
|
115
118
|
end
|
data/lib/ubalo/pod_archive.rb
CHANGED
@@ -16,10 +16,16 @@ module Ubalo
|
|
16
16
|
with_temp_archive do |archive_name|
|
17
17
|
pod_dir.make_archive(archive_name)
|
18
18
|
Util.put_targz(put_url, archive_name)
|
19
|
-
|
19
|
+
activate
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def activate
|
24
|
+
request(:put, "/activate")
|
25
|
+
rescue RestClient::Conflict
|
26
|
+
raise Ubalo::Error, "Pod is already compiling"
|
27
|
+
end
|
28
|
+
|
23
29
|
def extract_to(pod_dir)
|
24
30
|
with_temp_archive do |archive_name|
|
25
31
|
Util.get_targz(get_url, archive_name)
|
data/lib/ubalo/task.rb
CHANGED
data/lib/ubalo/util.rb
CHANGED
@@ -110,7 +110,9 @@ module Ubalo
|
|
110
110
|
raise "don't understand request method #{method.inspect}"
|
111
111
|
end
|
112
112
|
|
113
|
-
if
|
113
|
+
if response.code == 204
|
114
|
+
nil
|
115
|
+
elsif options.delete(:parse) == false
|
114
116
|
response
|
115
117
|
else
|
116
118
|
JSON.load(response)
|
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.9'
|
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-04-
|
12
|
+
date: 2012-04-13 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
16
|
-
requirement: &
|
16
|
+
requirement: &70214700595780 !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: *70214700595780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: highline
|
27
|
-
requirement: &
|
27
|
+
requirement: &70214700594160 !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: *70214700594160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70214700592680 !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: *70214700592680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rest-client
|
49
|
-
requirement: &
|
49
|
+
requirement: &70214700591800 !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: *70214700591800
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: archive-tar-minitar
|
60
|
-
requirement: &
|
60
|
+
requirement: &70214700591020 !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: *70214700591020
|
69
69
|
description: CLI and API client for Ubalo
|
70
70
|
email: dev@ubalo.com
|
71
71
|
executables:
|
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
segments:
|
100
100
|
- 0
|
101
|
-
hash: -
|
101
|
+
hash: -2863097484302400668
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
none: false
|
104
104
|
requirements:
|
@@ -107,10 +107,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
segments:
|
109
109
|
- 0
|
110
|
-
hash: -
|
110
|
+
hash: -2863097484302400668
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.8.
|
113
|
+
rubygems_version: 1.8.10
|
114
114
|
signing_key:
|
115
115
|
specification_version: 3
|
116
116
|
summary: CLI and API client for Ubalo
|