ubalo 0.0.8 → 0.0.9
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 +16 -41
- data/lib/ubalo.rb +8 -4
- metadata +8 -8
data/bin/ubalo
CHANGED
@@ -51,7 +51,6 @@ def local_config
|
|
51
51
|
end
|
52
52
|
|
53
53
|
program_desc 'Command-line access to ubalo.com.'
|
54
|
-
version "0.0.7"
|
55
54
|
|
56
55
|
desc "Change the connect url"
|
57
56
|
flag 'connect-url'
|
@@ -95,22 +94,12 @@ end
|
|
95
94
|
|
96
95
|
desc 'Display tasks'
|
97
96
|
command :tasks do |c|
|
98
|
-
c.desc 'filter by task state (pending, complete, etc)'
|
99
|
-
c.long_desc 'possibilities are waiting,running,pending,complete,failed,all'
|
100
|
-
c.default_value 'all'
|
101
|
-
c.flag 'state'
|
102
|
-
|
103
97
|
c.desc 'maximum number of tasks to display'
|
104
98
|
c.default_value 20
|
105
99
|
c.flag 'max'
|
106
100
|
|
107
101
|
c.action do |global_options,options,args|
|
108
|
-
|
109
|
-
# Default to showing just your pods.
|
110
|
-
options.all = true
|
111
|
-
end
|
112
|
-
|
113
|
-
ubalo.tasks(options.state, options.max).each do |task|
|
102
|
+
ubalo.tasks(options.max).reverse.each do |task|
|
114
103
|
puts Ubalo.format_task(task)
|
115
104
|
end
|
116
105
|
end
|
@@ -148,9 +137,6 @@ arg_name '<pod name>'
|
|
148
137
|
command :get do |c|
|
149
138
|
c.action do |global_options,options,args|
|
150
139
|
pod_name = args.shift
|
151
|
-
unless pod_name
|
152
|
-
raise "please specify a pod"
|
153
|
-
end
|
154
140
|
destination_path = args.shift
|
155
141
|
|
156
142
|
$stderr.print "Fetching code for #{pod_name}..."
|
@@ -214,9 +200,6 @@ arg_name '<pod name>'
|
|
214
200
|
command :run do |c|
|
215
201
|
c.action do |global_options,options,args|
|
216
202
|
pod_name = args.shift
|
217
|
-
unless pod_name
|
218
|
-
raise "please specify a pod"
|
219
|
-
end
|
220
203
|
|
221
204
|
$stderr.print "Running #{pod_name}..."
|
222
205
|
response = ubalo.submit_task(pod_name, args.join(" "))
|
@@ -247,9 +230,6 @@ command :submit do |c|
|
|
247
230
|
result = ubalo.submit_task_json(args)
|
248
231
|
else
|
249
232
|
pod_name = args.shift
|
250
|
-
unless pod_name
|
251
|
-
raise "please specify a pod"
|
252
|
-
end
|
253
233
|
|
254
234
|
$stderr.print "Submitting #{pod_name}..."
|
255
235
|
result = ubalo.submit_task(pod_name, args.join(" "))
|
@@ -271,18 +251,27 @@ command :check do |c|
|
|
271
251
|
result = ubalo.check_task_json(args)
|
272
252
|
else
|
273
253
|
task_label = args.first
|
274
|
-
unless task_label
|
275
|
-
raise "please specify a task"
|
276
|
-
end
|
277
254
|
|
278
255
|
$stderr.print "Checking task #{task_label}..."
|
279
256
|
result = ubalo.check_task(task_label)
|
257
|
+
$stderr.puts " found."
|
280
258
|
end
|
281
259
|
|
282
260
|
ubalo.show_result(result, options.json)
|
283
261
|
end
|
284
262
|
end
|
285
263
|
|
264
|
+
desc 'Stop running a specific task'
|
265
|
+
arg_name '<task label>'
|
266
|
+
command :stop do |c|
|
267
|
+
c.action do |global_options,options,args|
|
268
|
+
task_label = args.first
|
269
|
+
$stderr.print "Stopping task #{task_label}..."
|
270
|
+
result = ubalo.stop_task(task_label)
|
271
|
+
$stderr.puts " task now #{result['state']}."
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
286
275
|
desc 'Add an ssh key (defaults to ~/.ssh/id_rsa.pub)'
|
287
276
|
arg_name '<file containing ssh key>'
|
288
277
|
command :add_key do |c|
|
@@ -301,19 +290,6 @@ command :clear_keys do |c|
|
|
301
290
|
end
|
302
291
|
end
|
303
292
|
|
304
|
-
desc 'Modify a pod'
|
305
|
-
arg_name '<pod name>'
|
306
|
-
command :edit do |c|
|
307
|
-
c.action do |global_options,options,args|
|
308
|
-
pod_name = args.shift
|
309
|
-
unless pod_name
|
310
|
-
raise "please specify a pod"
|
311
|
-
end
|
312
|
-
|
313
|
-
ubalo.ssh(pod_name)
|
314
|
-
end
|
315
|
-
end
|
316
|
-
|
317
293
|
desc 'Push code to Ubalo'
|
318
294
|
command :push do |c|
|
319
295
|
c.action do |global_options,options,args|
|
@@ -393,10 +369,6 @@ arg_name '<pod name>'
|
|
393
369
|
command :edit do |c|
|
394
370
|
c.action do |global_options,options,args|
|
395
371
|
pod_name = args.shift
|
396
|
-
unless pod_name
|
397
|
-
raise "please specify a pod"
|
398
|
-
end
|
399
|
-
|
400
372
|
ubalo.ssh(pod_name)
|
401
373
|
end
|
402
374
|
end
|
@@ -457,6 +429,9 @@ on_error do |exception|
|
|
457
429
|
when RestClient::BadRequest
|
458
430
|
$stderr.puts exception.inspect.sub('400 Bad Request', 'Error')
|
459
431
|
false
|
432
|
+
when RestClient::ResourceNotFound
|
433
|
+
$stderr.puts exception.inspect.sub('404 Resource Not Found', 'Error')
|
434
|
+
false
|
460
435
|
when UbaloExit
|
461
436
|
# Normal exit, preserving the correct exit code.
|
462
437
|
exit exception.message
|
data/lib/ubalo.rb
CHANGED
@@ -48,7 +48,7 @@ end
|
|
48
48
|
class Ubalo
|
49
49
|
class << self
|
50
50
|
def format_task task
|
51
|
-
"#{task['label']}
|
51
|
+
"#{task['label']} #{"(#{task['state']})".lfit(10)} - #{task['pod_name']} (#{task['submitted_at_in_words']} ago)"
|
52
52
|
end
|
53
53
|
|
54
54
|
def format_pod pod, with_username
|
@@ -101,8 +101,8 @@ class Ubalo
|
|
101
101
|
"You are #{response['username']}, with role #{response['role']}. You have #{response['pod_count']} pods."
|
102
102
|
end
|
103
103
|
|
104
|
-
def tasks
|
105
|
-
get(:tasks, :count => count
|
104
|
+
def tasks count
|
105
|
+
get(:tasks, :count => count)
|
106
106
|
end
|
107
107
|
|
108
108
|
def submit_task(pod_name, arg)
|
@@ -125,7 +125,7 @@ class Ubalo
|
|
125
125
|
sleep 0.5
|
126
126
|
end
|
127
127
|
$stderr.puts
|
128
|
-
raise "timed-out waiting for task"
|
128
|
+
raise "timed-out waiting for task #{label}"
|
129
129
|
end
|
130
130
|
|
131
131
|
def upload_key(key)
|
@@ -164,6 +164,10 @@ class Ubalo
|
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
167
|
+
def stop_task(label)
|
168
|
+
post(:stop_task, {:label => label})
|
169
|
+
end
|
170
|
+
|
167
171
|
def show_result(result, json=false)
|
168
172
|
if json
|
169
173
|
puts JSON.dump(result)
|
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.0.
|
4
|
+
version: 0.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: 2011-12-
|
12
|
+
date: 2011-12-06 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
16
|
-
requirement: &
|
16
|
+
requirement: &2169287420 !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: *2169287420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: highline
|
27
|
-
requirement: &
|
27
|
+
requirement: &2169286980 !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: *2169286980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rest-client
|
38
|
-
requirement: &
|
38
|
+
requirement: &2169286480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 1.6.3
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2169286480
|
47
47
|
description: CLI and API client for Ubalo
|
48
48
|
email: dev@ubalo.com
|
49
49
|
executables:
|