vmc 0.4.0.beta.64 → 0.4.0.beta.65

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,10 +7,9 @@ module VMC
7
7
  class App < CLI
8
8
  desc "List your applications"
9
9
  group :apps
10
- input(:space, :desc => "Show apps in given space",
11
- :from_given => by_name("space")) {
12
- client.current_space
13
- }
10
+ input :space, :from_given => by_name("space"),
11
+ :default => proc { client.current_space },
12
+ :desc => "Show apps in given space"
14
13
  input :name, :desc => "Filter by name regexp"
15
14
  input :runtime, :desc => "Filter by runtime regexp"
16
15
  input :framework, :desc => "Filter by framework regexp"
@@ -223,8 +222,9 @@ module VMC
223
222
  [ask("Delete which application?", :choices => apps.sort_by(&:name),
224
223
  :display => proc(&:name))]
225
224
  }
226
- input(:really, :type => :boolean, :forget => true) { |name, color|
227
- force? || ask("Really delete #{c(name, color)}?", :default => false)
225
+ input(:really, :type => :boolean, :forget => true,
226
+ :default => proc { force? || interact }) { |name, color|
227
+ ask("Really delete #{c(name, color)}?", :default => false)
228
228
  }
229
229
  input :routes, :type => :boolean, :default => false,
230
230
  :desc => "Delete associated routes"
@@ -1055,7 +1055,9 @@ module VMC
1055
1055
  puts "#{b(c(i.state.downcase, state_color(i.state)))} "
1056
1056
 
1057
1057
  indented do
1058
- line "started: #{c(i.since.strftime("%F %r"), :cyan)}"
1058
+ if s = i.since
1059
+ line "started: #{c(s.strftime("%F %r"), :cyan)}"
1060
+ end
1059
1061
 
1060
1062
  if d = i.debugger
1061
1063
  line "debugger: port #{b(d[:port])} at #{b(d[:ip])}"
@@ -16,11 +16,11 @@ module VMC
16
16
 
17
17
  desc "Show organization information"
18
18
  group :organizations
19
- input(:organization, :aliases => ["--org", "-o"],
20
- :argument => :optional, :from_given => by_name("organization"),
21
- :desc => "Organization to show") {
22
- client.current_organization
23
- }
19
+ input :organization, :aliases => ["--org", "-o"],
20
+ :argument => :optional,
21
+ :from_given => by_name("organization"),
22
+ :default => proc { client.current_organization },
23
+ :desc => "Organization to show"
24
24
  input :full, :type => :boolean,
25
25
  :desc => "Show full information for spaces, domains, etc."
26
26
  def org
@@ -4,10 +4,10 @@ module VMC
4
4
  class Service < CLI
5
5
  desc "List your service instances"
6
6
  group :services
7
- input(:space, :desc => "Show services in given space",
8
- :from_given => by_name("space")) {
9
- client.current_space
10
- }
7
+ input :space,
8
+ :from_given => by_name("space"),
9
+ :default => proc { client.current_space },
10
+ :desc => "Show services in given space"
11
11
  input :name, :desc => "Filter by name"
12
12
  input :service, :desc => "Filter by service type"
13
13
  input :plan, :desc => "Filter by service plan"
@@ -15,8 +15,8 @@ module VMC
15
15
  input :version, :desc => "Filter by service version"
16
16
  input :app, :desc => "Limit to application's service bindings",
17
17
  :from_given => by_name("app")
18
- input :one_line, :alias => "-l", :type => :boolean, :default => false,
19
- :desc => "Single-line tabular format"
18
+ input :full, :type => :boolean, :default => false,
19
+ :desc => "Verbose output format"
20
20
  def services
21
21
  msg =
22
22
  if space = input[:space]
@@ -40,12 +40,33 @@ module VMC
40
40
  !instance_matches(i, input)
41
41
  end
42
42
 
43
- if input[:one_line]
44
- display_tabular_service_instances(instances)
45
- else
43
+ if input[:full]
46
44
  spaced(instances) do |i|
47
45
  display_service_instance(i)
48
46
  end
47
+ else
48
+ table(
49
+ ["name", "service", "version", v2? && "plan", v2? && "bound apps"],
50
+ instances.collect { |i|
51
+ if v2?
52
+ plan = i.service_plan
53
+ service = plan.service
54
+
55
+ label = service.label
56
+ version = service.version
57
+ apps = name_list(i.service_bindings.collect(&:app))
58
+ else
59
+ label = i.vendor
60
+ version = i.version
61
+ end
62
+
63
+ [ c(i.name, :name),
64
+ label,
65
+ version,
66
+ v2? && plan.name,
67
+ apps
68
+ ]
69
+ })
49
70
  end
50
71
  end
51
72
 
@@ -227,8 +248,9 @@ module VMC
227
248
  ask "Which service instance?", :choices => instances,
228
249
  :display => proc(&:name)
229
250
  }
230
- input(:really, :type => :boolean, :forget => true) { |name, color|
231
- force? || ask("Really delete #{c(name, color)}?", :default => false)
251
+ input(:really, :type => :boolean, :forget => true,
252
+ :default => proc { force? || interact }) { |name, color|
253
+ ask("Really delete #{c(name, color)}?", :default => false)
232
254
  }
233
255
  input :all, :type => :boolean, :default => false,
234
256
  :desc => "Delete all services"
@@ -330,31 +352,6 @@ module VMC
330
352
  end
331
353
  end
332
354
 
333
- def display_tabular_service_instances(instances)
334
- table(
335
- ["name", "service", "version", v2? && "plan", v2? && "bound apps"],
336
- instances.collect { |i|
337
- if v2?
338
- plan = i.service_plan
339
- service = plan.service
340
-
341
- label = service.label
342
- version = service.version
343
- apps = name_list(i.service_bindings.collect(&:app))
344
- else
345
- label = i.vendor
346
- version = i.version
347
- end
348
-
349
- [ c(i.name, :name),
350
- label,
351
- version,
352
- v2? && plan.name,
353
- apps
354
- ]
355
- })
356
- end
357
-
358
355
  def human_list(xs)
359
356
  if xs.size == 1
360
357
  xs.first
@@ -23,15 +23,14 @@ module VMC
23
23
 
24
24
  desc "Show space information"
25
25
  group :spaces
26
- input(:organization, :aliases => ["--org", "-o"],
27
- :from_given => by_name("organization"),
28
- :desc => "Space's organization") {
29
- client.current_organization
30
- }
31
- input(:space, :argument => :optional, :from_given => space_by_name,
32
- :desc => "Space to show") {
33
- client.current_space
34
- }
26
+ input :organization, :aliases => ["--org", "-o"],
27
+ :from_given => by_name("organization"),
28
+ :default => proc { client.current_organization },
29
+ :desc => "Space's organization"
30
+ input :space, :argument => :optional,
31
+ :from_given => space_by_name,
32
+ :default => proc { client.current_space },
33
+ :desc => "Space to show"
35
34
  input :full, :type => :boolean,
36
35
  :desc => "Show full information for apps, service instances, etc."
37
36
  def space
@@ -78,11 +77,10 @@ module VMC
78
77
 
79
78
  desc "List spaces in an organization"
80
79
  group :spaces
81
- input(:organization, :aliases => ["--org", "-o"],
82
- :argument => :optional, :from_given => by_name("organization"),
83
- :desc => "Organization to list spaces from") {
84
- client.current_organization
85
- }
80
+ input :organization, :argument => :optional, :aliases => ["--org", "-o"],
81
+ :from_given => by_name("organization"),
82
+ :default => proc { client.current_organization },
83
+ :desc => "Organization to list spaces from"
86
84
  input :one_line, :alias => "-l", :type => :boolean, :default => false,
87
85
  :desc => "Single-line tabular format"
88
86
  input :full, :type => :boolean, :default => false,
@@ -118,11 +116,10 @@ module VMC
118
116
  input(:name, :argument => :optional, :desc => "Space name") {
119
117
  ask("Name")
120
118
  }
121
- input(:organization, :aliases => ["--org", "-o"],
122
- :argument => :optional, :from_given => by_name("organization"),
123
- :desc => "Parent organization") {
124
- client.current_organization
125
- }
119
+ input :organization, :argument => :optional, :aliases => ["--org", "-o"],
120
+ :from_given => by_name("organization"),
121
+ :default => proc { client.current_organization },
122
+ :desc => "Parent organization"
126
123
  input :target, :alias => "-t", :type => :boolean
127
124
  input :manager, :type => :boolean, :default => true,
128
125
  :desc => "Add current user as manager"
@@ -186,13 +183,13 @@ module VMC
186
183
  ask "Which space in #{c(org.name, :name)}?", :choices => spaces,
187
184
  :display => proc(&:name)
188
185
  }
189
- input(:organization, :aliases => ["--org", "-o"],
190
- :from_given => by_name("organization"),
191
- :desc => "Space's organization") {
192
- client.current_organization
193
- }
194
- input(:really, :type => :boolean, :forget => true) { |space|
195
- force? || ask("Really delete #{c(space.name, :name)}?", :default => false)
186
+ input :organization, :aliases => ["--org", "-o"],
187
+ :from_given => by_name("organization"),
188
+ :default => proc { client.current_organization },
189
+ :desc => "Space's organization"
190
+ input(:really, :type => :boolean, :forget => true,
191
+ :default => proc { force? || interact }) { |space|
192
+ ask("Really delete #{c(space.name, :name)}?", :default => false)
196
193
  }
197
194
  input(:recursive, :alias => "-r", :type => :boolean, :forget => true) {
198
195
  ask "Delete #{c("EVERYTHING", :bad)}?", :default => false
@@ -30,8 +30,8 @@ module VMC
30
30
  :desc => "List supported frameworks"
31
31
  input :services, :type => :boolean,
32
32
  :desc => "List supported services"
33
- input(:all, :type => :boolean, :alias => "-a",
34
- :desc => "Show all information")
33
+ input :all, :type => :boolean, :alias => "-a",
34
+ :desc => "Show all information"
35
35
  def info
36
36
  all = input[:all]
37
37
 
@@ -133,8 +133,8 @@ module VMC
133
133
  group :start
134
134
  input :url, :argument => :optional,
135
135
  :desc => "Target URL to switch to"
136
- input(:interactive, :alias => "-i", :type => :boolean,
137
- :desc => "Interactively select organization/space")
136
+ input :interactive, :alias => "-i", :type => :boolean,
137
+ :desc => "Interactively select organization/space"
138
138
  input(:organization, :aliases => ["--org", "-o"],
139
139
  :from_given => find_by_name("organization"),
140
140
  :desc => "Organization") { |orgs|
@@ -197,8 +197,8 @@ module VMC
197
197
  input :username, :alias => "--email", :argument => :optional,
198
198
  :desc => "Account email"
199
199
  input :password, :desc => "Account password"
200
- input(:interactive, :alias => "-i", :type => :boolean,
201
- :desc => "Interactively select organization/space")
200
+ input :interactive, :alias => "-i", :type => :boolean,
201
+ :desc => "Interactively select organization/space"
202
202
  input(:organization, :aliases => ["--org", "-o"],
203
203
  :from_given => find_by_name("organization"),
204
204
  :desc => "Organization") { |orgs|
@@ -46,8 +46,9 @@ module VMC
46
46
  desc "Delete a user"
47
47
  group :admin, :user, :hidden => true
48
48
  input :email, :argument => true, :desc => "User to delete"
49
- input(:really, :type => :boolean, :forget => true) { |email|
50
- force? || ask("Really delete user #{c(email, :name)}?", :default => false)
49
+ input(:really, :type => :boolean, :forget => true,
50
+ :default => proc { force? || interact }) { |email|
51
+ ask("Really delete user #{c(email, :name)}?", :default => false)
51
52
  }
52
53
  def delete_user
53
54
  email = input[:email]
@@ -61,17 +62,16 @@ module VMC
61
62
 
62
63
  desc "Update a user's password"
63
64
  group :admin, :user, :hidden => true
64
- input(:user, :argument => :optional,
65
- :from_given => proc { |email|
66
- if v2? && client.current_user.email != email
67
- fail "You can only change your own password on V2."
68
- else
69
- client.user(email)
70
- end
71
- },
72
- :desc => "User to update") {
73
- client.current_user
74
- }
65
+ input :user, :argument => :optional,
66
+ :from_given => proc { |email|
67
+ if v2? && client.current_user.email != email
68
+ fail "You can only change your own password on V2."
69
+ else
70
+ client.user(email)
71
+ end
72
+ },
73
+ :desc => "User to update",
74
+ :default => proc { client.current_user }
75
75
  input(:password, :desc => "New password") {
76
76
  ask("Current Password", :echo => "*", :forget => true)
77
77
  }
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.4.0.beta.64"
2
+ VERSION = "0.4.0.beta.65"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmc
3
3
  version: !ruby/object:Gem::Version
4
- hash: -3047156276
4
+ hash: 1083977469
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
9
  - 0
10
10
  - beta
11
- - 64
12
- version: 0.4.0.beta.64
11
+ - 65
12
+ version: 0.4.0.beta.65
13
13
  platform: ruby
14
14
  authors:
15
15
  - VMware
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-10-09 00:00:00 Z
20
+ date: 2012-10-11 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: json_pure
@@ -265,12 +265,12 @@ dependencies:
265
265
  requirements:
266
266
  - - ~>
267
267
  - !ruby/object:Gem::Version
268
- hash: 67
268
+ hash: 65
269
269
  segments:
270
270
  - 0
271
271
  - 3
272
- - 40
273
- version: 0.3.40
272
+ - 41
273
+ version: 0.3.41
274
274
  type: :runtime
275
275
  version_requirements: *id015
276
276
  - !ruby/object:Gem::Dependency
@@ -297,12 +297,12 @@ dependencies:
297
297
  requirements:
298
298
  - - ~>
299
299
  - !ruby/object:Gem::Version
300
- hash: 23
300
+ hash: 21
301
301
  segments:
302
302
  - 0
303
303
  - 2
304
- - 0
305
- version: 0.2.0
304
+ - 1
305
+ version: 0.2.1
306
306
  type: :runtime
307
307
  version_requirements: *id017
308
308
  - !ruby/object:Gem::Dependency
@@ -313,12 +313,12 @@ dependencies:
313
313
  requirements:
314
314
  - - ~>
315
315
  - !ruby/object:Gem::Version
316
- hash: 31
316
+ hash: 29
317
317
  segments:
318
318
  - 0
319
319
  - 4
320
- - 8
321
- version: 0.4.8
320
+ - 9
321
+ version: 0.4.9
322
322
  type: :runtime
323
323
  version_requirements: *id018
324
324
  - !ruby/object:Gem::Dependency