Skip to content

Commit

Permalink
Merge pull request #4021 from landongrindheim/add-gem-query-alternati…
Browse files Browse the repository at this point in the history
…ves-to-deprecation-warning

Suggest alternatives in `gem query` deprecation
  • Loading branch information
deivid-rodriguez committed Oct 20, 2020
2 parents 62782d3 + a6584a9 commit 61447f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/rubygems/commands/query_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ class Gem::Commands::QueryCommand < Gem::Command

include Gem::QueryUtils

alias warning_without_suggested_alternatives deprecation_warning
def deprecation_warning
warning_without_suggested_alternatives

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

def initialize(name = 'query',
summary = 'Query gem information in local or remote repositories')
super name, summary,
Expand Down
1 change: 1 addition & 0 deletions test/rubygems/test_gem_gem_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_query_is_deprecated
end

assert_match(/WARNING: query command is deprecated. It will be removed in Rubygems [0-9]+/, @ui.error)
assert_match(/It is recommended that you use `gem search` or `gem list` instead/, @ui.error)
end

def test_info_succeeds
Expand Down

0 comments on commit 61447f3

Please sign in to comment.