-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support for pre flag in bundle update
/bundle lock
#5258
Support for pre flag in bundle update
/bundle lock
#5258
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 |
Thanks so much for working on this @siegfault!
I like this idea, also allowing |
5763744
to
23c3622
Compare
There are still some conflicts here. |
Definitely, thanks for being on top of this! I'm switching computers and wanted to push my progress, but will hopefully have something more ready to view next week |
23c3622
to
3a01a13
Compare
As an update since this has been sitting awhile without movement (:sweat_smile:): I'm pushing up a change that feels fairly close to what we want so I wanted to open up some questions. Questions
GemVersionPromoter SortThe sort in
To clarify (3), given:
, we want to group upgrades by how many major bumps there are ( |
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.
Thanks @siegfault, it's looking very good!
Regarding improvements to gem version promoter, both of your suggestions look nice, happy to take any improvements there. Also I made some changes to this class while introducing PubGrub, and I think it can use some more renaming now since for example, sort_spec_deps
no longer makes sense as a name since the class now deals with resolution packages, not dependencies.
Thanks for the feedback! I've moved the smaller changes to their own commits, taking your early return suggestion, reverted the changelog bit, and all bundler specs pass for me locally (outside 6 that fail for me on master as well). With Either way, I'll work on adding some tests for |
3a01a13
to
83ba6cf
Compare
Thanks @siegfault! Looking forward to those specs, reviewed the other stuff and feels ready to me! Thanks so much for the changes to version promoter specs, their current shape was a pain to work with when refactoring this class. |
Re: the |
298e45a
to
cc093e8
Compare
@siegfault So sorry I dropped the ball here, I will make sure to include this PR in the final 2.4.0 release before the end of the year. Could you fix the lint failures? |
267ed2c
to
df03557
Compare
@deivid-rodriguez no worries at all! I know end of year can be pretty busy. My fault for not rerunning rubocop after making the spec changes. Just pushed a change that should fix the hash rockets |
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.
@siegfault Thanks so much for the fine work on this, and for your patience. This patch looks great to me ❤️.
However, the specs added in the last commit raise some questions, since the current behavior feels quite surprising and I suspect we may want to tweak the implementation instead of codifying the current behavior in specs. I also have some minor comments about wording.
Since I don't want to block this whole PR on that, how about temporarily removing the last commit and merging the rest of the PR as is, and then discussing further the desired behavior of the gem promoter on a separate PR.
df03557
to
abfd6a6
Compare
@deivid-rodriguez absolutely! Just dropped the last commit. I'll open up a new PR with that once this is merged. Thanks! |
bundle update
bundle update
/bundle lock
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.
Sorry I'm always seeing some little things right before merging 😅.
The conditions are not dependent on each spec and can be checked once at the beginning of the method.
Passing this flag allows bumping to the current version, even if that version is prerelease. This works in concert with the current flags.
With `GemVersionPromoter#sort_versions` being so simple, we no longer need to reach into the class's internals to make private methods public in order to effectively test. We can just allow both cases to go through the main method.
Ensure `bundle lock` handles pre flag just like bundle update does.
Prerelease versions are already considered in a certain circumstance, and the 'if updating' is redundant in the update case anyway.
ea8950c
to
8d68635
Compare
Thanks so much @siegfault ❤️ |
Of course! Thanks so much for helping get it merged! I'll open up that follow up spec PR at some point soon |
Hei @siegfault, just a note since I stumbled on this today. I think there's a bug in the different criteria considered by the gem version promoter, not sure if it's the same behavior that surprised you when writing specs: Prereleases are NOT considered even when the dependency specification includes a prerelease segment, if the dependency is not locked. To me that doesn't make sense, because I could create a I think a patch like this would fix that: diff --git a/bundler/lib/bundler/gem_version_promoter.rb b/bundler/lib/bundler/gem_version_promoter.rb
index f08fceb7e2..d281f46eeb 100644
--- a/bundler/lib/bundler/gem_version_promoter.rb
+++ b/bundler/lib/bundler/gem_version_promoter.rb
@@ -93,7 +93,7 @@ def sort_dep_specs(specs, package)
locked_version = package.locked_version
result = specs.sort do |a, b|
- unless locked_version && (package.prerelease_specified? || pre?)
+ unless package.prerelease_specified? || pre?
a_pre = a.prerelease?
b_pre = b.prerelease?
I may propose this at some point but if you get to proposing these specs first and you agree, feel free to propose it yourself too together with the specs! |
What was the end-user or developer problem that led to this PR?
More thoroughly described in #5207, but essentially allowing bumps to prerelease versions of gems without specifying a version in the lockfile.
What is your fix for the problem, implemented in this PR?
Passing this flag allows bumping to the current version, even if that
version is prerelease. This is a superset of the major flag since it
behaves the same but also considers prerelease versions.
The main alternative I see would be having pre work in concert with the currently existing flags. This would mean passing
--pre --major
would work as in this PR, but--pre --minor
would prefer not to bump major versions.Assuming we want the current behavior, are there any other commands I should update, or any other places I should add specs?
Closes #5207.
Make sure the following tasks are checked