vmc 0.4.0.beta.40 → 0.4.0.beta.41
Sign up to get free protection for your applications and to get access to all the features.
- data/vmc-ng/lib/vmc/cli/app.rb +63 -28
- data/vmc-ng/lib/vmc/version.rb +1 -1
- data/vmc-ng/spec/app/push_spec.rb +4 -1
- metadata +7 -7
data/vmc-ng/lib/vmc/cli/app.rb
CHANGED
@@ -188,17 +188,18 @@ module VMC
|
|
188
188
|
app.framework = framework
|
189
189
|
app.runtime = runtime
|
190
190
|
|
191
|
-
if framework == "standalone"
|
192
|
-
app.command = input[:command]
|
191
|
+
app.command = input[:command] if framework == "standalone"
|
193
192
|
|
194
|
-
|
195
|
-
|
193
|
+
url =
|
194
|
+
if framework == "standalone"
|
195
|
+
if (given = input[:url, "none"]) != "none"
|
196
|
+
given
|
197
|
+
end
|
196
198
|
else
|
197
|
-
|
199
|
+
input[:url, "#{name}.#{target_base}"]
|
198
200
|
end
|
199
|
-
|
200
|
-
|
201
|
-
end
|
201
|
+
|
202
|
+
app.urls = [url] if url && !v2?
|
202
203
|
|
203
204
|
app.memory = megabytes(input[:memory, framework, runtime])
|
204
205
|
|
@@ -208,6 +209,8 @@ module VMC
|
|
208
209
|
app.create!
|
209
210
|
end
|
210
211
|
|
212
|
+
invoke :map, :app => app, :url => url if v2?
|
213
|
+
|
211
214
|
bindings = []
|
212
215
|
|
213
216
|
if input[:create_services] && !force?
|
@@ -606,17 +609,41 @@ module VMC
|
|
606
609
|
:desc => "Application to add the URL to",
|
607
610
|
:from_given => by_name("app")
|
608
611
|
input :url, :argument => true,
|
609
|
-
:desc => "URL to
|
612
|
+
:desc => "URL to map to the application"
|
610
613
|
def map
|
611
|
-
no_v2
|
612
|
-
|
613
614
|
app = input[:app]
|
614
615
|
|
615
616
|
simple = input[:url].sub(/^https?:\/\/(.*)\/?/i, '\1')
|
616
617
|
|
617
|
-
|
618
|
-
|
619
|
-
|
618
|
+
if v2?
|
619
|
+
host, domain_name = simple.split(".", 2)
|
620
|
+
|
621
|
+
route = client.routes.find { |r|
|
622
|
+
r.host == host && r.domain.name == domain_name
|
623
|
+
}
|
624
|
+
|
625
|
+
unless route
|
626
|
+
domain = client.domain_by_name(domain_name)
|
627
|
+
fail "Invalid domain '#{domain_name}'" unless domain
|
628
|
+
|
629
|
+
route = client.route
|
630
|
+
|
631
|
+
with_progress("Creating route #{c(simple, :name)}") do
|
632
|
+
route.host = host
|
633
|
+
route.domain = domain
|
634
|
+
route.organization = client.current_organization
|
635
|
+
route.create!
|
636
|
+
end
|
637
|
+
end
|
638
|
+
|
639
|
+
with_progress("Binding #{c(simple, :name)} to #{c(app.name, :name)}") do
|
640
|
+
app.add_route(route)
|
641
|
+
end
|
642
|
+
else
|
643
|
+
with_progress("Updating #{c(app.name, :name)}") do
|
644
|
+
app.urls << simple
|
645
|
+
app.update!
|
646
|
+
end
|
620
647
|
end
|
621
648
|
end
|
622
649
|
|
@@ -630,22 +657,34 @@ module VMC
|
|
630
657
|
ask("Which URL?", :choices => choices)
|
631
658
|
}
|
632
659
|
def unmap
|
633
|
-
no_v2
|
634
|
-
|
635
660
|
app = input[:app]
|
636
661
|
url = input[:url, app.urls]
|
637
662
|
|
638
663
|
simple = url.sub(/^https?:\/\/(.*)\/?/i, '\1')
|
639
664
|
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
end
|
665
|
+
if v2?
|
666
|
+
host, domain_name = simple.split(".", 2)
|
667
|
+
|
668
|
+
route = app.routes.find do |r|
|
669
|
+
r.host == host && r.domain.name == domain_name
|
646
670
|
end
|
647
671
|
|
648
|
-
|
672
|
+
fail "Invalid route '#{simple}'" unless route
|
673
|
+
|
674
|
+
with_progress("Removing route #{c(simple, :name)}") do
|
675
|
+
app.remove_route(route)
|
676
|
+
end
|
677
|
+
else
|
678
|
+
with_progress("Updating #{c(app.name, :name)}") do |s|
|
679
|
+
unless app.urls.delete(simple)
|
680
|
+
s.fail do
|
681
|
+
err "URL #{url} is not mapped to this application."
|
682
|
+
return
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
app.update!
|
687
|
+
end
|
649
688
|
end
|
650
689
|
end
|
651
690
|
|
@@ -782,11 +821,7 @@ module VMC
|
|
782
821
|
|
783
822
|
line
|
784
823
|
|
785
|
-
|
786
|
-
if v2?
|
787
|
-
line "urls: #{b("#{a.guid}.#{target_base}")}"
|
788
|
-
end
|
789
|
-
else
|
824
|
+
unless a.urls.empty?
|
790
825
|
line "urls: #{a.urls.collect { |u| b(u) }.join(", ")}"
|
791
826
|
end
|
792
827
|
|
data/vmc-ng/lib/vmc/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe "App#push" do
|
|
6
6
|
instances = rand(3) + 1
|
7
7
|
framework = client.framework_by_name("sinatra")
|
8
8
|
runtime = client.runtime_by_name("ruby19")
|
9
|
-
url = "#{name}.
|
9
|
+
url = "#{name}.vcap.me"
|
10
10
|
memory = sample([64, 128, 256, 512])
|
11
11
|
|
12
12
|
client.app_by_name(name).should_not be
|
@@ -41,6 +41,9 @@ describe "App#push" do
|
|
41
41
|
|
42
42
|
does("Creating #{name}")
|
43
43
|
|
44
|
+
does("Creating route #{url}")
|
45
|
+
does("Binding #{url} to #{name}")
|
46
|
+
|
44
47
|
asks("Create services for application?")
|
45
48
|
given("n")
|
46
49
|
has_input(:create_services, false)
|
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: -259037938
|
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
|
+
- 41
|
12
|
+
version: 0.4.0.beta.41
|
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-08-
|
20
|
+
date: 2012-08-31 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: json_pure
|
@@ -249,12 +249,12 @@ dependencies:
|
|
249
249
|
requirements:
|
250
250
|
- - ~>
|
251
251
|
- !ruby/object:Gem::Version
|
252
|
-
hash:
|
252
|
+
hash: 37
|
253
253
|
segments:
|
254
254
|
- 0
|
255
255
|
- 3
|
256
|
-
-
|
257
|
-
version: 0.3.
|
256
|
+
- 27
|
257
|
+
version: 0.3.27
|
258
258
|
type: :runtime
|
259
259
|
version_requirements: *id014
|
260
260
|
- !ruby/object:Gem::Dependency
|