lib/app42/base/util.rb in app42-0.5.8 vs lib/app42/base/util.rb in app42-0.5.9

- old
+ new

@@ -6,10 +6,11 @@ module Util # ask application name to user def ask_app_name input "Enter App Name", [], true + print_new_line end # # Reading input from user # @@ -294,10 +295,21 @@ else return str end end + # Check whether +uploadbackup+ path is valid OR not + # predefined extension are allowed only like .sql, .zip, .dump etc + def validate_upload_backup_path path + if path.include?('.zip') || path.include?('.sql') || path.include?('.tar.gz') || path.include?('.gzip') || path.include?('.dump') + return path + else + message "Please provide valid file.", true, 'red' + return false + end + end + # Check whether +setup+ name is valid OR not # +setup+ name length should not be more than 30 character # And should not contain any special character def validate_setup_name name, str if str.match(App42::REGEX) || str.length > 30 @@ -344,11 +356,11 @@ response = build_get_request query_params, 'app', 'availability' unless response["success"] return true else - message "App with the name #{app_name} does not exist.", true, 'red' + message "App with name '#{app_name}' does not exist.", true, 'red' exit! end end # rest call to server to check whether +service+ exist OR not. @@ -360,11 +372,11 @@ response = build_get_request query_params, 'service', 'availability' unless response["success"] return true else - message "Service with the name #{service_name} does not exist.", true, 'red' + message "Service with name '#{service_name}' does not exist.", true, 'red' exit! end end # rest call to server to check whether +setup name+ exist OR not. @@ -375,10 +387,10 @@ response = build_get_request query_params, 'setup', 'availability' unless response["success"] return true else - message "Setup name with the name #{setup_name} does not exist.", true, 'red' + message "Setup with name '#{setup_name}' does not exist.", true, 'red' exit! end end # Check whether +git URL+ is valid OR not \ No newline at end of file