ubalo 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/ubalo CHANGED
@@ -13,7 +13,7 @@ hl = HighLine.new
13
13
 
14
14
  module Ubalo
15
15
  def self.config_filename
16
- File.expand_path("~/.ubaloconfig")
16
+ File.expand_path("~/.ubalorc")
17
17
  end
18
18
  end
19
19
 
@@ -45,9 +45,6 @@ end
45
45
 
46
46
  program_desc 'Command-line access to ubalo.com.'
47
47
 
48
- desc "Change the connect url"
49
- flag 'connect-url'
50
-
51
48
  desc "Override the active pod"
52
49
  flag 'pod'
53
50
 
@@ -84,7 +81,10 @@ command :login do |c|
84
81
  password = options[:password] || hl.ask(" password: "){|q| q.echo = false}
85
82
 
86
83
  @account.authorize(login, password)
87
- Ubalo::Util.append_config(Ubalo.config_filename, account.base_url, account.as_hash)
84
+ Ubalo::Util.append_config(
85
+ Ubalo.config_filename, account.base_url,
86
+ {'authorization' => account.authorization, 'username' => account.username}
87
+ )
88
88
  logger.puts "Success! Ready to use as #{account.username}."
89
89
  end
90
90
  end
@@ -163,7 +163,7 @@ desc 'Run a pod'
163
163
  command :run do |c|
164
164
  c.action do |global_options,options,args|
165
165
  logger.puts "Running #{pod.fullname}."
166
- task = pod.run(nil)
166
+ task = pod.run(args.shift)
167
167
  logger.poll_on("Waiting for task #{task.label.inspect}") do
168
168
  task.refresh!
169
169
  task.complete?
@@ -176,7 +176,7 @@ desc 'Run a pod in the background'
176
176
  command :submit do |c|
177
177
  c.action do |global_options,options,args|
178
178
  logger.print "Submitting #{pod.fullname}..."
179
- task = pod.run(nil)
179
+ task = pod.run(args.shift)
180
180
  logger.puts " done."
181
181
  puts task.printable_result
182
182
  end
@@ -214,8 +214,10 @@ pre do |global,command,options,args|
214
214
  @connect_url = ENV['UBALO_CONNECT_URL'] || "https://ubalo.com"
215
215
 
216
216
  config = Ubalo::Util.read_config(Ubalo.config_filename)
217
- if account_config = config[connect_url]
218
- @account = Ubalo::Account.from_hash(account_config)
217
+ if account_config = config[@connect_url]
218
+ @account = Ubalo::Account.new(@connect_url)
219
+ @account.username = account_config.fetch('username')
220
+ @account.authorization = account_config.fetch('authorization')
219
221
  else
220
222
  @account = Ubalo::Account.new(connect_url)
221
223
  end
data/lib/ubalo/account.rb CHANGED
@@ -1,12 +1,5 @@
1
1
  module Ubalo
2
2
  class Account
3
- def self.from_hash(h)
4
- account = new h.fetch(:base_url)
5
- account.username = h.fetch(:username)
6
- account.authorization = h.fetch(:authorization)
7
- account
8
- end
9
-
10
3
  attr_accessor :username, :authorization
11
4
  attr_reader :base_url
12
5
 
@@ -74,14 +67,6 @@ module Ubalo
74
67
  end
75
68
  end
76
69
 
77
- def as_hash
78
- {
79
- :base_url => @base_url,
80
- :username => username,
81
- :authorization => authorization
82
- }
83
- end
84
-
85
70
  def inspect
86
71
  "#<Account #{username} #{base_url} #{'authorized' if authorization}>"
87
72
  end
data/lib/ubalo/task.rb CHANGED
@@ -60,7 +60,7 @@ module Ubalo
60
60
 
61
61
  if output
62
62
  s << "output:\n"
63
- s << printable_task_content('output', output)
63
+ s << Util.indent(output.pretty_inspect)
64
64
  end
65
65
  s
66
66
  end
data/lib/ubalo/util.rb CHANGED
@@ -50,7 +50,7 @@ module Ubalo
50
50
  end
51
51
 
52
52
  self.puts
53
- raise UbaloError, "timed-out polling on #{message}"
53
+ raise Ubalo::Error, "timed-out polling on #{message}"
54
54
  end
55
55
  end
56
56
 
@@ -67,7 +67,7 @@ module Ubalo
67
67
  response = RestClient.put(url, File.open(archive_name, 'rb'), :content_type => 'application/x-tar', :content_encoding => 'x-gzip')
68
68
 
69
69
  unless response.code == 200
70
- raise UbaloError, "could not upload pod files"
70
+ raise Ubalo::Error, "could not upload pod files"
71
71
  end
72
72
  end
73
73
 
@@ -78,7 +78,7 @@ module Ubalo
78
78
  f.write response
79
79
  end
80
80
  else
81
- raise UbaloError, "failed to download pod files"
81
+ raise Ubalo::Error, "failed to download pod files"
82
82
  end
83
83
  end
84
84
  end
@@ -155,7 +155,7 @@ module Ubalo
155
155
  if content_type == UbaloJSON.content_type
156
156
  s = UbaloJSON.load(data)
157
157
  else
158
- raise UbaloError, "cannot understand content of this type"
158
+ raise Ubalo::Error, "cannot understand content of this type"
159
159
  end
160
160
  end
161
161
 
data/lib/ubalo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ubalo
2
2
  unless const_defined?('VERSION')
3
- VERSION = "0.4"
3
+ VERSION = "0.5"
4
4
  end
5
5
  end
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'
4
+ version: '0.5'
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-03 00:00:00.000000000 Z
12
+ date: 2012-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
16
- requirement: &70122817467440 !ruby/object:Gem::Requirement
16
+ requirement: &70233084564080 !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: *70122817467440
24
+ version_requirements: *70233084564080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &70122817466520 !ruby/object:Gem::Requirement
27
+ requirement: &70233084571080 !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: *70122817466520
35
+ version_requirements: *70233084571080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70122817465120 !ruby/object:Gem::Requirement
38
+ requirement: &70233075286720 !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: *70122817465120
46
+ version_requirements: *70233075286720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &70122817464380 !ruby/object:Gem::Requirement
49
+ requirement: &70233075285840 !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: *70122817464380
57
+ version_requirements: *70233075285840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: archive-tar-minitar
60
- requirement: &70122817463540 !ruby/object:Gem::Requirement
60
+ requirement: &70233075285220 !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: *70122817463540
68
+ version_requirements: *70233075285220
69
69
  description: CLI and API client for Ubalo
70
70
  email: dev@ubalo.com
71
71
  executables:
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  segments:
98
98
  - 0
99
- hash: -2500511595485587265
99
+ hash: -1754747755012050403
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  segments:
107
107
  - 0
108
- hash: -2500511595485587265
108
+ hash: -1754747755012050403
109
109
  requirements: []
110
110
  rubyforge_project:
111
111
  rubygems_version: 1.8.11