ubalo 0.0.13 → 0.0.14

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.
Files changed (3) hide show
  1. data/bin/ubalo +24 -9
  2. data/lib/ubalo.rb +2 -2
  3. metadata +11 -11
data/bin/ubalo CHANGED
@@ -43,6 +43,20 @@ def ubalo
43
43
  @ubalo
44
44
  end
45
45
 
46
+ def local_username
47
+ @local_username || raise(UbaloMessage, "Please re-login to obtain local username")
48
+ end
49
+
50
+ def normalize_pod_name(pod_name)
51
+ if pod_name
52
+ if pod_name[/\//]
53
+ pod_name
54
+ else
55
+ "#{local_username}/#{pod_name}"
56
+ end
57
+ end
58
+ end
59
+
46
60
  def local_config
47
61
  unless @local_config
48
62
  raise UbaloMessage, "Please run this command from within a local pod directory"
@@ -106,7 +120,7 @@ def process_download response, destination_path=nil
106
120
  name = response.fetch('name')
107
121
  fullname = response.fetch('fullname')
108
122
  url = response.fetch('url')
109
- files = response.fetch('files')
123
+ files = response.fetch('current_version').fetch('files')
110
124
  destination_path ||= name
111
125
 
112
126
  if File.exists?(destination_path)
@@ -133,7 +147,7 @@ desc 'Download a pod to your computer'
133
147
  arg_name '<pod name>'
134
148
  command :get do |c|
135
149
  c.action do |global_options,options,args|
136
- pod_name = args.shift
150
+ pod_name = normalize_pod_name(args.shift)
137
151
  destination_path = args.shift
138
152
 
139
153
  $stderr.print "Fetching code for #{pod_name}..."
@@ -199,7 +213,7 @@ command :run do |c|
199
213
  c.switch :json
200
214
 
201
215
  c.action do |global_options,options,args|
202
- pod_name = args.shift
216
+ pod_name = normalize_pod_name(args.shift)
203
217
  if options.json
204
218
  args = receive_json_from_stdin
205
219
  response = ubalo.submit_task_json(args)
@@ -232,7 +246,7 @@ command :submit do |c|
232
246
  args = receive_json_from_stdin
233
247
  result = ubalo.submit_task_json(args)
234
248
  else
235
- pod_name = args.shift
249
+ pod_name = normalize_pod_name(args.shift)
236
250
 
237
251
  $stderr.print "Submitting #{pod_name}..."
238
252
  result = ubalo.submit_task(pod_name, args.join(" "))
@@ -371,7 +385,7 @@ desc 'Modify a pod'
371
385
  arg_name '<pod name>'
372
386
  command :edit do |c|
373
387
  c.action do |global_options,options,args|
374
- pod_name = args.shift
388
+ pod_name = normalize_pod_name(args.shift)
375
389
  ubalo.ssh(pod_name)
376
390
  end
377
391
  end
@@ -388,7 +402,7 @@ command :cp do |c|
388
402
 
389
403
  environ = nil
390
404
  scp_args = args.join(" ").gsub(/[\w-]+(?=:)/) do |pod_name|
391
- ssh_path, environ = ubalo.ssh_path(pod_name)
405
+ ssh_path, environ = ubalo.ssh_path(normalize_pod_name(pod_name))
392
406
  "#{ssh_path}"
393
407
  end
394
408
 
@@ -407,7 +421,7 @@ command :login do |c|
407
421
  ubalo.token = response.fetch('api_token')
408
422
  username = response.fetch('username')
409
423
 
410
- Ubalo.write_config(ubalo.base_url => {'token' => ubalo.token})
424
+ Ubalo.write_config(ubalo.base_url => {'token' => ubalo.token, 'username' => username})
411
425
  puts "Success! Ready to use as #{username}."
412
426
  end
413
427
  end
@@ -424,7 +438,7 @@ desc 'Publish a pod'
424
438
  arg_name '<pod name>'
425
439
  command :publish do |c|
426
440
  c.action do |global_options,options,args|
427
- pod_name = args.shift
441
+ pod_name = normalize_pod_name(args.shift)
428
442
 
429
443
  $stderr.print "Publishing #{pod_name}..."
430
444
  response = ubalo.publish(pod_name)
@@ -437,7 +451,7 @@ desc 'Unpublish a pod'
437
451
  arg_name '<pod name>'
438
452
  command :unpublish do |c|
439
453
  c.action do |global_options,options,args|
440
- pod_name = args.shift
454
+ pod_name = normalize_pod_name(args.shift)
441
455
 
442
456
  $stderr.print "Unpublishing #{pod_name}..."
443
457
  response = ubalo.unpublish(pod_name)
@@ -453,6 +467,7 @@ pre do |global,command,options,args|
453
467
  # When logging in, don't use the token:
454
468
  unless command && command.name == :login
455
469
  if host_config = config[connect_url]
470
+ @local_username = host_config['username']
456
471
  token = host_config['token']
457
472
  end
458
473
  end
data/lib/ubalo.rb CHANGED
@@ -57,11 +57,11 @@ class Ubalo
57
57
 
58
58
  def format_pod pod, with_username
59
59
  if with_username
60
- name = "#{pod['user']}/#{pod['name']}"
60
+ name = pod['fullname']
61
61
  else
62
62
  name = pod['name']
63
63
  end
64
- " #{name} - #{pod['environ']}"
64
+ " #{name} - #{pod['language']}"
65
65
  end
66
66
  end
67
67
 
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.13
4
+ version: 0.0.14
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 00:00:00.000000000Z
12
+ date: 2011-12-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
16
- requirement: &2156840040 !ruby/object:Gem::Requirement
16
+ requirement: &70363591242100 !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: *2156840040
24
+ version_requirements: *70363591242100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &2156839200 !ruby/object:Gem::Requirement
27
+ requirement: &70363591241600 !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: *2156839200
35
+ version_requirements: *70363591241600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &2156838140 !ruby/object:Gem::Requirement
38
+ requirement: &70363591241140 !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: *2156838140
46
+ version_requirements: *70363591241140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &2156837500 !ruby/object:Gem::Requirement
49
+ requirement: &70363591240620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.6.3
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2156837500
57
+ version_requirements: *70363591240620
58
58
  description: CLI and API client for Ubalo
59
59
  email: dev@ubalo.com
60
60
  executables:
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 1.8.6
87
+ rubygems_version: 1.8.7
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: CLI and API client for Ubalo