lib/app42/command/client.rb in app42-0.5.3 vs lib/app42/command/client.rb in app42-0.5.4

- old
+ new

@@ -57,12 +57,12 @@ # Some duplicates exists to capture all scenarios def parse_options(command, args) opts_parser = OptionParser.new do |opts| opts.banner = "\nAvailable options:\n\n" - opts.on('--api_key API_KEY') { |api| @options[:api] = api } - opts.on('--secret_key SECRET_KEY') { |secret| @options[:secret] = secret } + opts.on('--apiKey API_KEY') { |api| @options[:api] = api } + opts.on('--secretKey SECRET_KEY') { |secret| @options[:secret] = secret } opts.on('-a API_KEY') { |api| @options[:api] = api } opts.on('-s SECRET_KEY') { |secret| @options[:secret] = secret } opts.on('--app NAME') { |name| @options[:name] = name } opts.on('--name NAME') { |name| @options[:name] = name } @@ -81,33 +81,33 @@ # @param [Object] command # @param [Object] args def start(command, args = []) if is_available?(command) - parse_options(command, args) - execute command + parse_options(command.downcase, args) + execute command.downcase cmd = App42::Command.const_get(@kclass.to_s.capitalize) begin cmd.new(@options).send(@command) rescue Interrupt puts Paint[" Command cancelled.", :red] exit! rescue Exception => e puts e end elsif command == 'help' - send(command) + send(command.downcase) else puts Paint["app42: Unknown command [#{command}]", :red] App42::Base::Help.how_to end end # @return true OR false def is_available? command - App42::Base::APP42_COMMAND.include?(command) + App42::Base::APP42_COMMAND.include?(command.downcase) end # choose action respective of class def execute command case command @@ -121,35 +121,35 @@ set_cmd(:app, :apps) when 'deploy' set_cmd(:app, :deploy) - when 'setupInfra' + when 'setupinfra' set_cmd(:app, :setup_infra) when 'update' set_cmd(:app, :deploy) when 'keys' set_cmd(:user, :keys) - when 'clearKeys' + when 'clearkeys' set_cmd(:user, :clear) - when 'addKeys' + when 'addkeys' set_cmd(:user, :add) when 'scale' set_cmd(:app, :scale) when 'descale' set_cmd(:app, :descale) - when 'appState' + when 'appstate' set_cmd(:info, :state) - when 'appInfo' + when 'appinfo' set_cmd(:info, :info) when 'logs' set_cmd(:info, :logs) @@ -160,17 +160,17 @@ set_cmd(:app, :stop) when 'restart' set_cmd(:app, :restart) - when 'deleteInfra' + when 'deleteinfra' set_cmd(:app, :delete) when 'releases' set_cmd(:info, :releases) - when 'iaasProviders' + when 'iaasproviders' set_cmd(:config, :iaas_providers) when 'frameworks' set_cmd(:config, :frameworks) @@ -181,34 +181,37 @@ set_cmd(:config, :memory) when 'app42-update' set_cmd(:config, :update) - when 'supportedServices' + when 'supportedservices' set_cmd(:service, :app42pass_services) + when 'activities' + set_cmd(:info, :activities) + when 'services' set_cmd(:service, :services) - when 'serviceInfo' + when 'serviceinfo' set_cmd(:service, :info) - when 'createService' + when 'createservice' set_cmd(:service, :create) - when 'deleteService' + when 'deleteservice' set_cmd(:service, :delete) - when 'resetServicePassword' + when 'resetservicepassword' set_cmd(:service, :reset_pass) - when 'bindIP' + when 'bindip' set_cmd(:service, :service_bind) - when 'unbindIP' + when 'unbindip' set_cmd(:service, :service_unbind) - when 'bindInfo' + when 'bindinfo' set_cmd(:service, :service_bindInfo) else puts Paint["app42: Unknown command [#{action}]", :red] App42::Base::Help.how_to \ No newline at end of file