Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Commands::SignoutCommand#execute
execute
lib/rubygems/commands/signout_command.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/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
No documentation available