class Gem::Commands::SignoutCommand
Public Class Methods
Source
# File lib/rubygems/commands/signout_command.rb, line 6 def initialize super "signout", "Sign out from all the current sessions." end
Calls superclass method
Gem::Command::new
Public Instance Methods
Source
# File lib/rubygems/commands/signout_command.rb, line 22 def execute credentials_path = Gem.configuration.credentials_path credentials_file_exists = File.exist?(credentials_path) if !credentials_file_exists && !Gem.configuration.credential_store alert_error "You are not currently signed in." return end # An unwritable file must not leave the stored keys behind, so each half # reports its own outcome. store_cleared, file_removed = Gem.configuration.unset_api_key! unremoved = [] unremoved << "the credential store" unless store_cleared unremoved << "'#{credentials_path}'" if credentials_file_exists && !file_removed unless unremoved.empty? alert_error "Could not remove the credentials from #{unremoved.join(" and ")}." \ " They are still there. Check that the file and its directory are writable," \ " or remove them yourself to finish signing out." terminate_interaction 1 end if Gem.configuration.credential_store say "You have successfully signed out of every registry, including RubyGems.org." else say "You have successfully signed out from all sessions." end end