Class: RHC::Commands::Logout
Constant Summary
Constants included from Helpers
Helpers::BOUND_WARNING, Helpers::PREFIX, Helpers::ROLES
Instance Method Summary collapse
Methods inherited from Base
Methods included from RHC::ContextHelpers
#find_app, #find_app_or_domain, #find_domain, #from_local_git, included, #namespace_context, #server_context
Methods included from GitHelpers
#git_clone_application, #git_clone_deploy_hooks, #git_clone_repo, #git_config_get, #git_config_set, #git_version, #has_git?
Methods included from Helpers
#agree, #certificate_file, #client_from_options, #collect_env_vars, #color, #confirm_action, #date, #datetime_rfc3339, #debug, #debug?, #debug_error, #decode_json, #deprecated, #deprecated_command, #disable_deprecated?, #distance_of_time_in_words, #env_var_regex_pattern, #error, #exec, #host_exists?, #hosts_file_contains?, #human_size, #info, #interactive?, #jruby?, #mac?, #pluralize, #protonbox_online_server?, #protonbox_rest_endpoint, #protonbox_server, #protonbox_url, #results, #role_name, #run_with_tee, #ssh_string, #ssh_string_parts, #ssl_options, #success, #system_path, #table_heading, #to_host, #to_uri, #token_for_user, #unix?, #user_agent, #warn, #windows?, #with_tolerant_encoding
Methods included from OutputHelpers
#default_display_env_var, #display_app, #display_app_configurations, #display_authorization, #display_cart, #display_cart_storage_info, #display_cart_storage_list, #display_deployment, #display_deployment_list, #display_domain, #display_env_var_list, #display_key, #format_cart_gears, #format_cart_header, #format_gear_info, #format_key_header, #format_scaling_info, #format_usage_message
Constructor Details
This class inherits a constructor from RHC::Commands::Base
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rhc/commands/logout.rb', line 19 def run if .all rest_client.user # force authentication say "Deleting all authorizations associated with your account ... " begin rest_client. success "done" rescue RHC::Rest::AuthorizationsNotSupported info "not supported" end elsif token_for_user .noprompt = true say "Ending session on server ... " begin rest_client.(token_for_user) success "deleted" rescue RHC::Rest::AuthorizationsNotSupported info "not supported" rescue RHC::Rest::TokenExpiredOrInvalid info "already closed" rescue => e debug_error(e) warn e. end end 0 ensure token_store.clear success "All local sessions removed." end |