vmc-ng/lib/vmc/cli/app.rb in vmc-0.4.0.beta.3 vs vmc-ng/lib/vmc/cli/app.rb in vmc-0.4.0.beta.5
- old
+ new
@@ -34,11 +34,11 @@
desc "push [NAME]", "Push an application, syncing changes if it exists"
group :apps, :manage
flag(:name) { ask("Name") }
- flag(:path, :default => ".")
+ flag(:path)
flag(:url) { |name, target|
ask("URL", :default => "#{name}.#{target}")
}
flag(:memory) { |framework, runtime|
ask("Memory Limit",
@@ -67,11 +67,11 @@
}
flag(:bind_services, :type => :boolean) {
ask "Bind other services to application?", :default => false
}
def push(name = nil)
- path = File.expand_path(input(:path))
+ path = File.expand_path(input(:path) || ".")
name ||= input(:name)
detector = Detector.new(client, path)
frameworks = detector.all_frameworks
@@ -88,22 +88,23 @@
app.total_instances = input(:instances)
domain = client.target.sub(/^https?:\/\/api\.(.+)\/?/, '\1')
app.urls = [input(:url, name, domain)]
- framework = input(:framework, ["other"] + detected.keys.sort, default)
- if framework == "other"
- forget(:framework)
+ if detected.empty?
framework = input(:framework, frameworks.keys.sort, nil)
+ else
+ framework = input(:framework, ["other"] + detected.keys.sort, default)
+ if framework == "other"
+ forget(:framework)
+ framework = input(:framework, frameworks.keys.sort, nil)
+ end
end
framework_runtimes =
- frameworks[framework]["runtimes"].collect do |k|
- "#{k["name"]} (#{k["description"]})"
- end
+ frameworks[framework]["runtimes"].collect { |k| k["name"] }
- # TODO: include descriptions
- runtime = input(:runtime, framework_runtimes.sort).split.first
+ runtime = input(:runtime, framework_runtimes.sort)
app.framework = framework
app.runtime = runtime
app.memory = megabytes(input(:memory, framework, runtime))