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

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?, #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=, #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, 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.



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

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:



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

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



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

def execute
   options[:host]
end

#usageObject

:nodoc:



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

def usage # :nodoc:
  program_name
end