Class: Gem::Commands::SigninCommand

Inherits:
Gem::Command show all
Includes:
GemcutterUtilities
Defined in:
lib/rubygems/commands/signin_command.rb

Constant Summary

Constants included from GemcutterUtilities

GemcutterUtilities::API_SCOPES, GemcutterUtilities::ERROR_CODE, GemcutterUtilities::EXCLUSIVELY_API_SCOPES

Instance Attribute Summary

Attributes included from GemcutterUtilities

#host, #scope

Attributes inherited from Gem::Command

#command, #defaults, #options, #program_name, #summary

Instance Method Summary collapse

Methods included from GemcutterUtilities

#add_key_option, #add_otp_option, #api_key, #mfa_unauthorized?, #otp, #rubygems_api_request, #set_api_key, #sign_in, #update_scope, #verify_api_key, #with_response

Methods included from Text

#clean_text, #format_text, #levenshtein_distance, #min3, #truncate_text

Methods inherited from Gem::Command

add_common_option, #add_extra_args, #add_option, add_specific_extra_args, #arguments, #begins?, build_args, build_args=, #check_deprecated_options, common_options, #defaults_str, #deprecate_option, #deprecated?, extra_args, extra_args=, #extract_gem_name_and_version, #get_all_gem_names, #get_all_gem_names_and_versions, #get_one_gem_name, #get_one_optional_argument, #handle_options, #handles?, #invoke, #invoke_with_build_args, #merge_options, #remove_option, #show_help, #show_lookup_failure, specific_extra_args, specific_extra_args_hash, #when_invoked

Methods included from UserInteraction

#alert, #alert_error, #alert_warning, #ask, #ask_for_password, #ask_yes_no, #choose_from_list, #say, #terminate_interaction, #verbose

Methods included from DefaultUserInteraction

ui, #ui, ui=, #ui=, use_ui, #use_ui

Constructor Details

#initializeSigninCommand

Returns a new instance of SigninCommand.



9
10
11
12
13
14
15
16
17
18
# File 'lib/rubygems/commands/signin_command.rb', line 9

def initialize
  super "signin", "Sign in to any gemcutter-compatible host. "\
        "It defaults to https://rubygems.org"

  add_option("--host HOST", "Push to another gemcutter-compatible host") do |value, options|
    options[:host] = value
  end

  add_otp_option
end

Instance Method Details

#descriptionObject

:nodoc:



20
21
22
23
24
25
# File 'lib/rubygems/commands/signin_command.rb', line 20

def description # :nodoc:
  "The signin command executes host sign in for a push server (the default is"\
  " https://rubygems.org). The host can be provided with the host flag or can"\
  " be inferred from the provided gem. Host resolution matches the resolution"\
  " strategy for the push command."
end

#executeObject



31
32
33
# File 'lib/rubygems/commands/signin_command.rb', line 31

def execute
   options[:host]
end

#usageObject

:nodoc:



27
28
29
# File 'lib/rubygems/commands/signin_command.rb', line 27

def usage # :nodoc:
  program_name
end