lib/shelly/cli/main.rb in shelly-0.2.2 vs lib/shelly/cli/main.rb in shelly-0.2.3
- old
+ new
@@ -256,13 +256,27 @@
desc "stop", "Shutdown the cloud"
method_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify cloud"
def stop
app = multiple_clouds(options[:cloud], "stop")
- ask_to_stop_application
- app.stop
- say_new_line
- say "Cloud '#{app}' stopped"
+ stop_question = "Are you sure you want to shut down '#{app}' cloud (yes/no):"
+ if ask(stop_question) == "yes"
+ app.stop
+ say_new_line
+ say "Cloud '#{app}' stopped"
+ end
+ rescue Client::ConflictException => e
+ case e[:state]
+ when "deploying"
+ say_error "Your cloud is currently being deployed and it can not be stopped."
+ when "no_code"
+ say_error "You need to deploy your cloud first.", :with_exit => false
+ say "More information can be found at:"
+ say "#{app.shelly.shellyapp_url}/documentation/deployment"
+ exit 1
+ when "turning_off"
+ say_error "Your cloud is turning off."
+ end
rescue Client::NotFoundException => e
raise unless e.resource == :cloud
say_error "You have no access to '#{app}' cloud defined in Cloudfile"
end