vmc 0.4.0.beta.77 → 0.4.0.beta.78

Sign up to get free protection for your applications and to get access to all the features.
@@ -88,8 +88,21 @@ module VMC
88
88
  }
89
89
  input :path, :default => ".",
90
90
  :desc => "Path containing the application"
91
- input(:url, :desc => "URL bound to app") { |default|
92
- ask("URL", :default => default)
91
+ input(:url, :desc => "URL bound to app") { |name|
92
+ choices = url_choices(name)
93
+
94
+ options = {
95
+ :choices => choices + ["none"],
96
+ :allow_other => true
97
+ }
98
+
99
+ options[:default] = choices.first if choices.size == 1
100
+
101
+ url = ask "URL", options
102
+
103
+ unless url == "none"
104
+ url
105
+ end
93
106
  }
94
107
  input(:memory, :desc => "Memory limit") { |default|
95
108
  ask("Memory Limit",
@@ -469,9 +482,11 @@ module VMC
469
482
  line l
470
483
  end
471
484
  end
485
+ rescue CFoundry::NotFound
486
+ fail "Invalid path #{b(path)} for app #{b(app.name)}"
472
487
  rescue CFoundry::APIError => e
473
488
  if e.error_code == 190001
474
- fail "Invalid path #{b(path)} for app #{b(app.name)}"
489
+ fail e.description
475
490
  else
476
491
  raise
477
492
  end
@@ -500,9 +515,11 @@ module VMC
500
515
  else
501
516
  invoke :file, :app => app, :path => path
502
517
  end
518
+ rescue CFoundry::NotFound
519
+ fail "Invalid path #{b(path)} for app #{b(app.name)}"
503
520
  rescue CFoundry::APIError => e
504
521
  if e.error_code == 190001
505
- fail "Invalid path #{b(path)} for app #{b(app.name)}"
522
+ fail e.description
506
523
  else
507
524
  raise
508
525
  end
@@ -940,14 +957,7 @@ module VMC
940
957
 
941
958
  app.command = input[:command] if framework.name == "standalone"
942
959
 
943
- url =
944
- if framework.name == "standalone"
945
- if (given = input[:url, "none"]) != "none"
946
- given
947
- end
948
- else
949
- input[:url, "#{name}.#{target_base}"]
950
- end
960
+ url = input[:url, name]
951
961
 
952
962
  app.urls = [url] if url && !v2?
953
963
 
@@ -1246,6 +1256,17 @@ module VMC
1246
1256
  client.target.sub(/^https?:\/\/([^\.]+\.)?(.+)\/?/, '\2')
1247
1257
  end
1248
1258
 
1259
+ def url_choices(name)
1260
+ if v2?
1261
+ client.current_space.domains.sort_by(&:name).collect do |d|
1262
+ # TODO: check availability
1263
+ "#{name}.#{d.name}"
1264
+ end
1265
+ else
1266
+ ["#{name}.#{target_base}"]
1267
+ end
1268
+ end
1269
+
1249
1270
  def memory_choices(exclude = 0)
1250
1271
  info = client.info
1251
1272
  used = info[:usage][:memory]
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.4.0.beta.77"
2
+ VERSION = "0.4.0.beta.78"
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: 2296988067
4
+ hash: 1624197077
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
9
  - 0
10
10
  - beta
11
- - 77
12
- version: 0.4.0.beta.77
11
+ - 78
12
+ version: 0.4.0.beta.78
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-05 00:00:00 Z
20
+ date: 2012-11-06 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: json_pure