lib/cli/commands/apps.rb in vmc-0.3.6 vs lib/cli/commands/apps.rb in vmc-0.3.7

- old
+ new

@@ -1,9 +1,10 @@ require 'digest/sha1' require 'fileutils' require 'tempfile' require 'tmpdir' +require 'set' module VMC::Cli::Command class Apps < Base include VMC::Cli::ServicesHelper @@ -32,11 +33,13 @@ # Numerators are in secs TICKER_TICKS = 15/SLEEP_TIME HEALTH_TICKS = 5/SLEEP_TIME TAIL_TICKS = 25/SLEEP_TIME GIVEUP_TICKS = 120/SLEEP_TIME + YES_SET = Set.new(["y", "Y", "yes", "YES"]) + def start(appname, push = false) app = client.app_info(appname) return display "Application '#{appname}' could not be found".red if app.nil? return display "Application '#{appname}' already started".yellow if app[:state] == 'STARTED' app[:state] = 'STARTED' @@ -360,10 +363,20 @@ unless app_checked err "Application '#{appname}' already exists, use update or delete." if app_exists?(appname) end - url = ask("Application Deployed URL: '#{appname}.#{VMC::Cli::Config.suggest_url}'? ") unless no_prompt || url + unless no_prompt || url + url = ask("Application Deployed URL: '#{appname}.#{VMC::Cli::Config.suggest_url}'? ") + + # common error case is for prompted users to answer y or Y or yes or YES to this ask() resulting in an + # unintended URL of y. Special case this common error + if YES_SET.member?(url) + #silently revert to the stock url + url = "#{appname}.#{VMC::Cli::Config.suggest_url}" + end + end + url = "#{appname}.#{VMC::Cli::Config.suggest_url}" if url.nil? || url.empty? # Detect the appropriate framework. framework = nil unless ignore_framework