-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Bump bundler from 2.3.8 to 2.3.9 and automate it #4884
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/usr/bin/env ruby | ||
| # frozen_string_literal: true | ||
|
|
||
| # This script bumps the bundler version used, since we reference it in a few | ||
| # different places. | ||
|
|
||
| require "excon" | ||
| require "json" | ||
|
|
||
| LATEST_VERSION = JSON.parse(Excon.get("https://rubygems.org/api/v1/gems/bundler.json").body)["version"] | ||
| CURRENT_VERSION = File.read("Dockerfile").match(/gem install bundler -v (2.\d+\.\d+)/)[1] | ||
|
|
||
| def update_file(filename) | ||
| File.open(filename, "r+") do |f| | ||
| contents = f.read | ||
| f.rewind | ||
| f.write(contents.gsub(CURRENT_VERSION, LATEST_VERSION)) | ||
| end | ||
| end | ||
|
|
||
| update_file("Dockerfile") | ||
| update_file("bundler/helpers/v2/build") | ||
| update_file("bundler/lib/dependabot/bundler/helpers.rb") | ||
| update_file("bundler/spec/dependabot/bundler/helper_spec.rb") | ||
| update_file("bundler/script/ci-test") | ||
| update_file("bundler/spec/spec_helper.rb") |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,7 @@ | |||||||||||||||||||
| end | ||||||||||||||||||||
|
|
||||||||||||||||||||
| let(:v1) { "1.17.3" } | ||||||||||||||||||||
| let(:v2) { "2.3.8" } | ||||||||||||||||||||
| let(:v2) { "2.3.9" } | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this spec could be relaxed to not hardcode exact versions, but instead just check the major version selected.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, right now I think the exact version is relevant, if we do this then we can maybe relax it?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These specs are unit tests for the
Namely, a unit test for this method dependabot-core/bundler/lib/dependabot/bundler/helpers.rb Lines 18 to 26 in ea8fbaf
In my opinion, testing that the result is a valid 3 component version number, and that the first segment is correct (1.x or 2.x) is enough. The exact version itself that dependabot is using is "configuration" and should not need a test, because it's not useful for detecting bugs and it means essentially testing the specific value of a constant, which defeats one of the points of using constants (keep things DRY).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That said that just my personal opinion but it's no big deal, and indeed if #4884 (comment) works, all this code will go away, so these tests will go too anways. |
||||||||||||||||||||
|
|
||||||||||||||||||||
| describe "#bundler_version" do | ||||||||||||||||||||
| def described_method(lockfile) | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
The Bundler version selection behavior implemented in this file should be the default as long as there's single v1 and v2 versions installed in the running environment. If that's the case I think it should be possible to completely remove this logic (don't pass
BUNDLER_VERSIONat all to native helpers) and let RubyGems do the right thing. But it seems something to consider for the future, definitely not for this PR.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.
Aye, yeah we should definitely try that and see if it doesn't break anything!