Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecate command method #2935

Merged
4 commits merged into from
Oct 15, 2019
Merged

Add deprecate command method #2935

4 commits merged into from
Oct 15, 2019

Conversation

bronzdoc
Copy link
Member

@bronzdoc bronzdoc commented Sep 28, 2019

Description:

This PR adds a deprecate_command method to deprecate RubyGems commands.

Example

class Gem::Commands::QueryCommand
  extend Gem::Deprecate

  deprecate_command(2019, 12)

  def execute
    gem_names = Array(options[:name])

    if !args.empty?
      gem_names = options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
    end

    terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems?

    gem_names.each { |n| show_gems(n) }
  end
 ...
end
$ gem query
ebsocket-driver (0.7.1, 0.7.0, 0.6.5)
websocket-extensions (0.1.4, 0.1.3)
will_paginate (3.0.12)
xml-simple (1.1.5)
xmlrpc (0.3.0)
xpath (3.2.0, 2.1.0)
yajl-ruby (1.4.1)
yard (0.9.20, 0.8.7.6)
yell (2.2.0)
zeitwerk (2.1.10, 2.1.9, 2.1.8, 2.1.6, 2.1.2)
zlib (default: 1.0.0)

NOTE: query command is deprecated. It will be removed on or after 2019-12-01.

I will abide by the code of conduct.

@bronzdoc
Copy link
Member Author

Bundler specs failing 🤔

@deivid-rodriguez @hsbt @duckinator what you think of adding this method in general?

@duckinator
Copy link
Member

@bronzdoc I'm in favor of this being added, if there's commands that need to be deprecated. And I imagine there are, since the RubyGems codebase is 10+ years old.

@bronzdoc
Copy link
Member Author

Summary:
    Query gem information in local or remote repositories

  Description:
    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.

  Defaults:
    --local --name-matches // --no-details --versions --no-installed

I'm thinking of the query command I wonder for how long have we been telling people to not to use it?

@duckinator
Copy link
Member

Yeah, that seems worth deprecating, so I'd say it's worth adding deprecate_command.

@deivid-rodriguez
Copy link
Member

Me too, I like the idea of deprecate_command. Haven't looked at the implementation though.

@hsbt
Copy link
Member

hsbt commented Oct 10, 2019

@bronzdoc https://github.com/rubygems/rubygems/pull/2935/checks?check_run_id=239916853 is issue of GitHub Actions. It exceeded 6h of execution limit.

@bronzdoc
Copy link
Member Author

@deivid-rodriguez @duckinator @hsbt what you think of of the implementation of this method? do you approve?

@duckinator
Copy link
Member

@bronzdoc this looks good to me. 👍

@bronzdoc
Copy link
Member Author

@bundlerbot r+

ghost pushed a commit that referenced this pull request Oct 15, 2019
2935: Add deprecate command method r=bronzdoc a=bronzdoc

# Description:

This PR adds a `deprecate_command` method to deprecate RubyGems commands.

### Example
```ruby            
class Gem::Commands::QueryCommand
  extend Gem::Deprecate

  deprecate_command(2019, 12)

  def execute
    gem_names = Array(options[:name])

    if !args.empty?
      gem_names = options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
    end

    terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems?

    gem_names.each { |n| show_gems(n) }
  end
 ...
end
```

```shell
$ gem query
ebsocket-driver (0.7.1, 0.7.0, 0.6.5)
websocket-extensions (0.1.4, 0.1.3)
will_paginate (3.0.12)
xml-simple (1.1.5)
xmlrpc (0.3.0)
xpath (3.2.0, 2.1.0)
yajl-ruby (1.4.1)
yard (0.9.20, 0.8.7.6)
yell (2.2.0)
zeitwerk (2.1.10, 2.1.9, 2.1.8, 2.1.6, 2.1.2)
zlib (default: 1.0.0)

NOTE: query command is deprecated. It will be removed on or after 2019-12-01.
```

______________

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


Co-authored-by: bronzdoc <lsagastume1990@gmail.com>
@ghost
Copy link

ghost commented Oct 15, 2019

Build succeeded

@ghost ghost merged commit 133be91 into master Oct 15, 2019
@ghost ghost deleted the add/deprecate_command_method branch October 15, 2019 15:20
ghost pushed a commit that referenced this pull request Nov 19, 2019
2974: Simplify deprecate command method r=deivid-rodriguez a=bronzdoc

# Description:
 
Simplify `Gem::Deprecate#deprecate_command` that was introduced here #2935
______________

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


Co-authored-by: bronzdoc <lsagastume1990@gmail.com>
hsbt pushed a commit to rubygems/rubygems-server that referenced this pull request Sep 24, 2021
2974: Simplify deprecate command method r=deivid-rodriguez a=bronzdoc

# Description:
 
Simplify `Gem::Deprecate#deprecate_command` that was introduced here rubygems/rubygems#2935
______________

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


Co-authored-by: bronzdoc <lsagastume1990@gmail.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants