vmc 0.4.0.beta.84 → 0.4.0.beta.85

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,17 +17,19 @@ module VMC
17
17
  input :full, :type => :boolean, :default => false,
18
18
  :desc => "Verbose output format"
19
19
  def apps
20
- msg =
21
- if space = input[:space]
22
- "Getting applications in #{c(space.name, :name)}"
23
- else
24
- "Getting applications"
25
- end
20
+ if space = input[:space]
21
+ space.summarize!
26
22
 
27
- apps =
28
- with_progress(msg) do
29
- (space || client).apps(2)
30
- end
23
+ apps =
24
+ with_progress("Getting applications in #{c(space.name, :name)}") do
25
+ space.apps
26
+ end
27
+ else
28
+ apps =
29
+ with_progress("Getting applications") do
30
+ client.apps(2)
31
+ end
32
+ end
31
33
 
32
34
  if apps.empty? and !quiet?
33
35
  line
@@ -1090,7 +1092,7 @@ module VMC
1090
1092
  end
1091
1093
 
1092
1094
  def app_status(a)
1093
- health = v2? ? a.state : a.health
1095
+ health = a.health
1094
1096
 
1095
1097
  if a.debug_mode == "suspend" && health == "0%"
1096
1098
  c("suspended", :neutral)
@@ -10,15 +10,24 @@ module VMC
10
10
 
11
11
  desc "List domains in a space"
12
12
  group :domains
13
- input :organization, :argument => :optional, :aliases => ["--org", "-o"],
14
- :from_given => by_name("organization"),
15
- :desc => "Organization to delete the domain from"
13
+ input :space, :argument => :optional,
14
+ :default => proc { client.current_space },
15
+ :from_given => by_name("space"),
16
+ :desc => "Space to list the domains from"
17
+ input :all, :type => :boolean, :default => false,
18
+ :desc => "List all domains"
16
19
  def domains
17
- target = input[:organization] || client
20
+ space = input[:space]
18
21
 
19
22
  domains =
20
- with_progress("Getting domains") do
21
- target.domains
23
+ if input[:all]
24
+ with_progress("Getting all domains") do
25
+ client.domains
26
+ end
27
+ else
28
+ with_progress("Getting domains in #{c(space.name, :name)}") do
29
+ space.domains
30
+ end
22
31
  end
23
32
 
24
33
  line unless quiet?
@@ -11,6 +11,7 @@ module VMC
11
11
  desc "List routes in a space"
12
12
  group :routes
13
13
  def routes
14
+ # TODO: scope to space once space.routes is possible
14
15
  routes =
15
16
  with_progress("Getting routes") do
16
17
  client.routes
@@ -83,14 +83,25 @@ module VMC
83
83
  if runtimes.empty? && !quiet?
84
84
  line "#{d("none")}"
85
85
  elsif input[:quiet]
86
- runtimes.each do |r|
86
+ sorted_runtimes(runtimes).each do |r|
87
87
  line r.name
88
88
  end
89
89
  else
90
+ status_colors = {
91
+ "current" => :good,
92
+ "next" => :name,
93
+ "deprecated" => :bad
94
+ }
95
+
90
96
  table(
91
- %w{runtime description},
92
- runtimes.sort_by(&:name).collect { |r|
93
- [c(r.name, :name), r.description]
97
+ %w{runtime version info},
98
+ sorted_runtimes(runtimes).collect { |r|
99
+ if r.status
100
+ info = r.deprecated? ? "End of Life: #{r.status[:eol_date]}" : nil
101
+ [c(r.name, status_colors[r.status[:name]]), r.version, info]
102
+ else
103
+ [c(r.name, :name), r.version, nil]
104
+ end
94
105
  })
95
106
  end
96
107
  end
@@ -426,5 +437,39 @@ module VMC
426
437
  end
427
438
  end
428
439
  end
440
+
441
+ def sorted_runtimes(runtimes)
442
+ return runtimes if runtimes.empty?
443
+
444
+ # Sort by name if V2 or other server that doesn't yet have category, status, series
445
+ if v2? || !(runtimes[0].category && runtimes[0].status &&
446
+ runtimes[0].series)
447
+ return runtimes.sort_by(&:name)
448
+ end
449
+
450
+ # Sort by category (i.e java, ruby, node, etc)
451
+ by_category = runtimes.group_by(&:category)
452
+
453
+ # Sort by status (current, next, deprecated)
454
+ sorted = []
455
+ by_category.sort.each do |category, runtimes|
456
+ by_status = {}
457
+ runtimes.each do |runtime|
458
+ by_status[runtime.status[:name]] ||= []
459
+ by_status[runtime.status[:name]] << runtime
460
+ end
461
+
462
+ %w(current next deprecated).each do |status|
463
+ next unless by_status[status]
464
+
465
+ # Sort by series descending (ruby19, ruby18, etc)
466
+ by_status[status].sort_by(&:series).reverse_each do |r|
467
+ sorted << r
468
+ end
469
+ end
470
+ end
471
+
472
+ sorted
473
+ end
429
474
  end
430
475
  end
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.4.0.beta.84"
2
+ VERSION = "0.4.0.beta.85"
3
3
  end
@@ -0,0 +1,23 @@
1
+ require File.expand_path("../../helpers", __FILE__)
2
+
3
+ describe "Start#info" do
4
+ it "orders runtimes by category, status, and series" do
5
+ running(:info, :runtimes => true) do
6
+ does("Getting runtimes")
7
+ known_runtimes = %w(java7 java node08 node06 node ruby19 ruby18)
8
+
9
+ expected_order = known_runtimes.dup
10
+
11
+ client.runtimes.size.times do
12
+ with_output do |str|
13
+ if known_runtimes.include? str
14
+ expected_order.first.should == str
15
+ expected_order.shift
16
+ end
17
+ end
18
+ end
19
+
20
+ expected_order.size.should == 0
21
+ end
22
+ end
23
+ 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: 2921369787
4
+ hash: 2616878885
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
9
  - 0
10
10
  - beta
11
- - 84
12
- version: 0.4.0.beta.84
11
+ - 85
12
+ version: 0.4.0.beta.85
13
13
  platform: ruby
14
14
  authors:
15
15
  - VMware
@@ -17,7 +17,8 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-11-08 00:00:00 Z
20
+ date: 2012-11-10 00:00:00 -08:00
21
+ default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
24
  name: json_pure
@@ -265,12 +266,12 @@ dependencies:
265
266
  requirements:
266
267
  - - ~>
267
268
  - !ruby/object:Gem::Version
268
- hash: 127
269
+ hash: 125
269
270
  segments:
270
271
  - 0
271
272
  - 3
272
- - 54
273
- version: 0.3.54
273
+ - 55
274
+ version: 0.3.55
274
275
  type: :runtime
275
276
  version_requirements: *id015
276
277
  - !ruby/object:Gem::Dependency
@@ -416,77 +417,79 @@ files:
416
417
  - vmc/Rakefile
417
418
  - vmc/config/clients.yml
418
419
  - vmc/config/micro/offline.conf
419
- - vmc/config/micro/paths.yml
420
420
  - vmc/config/micro/refresh_ip.rb
421
- - vmc/lib/cli/commands/admin.rb
422
- - vmc/lib/cli/commands/apps.rb
423
- - vmc/lib/cli/commands/base.rb
424
- - vmc/lib/cli/commands/manifest.rb
425
- - vmc/lib/cli/commands/micro.rb
426
- - vmc/lib/cli/commands/misc.rb
427
- - vmc/lib/cli/commands/services.rb
428
- - vmc/lib/cli/commands/user.rb
429
- - vmc/lib/cli/config.rb
430
- - vmc/lib/cli/console_helper.rb
431
- - vmc/lib/cli/core_ext.rb
432
- - vmc/lib/cli/errors.rb
433
- - vmc/lib/cli/frameworks.rb
434
- - vmc/lib/cli/manifest_helper.rb
435
- - vmc/lib/cli/runner.rb
436
- - vmc/lib/cli/services_helper.rb
437
- - vmc/lib/cli/tunnel_helper.rb
438
- - vmc/lib/cli/usage.rb
439
- - vmc/lib/cli/version.rb
440
- - vmc/lib/cli/zip_util.rb
441
- - vmc/lib/cli.rb
421
+ - vmc/config/micro/paths.yml
442
422
  - vmc/lib/vmc/client.rb
423
+ - vmc/lib/vmc/micro.rb
443
424
  - vmc/lib/vmc/const.rb
425
+ - vmc/lib/vmc/micro/switcher/dummy.rb
426
+ - vmc/lib/vmc/micro/switcher/windows.rb
444
427
  - vmc/lib/vmc/micro/switcher/base.rb
445
428
  - vmc/lib/vmc/micro/switcher/darwin.rb
446
- - vmc/lib/vmc/micro/switcher/dummy.rb
447
429
  - vmc/lib/vmc/micro/switcher/linux.rb
448
- - vmc/lib/vmc/micro/switcher/windows.rb
449
430
  - vmc/lib/vmc/micro/vmrun.rb
450
- - vmc/lib/vmc/micro.rb
451
431
  - vmc/lib/vmc.rb
432
+ - vmc/lib/cli.rb
433
+ - vmc/lib/cli/frameworks.rb
434
+ - vmc/lib/cli/version.rb
435
+ - vmc/lib/cli/manifest_helper.rb
436
+ - vmc/lib/cli/errors.rb
437
+ - vmc/lib/cli/config.rb
438
+ - vmc/lib/cli/console_helper.rb
439
+ - vmc/lib/cli/core_ext.rb
440
+ - vmc/lib/cli/tunnel_helper.rb
441
+ - vmc/lib/cli/commands/micro.rb
442
+ - vmc/lib/cli/commands/user.rb
443
+ - vmc/lib/cli/commands/admin.rb
444
+ - vmc/lib/cli/commands/misc.rb
445
+ - vmc/lib/cli/commands/manifest.rb
446
+ - vmc/lib/cli/commands/services.rb
447
+ - vmc/lib/cli/commands/base.rb
448
+ - vmc/lib/cli/commands/apps.rb
449
+ - vmc/lib/cli/usage.rb
450
+ - vmc/lib/cli/zip_util.rb
451
+ - vmc/lib/cli/runner.rb
452
+ - vmc/lib/cli/services_helper.rb
453
+ - vmc/caldecott_helper/server.rb
452
454
  - vmc/caldecott_helper/Gemfile
453
455
  - vmc/caldecott_helper/Gemfile.lock
454
- - vmc/caldecott_helper/server.rb
455
456
  - vmc/bin/vmc
456
457
  - vmc-ng/LICENSE
457
458
  - vmc-ng/Rakefile
459
+ - vmc-ng/lib/vmc/spec_helpers.rb
460
+ - vmc-ng/lib/vmc/version.rb
461
+ - vmc-ng/lib/vmc/spec_helpers/eventlog.rb
462
+ - vmc-ng/lib/vmc/spec_helpers/patches.rb
463
+ - vmc-ng/lib/vmc/detect.rb
464
+ - vmc-ng/lib/vmc/errors.rb
465
+ - vmc-ng/lib/vmc/spacing.rb
466
+ - vmc-ng/lib/vmc/plugin.rb
467
+ - vmc-ng/lib/vmc/constants.rb
468
+ - vmc-ng/lib/vmc/cli.rb
469
+ - vmc-ng/lib/vmc/cli/service.rb
470
+ - vmc-ng/lib/vmc/cli/user.rb
471
+ - vmc-ng/lib/vmc/cli/interactive.rb
472
+ - vmc-ng/lib/vmc/cli/space.rb
473
+ - vmc-ng/lib/vmc/cli/start.rb
458
474
  - vmc-ng/lib/vmc/cli/app.rb
459
- - vmc-ng/lib/vmc/cli/domain.rb
460
475
  - vmc-ng/lib/vmc/cli/help.rb
461
- - vmc-ng/lib/vmc/cli/interactive.rb
462
476
  - vmc-ng/lib/vmc/cli/organization.rb
463
477
  - vmc-ng/lib/vmc/cli/route.rb
464
- - vmc-ng/lib/vmc/cli/service.rb
465
- - vmc-ng/lib/vmc/cli/space.rb
466
- - vmc-ng/lib/vmc/cli/start.rb
467
- - vmc-ng/lib/vmc/cli/user.rb
468
- - vmc-ng/lib/vmc/cli.rb
469
- - vmc-ng/lib/vmc/constants.rb
470
- - vmc-ng/lib/vmc/detect.rb
471
- - vmc-ng/lib/vmc/errors.rb
472
- - vmc-ng/lib/vmc/plugin.rb
473
- - vmc-ng/lib/vmc/spacing.rb
474
- - vmc-ng/lib/vmc/spec_helpers/eventlog.rb
475
- - vmc-ng/lib/vmc/spec_helpers/patches.rb
476
- - vmc-ng/lib/vmc/spec_helpers.rb
477
- - vmc-ng/lib/vmc/version.rb
478
+ - vmc-ng/lib/vmc/cli/domain.rb
478
479
  - vmc-ng/lib/vmc.rb
480
+ - vmc-ng/spec/helpers.rb
481
+ - vmc-ng/spec/start/info_spec.rb
482
+ - vmc-ng/spec/start/target_spec.rb
483
+ - vmc-ng/spec/app/push_spec.rb
479
484
  - vmc-ng/spec/app/app_spec.rb
480
485
  - vmc-ng/spec/app/apps_spec.rb
481
- - vmc-ng/spec/app/push_spec.rb
486
+ - vmc-ng/spec/assets/hello-sinatra/manifest.yml
482
487
  - vmc-ng/spec/assets/hello-sinatra/Gemfile
483
488
  - vmc-ng/spec/assets/hello-sinatra/main.rb
484
- - vmc-ng/spec/assets/hello-sinatra/manifest.yml
485
- - vmc-ng/spec/helpers.rb
486
489
  - vmc-ng/spec/Rakefile
487
- - vmc-ng/spec/start/target_spec.rb
488
490
  - vmc-ng/bin/vmc
489
491
  - bin/vmc
492
+ has_rdoc: true
490
493
  homepage: http://vmware.com
491
494
  licenses: []
492
495
 
@@ -518,7 +521,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
518
521
  requirements: []
519
522
 
520
523
  rubyforge_project:
521
- rubygems_version: 1.8.24
524
+ rubygems_version: 1.6.2
522
525
  signing_key:
523
526
  specification_version: 3
524
527
  summary: Client library and CLI that provides access to the VMware Cloud Application Platform.