vmc 0.4.0.beta.91 → 0.4.0.beta.92
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/vmc-ng/lib/vmc/cli.rb +1 -1
- data/vmc-ng/lib/vmc/cli/app.rb +14 -7
- data/vmc-ng/lib/vmc/cli/organization.rb +2 -2
- data/vmc-ng/lib/vmc/cli/service.rb +29 -9
- data/vmc-ng/lib/vmc/cli/space.rb +4 -4
- data/vmc-ng/lib/vmc/cli/start.rb +6 -49
- data/vmc-ng/lib/vmc/cli/user.rb +1 -1
- data/vmc-ng/lib/vmc/spec_helpers.rb +2 -2
- data/vmc-ng/lib/vmc/version.rb +1 -1
- metadata +11 -12
- data/vmc-ng/spec/start/info_spec.rb +0 -23
data/vmc-ng/lib/vmc/cli.rb
CHANGED
data/vmc-ng/lib/vmc/cli/app.rb
CHANGED
@@ -27,7 +27,7 @@ module VMC
|
|
27
27
|
else
|
28
28
|
apps =
|
29
29
|
with_progress("Getting applications") do
|
30
|
-
client.apps(2)
|
30
|
+
client.apps(:depth => 2)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -575,8 +575,15 @@ module VMC
|
|
575
575
|
app = input[:app]
|
576
576
|
|
577
577
|
stats =
|
578
|
-
with_progress("Getting stats for #{c(app.name, :name)}") do
|
579
|
-
|
578
|
+
with_progress("Getting stats for #{c(app.name, :name)}") do |s|
|
579
|
+
begin
|
580
|
+
app.stats
|
581
|
+
rescue CFoundry::StatsError
|
582
|
+
s.fail do
|
583
|
+
err "Application #{b(app.name)} is not running."
|
584
|
+
return
|
585
|
+
end
|
586
|
+
end
|
580
587
|
end
|
581
588
|
|
582
589
|
line unless quiet?
|
@@ -622,11 +629,11 @@ module VMC
|
|
622
629
|
host, domain_name = simple.split(".", 2)
|
623
630
|
|
624
631
|
domain =
|
625
|
-
client.current_space.
|
632
|
+
client.current_space.domain_by_name(domain_name, :depth => 0)
|
626
633
|
|
627
634
|
fail "Invalid domain '#{domain_name}'" unless domain
|
628
635
|
|
629
|
-
route = client.
|
636
|
+
route = client.routes_by_host(host, :depth => 0).find do |r|
|
630
637
|
r.domain == domain
|
631
638
|
end
|
632
639
|
|
@@ -671,11 +678,11 @@ module VMC
|
|
671
678
|
host, domain_name = simple.split(".", 2)
|
672
679
|
|
673
680
|
domain =
|
674
|
-
client.current_space.
|
681
|
+
client.current_space.domain_by_name(domain_name, :depth => 0)
|
675
682
|
|
676
683
|
fail "Invalid domain '#{domain_name}'" unless domain
|
677
684
|
|
678
|
-
route = app.
|
685
|
+
route = app.routes_by_host(host, :depth => 0).find do |r|
|
679
686
|
r.domain == domain
|
680
687
|
end
|
681
688
|
|
@@ -46,7 +46,7 @@ module VMC
|
|
46
46
|
if input[:full]
|
47
47
|
line "spaces:"
|
48
48
|
|
49
|
-
spaced(org.spaces(2)) do |s|
|
49
|
+
spaced(org.spaces(:depth => 2)) do |s|
|
50
50
|
indented do
|
51
51
|
invoke :space, :space => s
|
52
52
|
end
|
@@ -67,7 +67,7 @@ module VMC
|
|
67
67
|
def orgs
|
68
68
|
orgs =
|
69
69
|
with_progress("Getting organizations") do
|
70
|
-
client.organizations
|
70
|
+
client.organizations
|
71
71
|
end
|
72
72
|
|
73
73
|
line unless quiet?
|
@@ -27,7 +27,7 @@ module VMC
|
|
27
27
|
|
28
28
|
instances =
|
29
29
|
with_progress(msg) do
|
30
|
-
client.service_instances(2)
|
30
|
+
client.service_instances(:depth => 2)
|
31
31
|
end
|
32
32
|
|
33
33
|
line unless quiet?
|
@@ -129,6 +129,8 @@ module VMC
|
|
129
129
|
|
130
130
|
if input[:version]
|
131
131
|
services.reject! { |s| s.version != input[:version] }
|
132
|
+
elsif !v2?
|
133
|
+
services.reject!(&:deprecated?)
|
132
134
|
end
|
133
135
|
|
134
136
|
if v2? && plan = input.given(:plan)
|
@@ -193,7 +195,7 @@ module VMC
|
|
193
195
|
input(:app, :argument => true,
|
194
196
|
:from_given => by_name("app"),
|
195
197
|
:desc => "Application to bind to") {
|
196
|
-
ask "Which application?", :choices => client.apps(2),
|
198
|
+
ask "Which application?", :choices => client.apps(:depth => 2),
|
197
199
|
:display => proc(&:name)
|
198
200
|
}
|
199
201
|
def bind_service
|
@@ -217,19 +219,19 @@ module VMC
|
|
217
219
|
group :services, :manage
|
218
220
|
input(:instance, :argument => true,
|
219
221
|
:from_given => find_by_name("service instance"),
|
220
|
-
:desc => "Service to bind") { |
|
221
|
-
ask "Which service instance?", :choices =>
|
222
|
+
:desc => "Service to bind") { |services|
|
223
|
+
ask "Which service instance?", :choices => services,
|
222
224
|
:display => proc(&:name)
|
223
225
|
}
|
224
226
|
input(:app, :argument => true,
|
225
|
-
:from_given =>
|
227
|
+
:from_given => by_name("app"),
|
226
228
|
:desc => "Application to bind to") {
|
227
|
-
ask "Which application?", :choices => client.apps(2),
|
229
|
+
ask "Which application?", :choices => client.apps(:depth => 2),
|
228
230
|
:display => proc(&:name)
|
229
231
|
}
|
230
232
|
def unbind_service
|
231
233
|
app = input[:app]
|
232
|
-
instance = input[:instance, app]
|
234
|
+
instance = input[:instance, app.services]
|
233
235
|
|
234
236
|
with_progress(
|
235
237
|
"Unbinding #{c(instance.name, :name)} from #{c(app.name, :name)}") do
|
@@ -253,6 +255,12 @@ module VMC
|
|
253
255
|
:default => proc { force? || interact }) { |name, color|
|
254
256
|
ask("Really delete #{c(name, color)}?", :default => false)
|
255
257
|
}
|
258
|
+
input(:unbind, :type => :boolean, :forget => true,
|
259
|
+
:default => proc { force? || interact }) { |apps|
|
260
|
+
names = human_list(apps.collect { |a| c(a.name, :name) })
|
261
|
+
|
262
|
+
ask("Unbind from #{names} before deleting?", :default => true)
|
263
|
+
}
|
256
264
|
input :all, :type => :boolean, :default => false,
|
257
265
|
:desc => "Delete all services"
|
258
266
|
def delete_service
|
@@ -270,9 +278,21 @@ module VMC
|
|
270
278
|
|
271
279
|
return unless input[:really, instance.name, :name]
|
272
280
|
|
273
|
-
|
274
|
-
|
281
|
+
bindings = []
|
282
|
+
|
283
|
+
if v2?
|
284
|
+
bindings = instance.service_bindings
|
285
|
+
|
286
|
+
unless bindings.empty? || !input[:unbind, bindings.collect(&:app)]
|
287
|
+
bindings.each do |b|
|
288
|
+
invoke :unbind_service, :instance => instance, :app => b.app
|
289
|
+
end
|
275
290
|
|
291
|
+
bindings = []
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
with_progress("Deleting #{c(instance.name, :name)}") do |s|
|
276
296
|
if bindings.empty?
|
277
297
|
instance.delete!
|
278
298
|
else
|
data/vmc-ng/lib/vmc/cli/space.rb
CHANGED
@@ -18,7 +18,7 @@ module VMC
|
|
18
18
|
|
19
19
|
def self.space_by_name
|
20
20
|
proc { |name, org, *_|
|
21
|
-
org.
|
21
|
+
org.space_by_name(name) ||
|
22
22
|
fail("Unknown space '#{name}'")
|
23
23
|
}
|
24
24
|
end
|
@@ -58,7 +58,7 @@ module VMC
|
|
58
58
|
line
|
59
59
|
line "apps:"
|
60
60
|
|
61
|
-
spaced(space.apps(2)) do |a|
|
61
|
+
spaced(space.apps(:depth => 2)) do |a|
|
62
62
|
indented do
|
63
63
|
invoke :app, :app => a
|
64
64
|
end
|
@@ -70,7 +70,7 @@ module VMC
|
|
70
70
|
if input[:full]
|
71
71
|
line
|
72
72
|
line "services:"
|
73
|
-
spaced(space.service_instances(2)) do |i|
|
73
|
+
spaced(space.service_instances(:depth => 2)) do |i|
|
74
74
|
indented do
|
75
75
|
invoke :service, :instance => i
|
76
76
|
end
|
@@ -99,7 +99,7 @@ module VMC
|
|
99
99
|
org = input[:organization]
|
100
100
|
spaces =
|
101
101
|
with_progress("Getting spaces in #{c(org.name, :name)}") do
|
102
|
-
org.spaces
|
102
|
+
org.spaces
|
103
103
|
end
|
104
104
|
|
105
105
|
line unless quiet?
|
data/vmc-ng/lib/vmc/cli/start.rb
CHANGED
@@ -83,25 +83,14 @@ module VMC
|
|
83
83
|
if runtimes.empty? && !quiet?
|
84
84
|
line "#{d("none")}"
|
85
85
|
elsif input[:quiet]
|
86
|
-
|
86
|
+
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
|
-
|
96
90
|
table(
|
97
|
-
%w{runtime
|
98
|
-
|
99
|
-
|
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
|
91
|
+
%w{runtime description},
|
92
|
+
runtimes.sort_by(&:name).collect { |r|
|
93
|
+
[c(r.name, :name), r.description]
|
105
94
|
})
|
106
95
|
end
|
107
96
|
end
|
@@ -137,6 +126,8 @@ module VMC
|
|
137
126
|
table(
|
138
127
|
["service", "version", "provider", v2? && "plans", "description"],
|
139
128
|
services.sort_by(&:label).collect { |s|
|
129
|
+
next if !v2? && s.deprecated?
|
130
|
+
|
140
131
|
[ c(s.label, :name),
|
141
132
|
s.version,
|
142
133
|
s.provider,
|
@@ -437,39 +428,5 @@ module VMC
|
|
437
428
|
end
|
438
429
|
end
|
439
430
|
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
|
474
431
|
end
|
475
432
|
end
|
data/vmc-ng/lib/vmc/cli/user.rb
CHANGED
@@ -38,12 +38,12 @@ module VMCHelpers
|
|
38
38
|
|
39
39
|
# cache frameworks for app generation
|
40
40
|
def frameworks
|
41
|
-
@@frameworks ||= client.frameworks(0)
|
41
|
+
@@frameworks ||= client.frameworks(:depth => 0)
|
42
42
|
end
|
43
43
|
|
44
44
|
# cache runtimes for app generation
|
45
45
|
def runtimes
|
46
|
-
@@runtimes ||= client.runtimes(0)
|
46
|
+
@@runtimes ||= client.runtimes(:depth => 0)
|
47
47
|
end
|
48
48
|
|
49
49
|
def with_random_app(space = client.current_space)
|
data/vmc-ng/lib/vmc/version.rb
CHANGED
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:
|
4
|
+
hash: 1993979039
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 0.4.0.beta.
|
11
|
+
- 92
|
12
|
+
version: 0.4.0.beta.92
|
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-11-
|
20
|
+
date: 2012-11-19 00:00:00 -08:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -266,12 +266,12 @@ dependencies:
|
|
266
266
|
requirements:
|
267
267
|
- - ~>
|
268
268
|
- !ruby/object:Gem::Version
|
269
|
-
hash:
|
269
|
+
hash: 15
|
270
270
|
segments:
|
271
271
|
- 0
|
272
|
-
-
|
273
|
-
-
|
274
|
-
version: 0.
|
272
|
+
- 4
|
273
|
+
- 0
|
274
|
+
version: 0.4.0
|
275
275
|
type: :runtime
|
276
276
|
version_requirements: *id015
|
277
277
|
- !ruby/object:Gem::Dependency
|
@@ -298,12 +298,12 @@ dependencies:
|
|
298
298
|
requirements:
|
299
299
|
- - ~>
|
300
300
|
- !ruby/object:Gem::Version
|
301
|
-
hash:
|
301
|
+
hash: 29
|
302
302
|
segments:
|
303
303
|
- 0
|
304
304
|
- 2
|
305
|
-
-
|
306
|
-
version: 0.2.
|
305
|
+
- 5
|
306
|
+
version: 0.2.5
|
307
307
|
type: :runtime
|
308
308
|
version_requirements: *id017
|
309
309
|
- !ruby/object:Gem::Dependency
|
@@ -478,7 +478,6 @@ files:
|
|
478
478
|
- vmc-ng/lib/vmc/cli/domain.rb
|
479
479
|
- vmc-ng/lib/vmc.rb
|
480
480
|
- vmc-ng/spec/helpers.rb
|
481
|
-
- vmc-ng/spec/start/info_spec.rb
|
482
481
|
- vmc-ng/spec/start/target_spec.rb
|
483
482
|
- vmc-ng/spec/app/push_spec.rb
|
484
483
|
- vmc-ng/spec/app/app_spec.rb
|
@@ -1,23 +0,0 @@
|
|
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
|