2016-02-01 12:43:26 +00:00
|
|
|
# frozen_string_literal: true
|
2007-11-10 07:48:56 +00:00
|
|
|
require 'rubygems/command'
|
2020-02-06 21:54:23 +09:00
|
|
|
require 'rubygems/query_utils'
|
|
|
|
require 'rubygems/deprecate'
|
2007-11-10 07:48:56 +00:00
|
|
|
|
|
|
|
class Gem::Commands::QueryCommand < Gem::Command
|
2020-02-06 21:54:23 +09:00
|
|
|
extend Gem::Deprecate
|
2020-04-19 07:41:54 -06:00
|
|
|
rubygems_deprecate_command
|
2020-02-06 21:54:23 +09:00
|
|
|
|
|
|
|
include Gem::QueryUtils
|
2007-11-10 07:48:56 +00:00
|
|
|
|
2020-12-08 16:33:39 +09:00
|
|
|
alias warning_without_suggested_alternatives deprecation_warning
|
|
|
|
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
|
|
|
|
|
2007-11-10 07:48:56 +00:00
|
|
|
def initialize(name = 'query',
|
|
|
|
summary = 'Query gem information in local or remote repositories')
|
|
|
|
super name, summary,
|
2008-03-31 22:40:06 +00:00
|
|
|
:name => //, :domain => :local, :details => false, :versions => true,
|
2013-07-22 22:46:50 +00:00
|
|
|
:installed => nil, :version => Gem::Requirement.default
|
2008-03-31 22:40:06 +00:00
|
|
|
|
2007-11-10 07:48:56 +00:00
|
|
|
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
|
|
|
|
|
2020-02-06 21:54:23 +09:00
|
|
|
add_query_options
|
2007-11-10 07:48:56 +00:00
|
|
|
end
|
2020-12-08 16:33:39 +09:00
|
|
|
|
|
|
|
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
|
2007-11-10 07:48:56 +00:00
|
|
|
end
|