lib/cli/manifest_helper.rb in af-0.3.18.2 vs lib/cli/manifest_helper.rb in af-0.3.18.3
- old
+ new
@@ -80,12 +80,10 @@
def configure_app(many=false)
name = manifest("name") ||
set(ask("Application Name", :default => manifest("name")), "name")
-
-
if manifest "framework"
framework = VMC::Cli::Framework.lookup_by_framework manifest("framework","name")
else
framework = detect_framework
set framework.name, "framework", "name"
@@ -105,10 +103,18 @@
set(detect_runtime(default_runtime), "runtime") if framework.prompt_for_runtime?
end
default_command = manifest "command"
set ask("Start Command", :default => default_command), "command" if framework.require_start_command?
+ if client.infra_supported?
+ infra = @options[:infra] || manifest("infra") ||
+ VMC::Cli::InfraHelper.name_for_description(
+ ask("Select Infrastructure",:indexed => true, :choices => VMC::Cli::InfraHelper.infra_descriptions))
+ set infra.dup, "infra"
+ VMC::Cli::Config.infra = infra
+ end
+
url_template = manifest("url") || DEFAULTS["url"]
url_resolved = url_template.dup
resolve_lexically(url_resolved)
if !framework.require_url?
@@ -145,11 +151,11 @@
"How many instances?",
:default => manifest("instances") || DEFAULTS["instances"]
), "instances"
unless manifest "services"
- user_services = client.services
+ user_services = services_for_infra(manifest("infra"))
user_services.sort! {|a, b| a[:name] <=> b[:name] }
unless user_services.empty?
if ask "Bind existing services to '#{name}'?", :default => false
bind_services(user_services)
@@ -261,9 +267,17 @@
set vendor, "services", name, "type"
end
private
+ def services_for_infra(infra)
+ if client.infra_supported?
+ client.services.select { |s| s[:infra] && s[:infra][:provider] == manifest("infra") }
+ else
+ client.services
+ end
+ end
+
def ordered_by_deps(apps, abspaths = nil, processed = Set[])
unless abspaths
abspaths = {}
apps.each do |p, i|
ep = File.expand_path("../" + p, manifest_file)