-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix NoMethodError during bundle update --group
#6157
Fix NoMethodError during bundle update --group
#6157
Conversation
Thanks for opening a pull request and helping make Bundler better! Someone from the Bundler 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 Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI 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 #bundler channel on Slack. For more information about contributing to the Bundler project feel free to review our CONTRIBUTING guide |
CHANGELOG.md
Outdated
@@ -11,6 +11,7 @@ Bugfixes: | |||
- prioritise explicitly requested gems in dependency resolution sort order (@segiddins) | |||
- reduce memory usage during dependency resolution ([#6114](https://github.com/bundler/bundler/issues/6114), @greysteil) | |||
- ensure that the default bundler gem is not accidentally activated on ruby 2.5 when using local git overrides (@segiddins) | |||
- fix `NoMethodError` when using the `--group` option with `bundle update` ([#6156](https://github.com/bundler/bundler/issues/6156), @mattbrictson) |
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.
Please don't amend the Changelog, changes are added when we make a new release
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'll remove it. I was following the instructions in Bundler's documentation for submitting pull requests:
Don't forget to add your changes into the CHANGELOG! If you're submitting documentation, note the changes under the "Documentation" heading.
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.
@mattbrictson thanks for catching this! we automated the changelog since those docs were written. We'll update it. :)
The `bundler` gem does not participate in the lockfile, but it can still be included in the list of dependencies that are being updated by `bundle update` if `--group` is specified. For example, if a Gemfile contains `bundler-audit` (which depends on `bundler`) in the `:development` group, then updating with the option `--group=development` will naturally include `bundler` in the list of gems to evaluate for updating. The trouble is that since `bundler` is excluded from the lockfile, searching the locked gems for a gemspec for bundler will return `nil`. This caused the following error during `bundle update`: NoMethodError: undefined method `version' for nil:NilClass This commit solves this bug by skipping over gems (i.e `bundler`) that are not in the lockfile when comparing gem versions at the conclusion of the upgrade command.
d07da81
to
d403790
Compare
Amended to remove CHANGELOG entry. |
@bundlerbot r+ |
📌 Commit d403790 has been approved by |
…oup, r=indirect Fix NoMethodError during `bundle update --group` ### What was the end-user problem that led to this PR? #6156: NoMethodError: undefined method `version' for nil:NilClass ### What was your diagnosis of the problem? The `bundler` gem does not participate in the lockfile, but it can still be included in the list of dependencies that are being updated by `bundle update` if `--group` is specified. For example, if a Gemfile contains `bundler-audit` (which depends on `bundler`) in the `:development` group, then updating with the option `--group=development` will naturally include `bundler` in the list of gems to evaluate for updating. The trouble is that since `bundler` is excluded from the lockfile, searching the locked gems for a gemspec for bundler will return `nil`. This caused the following error during `bundle update`: NoMethodError: undefined method `version' for nil:NilClass ### What is your fix for the problem, implemented in this PR? This PR solves this bug by skipping over gems (i.e `bundler`) that are not in the lockfile when comparing gem versions at the conclusion of the upgrade command. Fixes #6156. ### Why did you choose this fix out of the possible options? I chose this fix because the bug seems to have been introduced by 618c09b. My fix takes place within the new feature that was added in that commit, so it seems safe and unlikely to have side-effects.
☀️ Test successful - status-travis |
Stop requesting changelogs in PRs We added this requirement before the changelog was automated. Now that the changelog generated by a script, it's not helpful for PRs to update the changelog anymore, so we shouldn't expect it anymore. ### What was the end-user problem that led to this PR? We had to [ask a PR to remove a changelog entry](#6157 (comment)), even though the PR was following [the docs](https://github.com/bundler/bundler/blob/374caf6ede2cf4de7d2196aa2e2adef782bea5bd/doc/development/PULL_REQUESTS.md#changelogmd). ### What was your diagnosis of the problem? It looks like we failed to update the docs when we automated generating the changelog. ### What is your fix for the problem, implemented in this PR? Removing the changelog requirement from the docs hopefully means that future PRs will not include changelog entries, and we can generate future changelogs automatically. ### Why did you choose this fix out of the possible options? I chose this fix because it seemed like the smallest change that would accomplish the goal. /cc @mattbrictson
…pdate-group, r=indirect Fix NoMethodError during `bundle update --group` ### What was the end-user problem that led to this PR? rubygems#6156: NoMethodError: undefined method `version' for nil:NilClass ### What was your diagnosis of the problem? The `bundler` gem does not participate in the lockfile, but it can still be included in the list of dependencies that are being updated by `bundle update` if `--group` is specified. For example, if a Gemfile contains `bundler-audit` (which depends on `bundler`) in the `:development` group, then updating with the option `--group=development` will naturally include `bundler` in the list of gems to evaluate for updating. The trouble is that since `bundler` is excluded from the lockfile, searching the locked gems for a gemspec for bundler will return `nil`. This caused the following error during `bundle update`: NoMethodError: undefined method `version' for nil:NilClass ### What is your fix for the problem, implemented in this PR? This PR solves this bug by skipping over gems (i.e `bundler`) that are not in the lockfile when comparing gem versions at the conclusion of the upgrade command. Fixes rubygems#6156. ### Why did you choose this fix out of the possible options? I chose this fix because the bug seems to have been introduced by 618c09b. My fix takes place within the new feature that was added in that commit, so it seems safe and unlikely to have side-effects.
What was the end-user problem that led to this PR?
#6156: NoMethodError: undefined method `version' for nil:NilClass
What was your diagnosis of the problem?
The
bundler
gem does not participate in the lockfile, but it can still be included in the list of dependencies that are being updated bybundle update
if--group
is specified.For example, if a Gemfile contains
bundler-audit
(which depends onbundler
) in the:development
group, then updating with the option--group=development
will naturally includebundler
in the list of gems to evaluate for updating.The trouble is that since
bundler
is excluded from the lockfile, searching the locked gems for a gemspec for bundler will returnnil
. This caused the following error duringbundle update
:What is your fix for the problem, implemented in this PR?
This PR solves this bug by skipping over gems (i.e
bundler
) that are not in the lockfile when comparing gem versions at the conclusion of the upgrade command.Fixes #6156.
Why did you choose this fix out of the possible options?
I chose this fix because the bug seems to have been introduced by 618c09b. My fix takes place within the new feature that was added in that commit, so it seems safe and unlikely to have side-effects.