Skip to content

Commit

Permalink
Merge #3014
Browse files Browse the repository at this point in the history
3014: Improve deprecations r=bronzdoc a=deivid-rodriguez

# Description:

#2967 deprecated `gem query` but it also deprecated `gem list`, `gem search`, and `gem info`, because they inherit from `gem query`.

This PR undeprecates these commands by no longer inheriting from `QueryCommand`.

It also adds tests to ensure that `gem query` is deprecated, but `gem list`, `gem search`, and `gem info` are not.

Fixes #3008.

# Tasks:

- [x] Describe the problem / feature
- [x] Write tests
- [x] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).


Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
  • Loading branch information
bundlerbot and deivid-rodriguez committed Dec 4, 2019
2 parents 752fece + ac7698f commit cc8e975
Show file tree
Hide file tree
Showing 11 changed files with 447 additions and 381 deletions.
1 change: 1 addition & 0 deletions Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ lib/rubygems/path_support.rb
lib/rubygems/platform.rb
lib/rubygems/psych_additions.rb
lib/rubygems/psych_tree.rb
lib/rubygems/query_utils.rb
lib/rubygems/rdoc.rb
lib/rubygems/remote_fetcher.rb
lib/rubygems/request.rb
Expand Down
13 changes: 9 additions & 4 deletions lib/rubygems/commands/info_command.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# frozen_string_literal: true

require 'rubygems/command'
require 'rubygems/commands/query_command'
require 'rubygems/query_utils'

class Gem::Commands::InfoCommand < Gem::Commands::QueryCommand
class Gem::Commands::InfoCommand < Gem::Command

include Gem::QueryUtils

def initialize
super "info", "Show information for the given gem"
super "info", "Show information for the given gem",
:name => //, :domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default

add_query_options

remove_option('--name-matches')
remove_option('-d')

defaults[:details] = true
Expand Down
15 changes: 9 additions & 6 deletions lib/rubygems/commands/list_command.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/commands/query_command'
require 'rubygems/query_utils'

##
# An alternate to Gem::Commands::QueryCommand that searches for gems starting
# with the supplied argument.
# Searches for gems starting with the supplied argument.

class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
class Gem::Commands::ListCommand < Gem::Command

include Gem::QueryUtils

def initialize
super 'list', 'Display local gems whose name matches REGEXP'
super 'list', 'Display local gems whose name matches REGEXP',
:name => //, :domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default

remove_option('--name-matches')
add_query_options
end

def arguments # :nodoc:
Expand Down

0 comments on commit cc8e975

Please sign in to comment.