Class: Gem::Commands::QueryCommand

Inherits:
Gem::Command show all
Extended by:
Deprecate
Includes:
QueryUtils
Defined in:
lib/rubygems/commands/query_command.rb

Instance Attribute Summary

Attributes inherited from Gem::Command

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

Instance Method Summary collapse

Methods included from Deprecate

deprecate, next_rubygems_major_version, rubygems_deprecate, rubygems_deprecate_command, skip, skip=, skip_during

Methods included from QueryUtils

#add_query_options, #defaults_str, #execute

Methods included from VersionOption

#add_platform_option, #add_prerelease_option, #add_version_option, #get_platform_from_requirements

Methods included from LocalRemoteOptions

#accept_uri_http, #add_bulk_threshold_option, #add_clear_sources_option, #add_local_remote_options, #add_proxy_option, #add_source_option, #add_update_sources_option, #both?, #local?, #remote?

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?, #execute, 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, #usage, #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

#initialize(name = "query", summary = "Query gem information in local or remote repositories") ⇒ QueryCommand

Returns a new instance of QueryCommand.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rubygems/commands/query_command.rb', line 21

def initialize(name = "query", summary = "Query gem information in local or remote repositories")
  super name, summary,
       domain: :local, details: false, versions: true,
       installed: nil, version: Gem::Requirement.default

  add_option("-n", "--name-matches REGEXP",
             "Name of gem(s) to query on matches the",
             "provided REGEXP") do |value, options|
    options[:name] = /#{value}/i
  end

  add_query_options
end

Instance Method Details

#deprecation_warningObject



14
15
16
17
18
19
# File 'lib/rubygems/commands/query_command.rb', line 14

def deprecation_warning
  warning_without_suggested_alternatives

  message = "It is recommended that you use `gem search` or `gem list` instead.\n"
  alert_warning message unless Gem::Deprecate.skip
end

#descriptionObject

:nodoc:



35
36
37
38
39
40
41
42
# File 'lib/rubygems/commands/query_command.rb', line 35

def description # :nodoc:
  <<-EOF
The query command is the basis for the list and search commands.

You should really use the list and search commands instead.  This command
is too hard to use.
  EOF
end

#warning_without_suggested_alternativesObject



13
# File 'lib/rubygems/commands/query_command.rb', line 13

alias_method :warning_without_suggested_alternatives, :deprecation_warning