Signs in with the RubyGems API at
sign_in_host and sets the rubygems API key.
# File lib/rubygems/gemcutter_utilities.rb, line 96
def sign_in sign_in_host = nil
sign_in_host ||= self.host
return if api_key
pretty_host = if Gem::DEFAULT_HOST == sign_in_host then
'RubyGems.org'
else
sign_in_host
end
say "Enter your #{pretty_host} credentials."
say "Don't have an account yet? " +
"Create one at #{sign_in_host}/sign_up"
email = ask " Email: "
password = ask_for_password "Password: "
say "\n"
response = rubygems_api_request(:get, "api/v1/api_key",
sign_in_host) do |request|
request.basic_auth email, password
end
with_response response do |resp|
say "Signed in."
set_api_key host, resp.body
end
end