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
Allow explicitly uninstalling multiple versions of same gem #7063
Conversation
Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack. For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide |
31df021
to
b73ea9d
Compare
b73ea9d
to
7aebd99
Compare
Thanks so much, just approved CI to run for you, let's see how it goes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Currently, you can install multiple versions of the same gem just fine: ``` $ gem install simplecov:0.19.0 simplecov:0.22.0 Fetching simplecov-0.19.0.gem Successfully installed simplecov-0.19.0 Parsing documentation for simplecov-0.19.0 Installing ri documentation for simplecov-0.19.0 Done installing documentation for simplecov after 0 seconds Fetching simplecov-0.22.0.gem Successfully installed simplecov-0.22.0 Parsing documentation for simplecov-0.22.0 Installing ri documentation for simplecov-0.22.0 Done installing documentation for simplecov after 0 seconds 2 gems installed ``` But to uninstall both of them, you need to run the equivalent uninstall command twice: ``` ~$ gem uninstall simplecov:0.19.0 simplecov:0.22.0 Successfully uninstalled simplecov-0.22.0 ~$ gem uninstall simplecov:0.19.0 simplecov:0.22.0 Gem 'simplecov' is not installed Successfully uninstalled simplecov-0.19.0 ``` This resolves that problem by using the gem's full name (which includes the version) when tracking which ones have already been uninstalled so when it gets to the second version listed it doesn't think it was already uninstalled.
7aebd99
to
d96101b
Compare
Allow explicitly uninstalling multiple versions of same gem (cherry picked from commit a3696cb)
Allow explicitly uninstalling multiple versions of same gem (cherry picked from commit a3696cb)
What was the end-user or developer problem that led to this PR?
As described in #6979, you can install multiple versions of the same gem just fine:
But to uninstall both of them, you need to run the equivalent uninstall command twice:
What is your fix for the problem, implemented in this PR?
When just a gem name is specified without a version, there's code so the uninstall only happens once for a gem when there's multiple versions installed which makes sense because the next step lets the user choose which specific version or if they want to uninstall all versions. This PR bypasses the skip logic if a specific gem version was given so that all can be uninstalled.
Make sure the following tasks are checked