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

Remove more custom bundler logic and reload the bundler runtime for each app #392

Merged
merged 4 commits into from
Sep 6, 2021

Conversation

jonabc
Copy link
Contributor

@jonabc jonabc commented Sep 4, 2021

closes #362

This change primarily looks to fix the linked issue, which is done by reloading the bundler runtime with ::Bundler.load after resetting bundler's configuration with ::Bundler.reset!. This should force bundler to look at the current directory's gem and lock files in determining things like available platforms.

I found that with this change, Bundler acted like licensed was being run from the context of the project being evaluated. This allowed me to further pare down much of the custom logic that had been built up on the bundler source enumerator over time. The bundler source has been a love/hate relationship but I'm finding now that the best option usually involves not trying to override Bundler's behavior, or when necessary making very targeted functionality changes.

This PR does include such changes, in that it monkey patches ::Bundler::Definition#specs and ::Bundler::Definition.requested_groups. This simplifies the logic that had been built around managing which specs were or were not evaluated by licensed. With the monkey patch it's become easier to make targeted changes to behavior due to operating in the context of the definition object and having direct access to private methods

This removes more custom logic from the bundler
source, and relies more on bundler internals to
the appropriate files

There are two significant changes here
1. Using ::Bundler.load after ::Bundler.reset!
   reconfigures the local bundler runtime.  This
   forces bundler to pick up any changes to the
   available platforms
2. Monkeypatching ::Bundler::Definition in order
   to remove as much custom logic as possible.  As
   bundler changes, it's become increasingly brittle
   to use custom behaviors outside of how Bundler
   normally operates.  This move is intended to focus
   the source more on configuring Bundler to operate
   over multiple directories similar to how Bundler
   configures RubyGems to operate over multiple
   projects.
@tommeier
Copy link

tommeier commented Sep 6, 2021

Fixes it perfectly!! Thank you!! 😍

👍

@jonabc jonabc merged commit 8754a56 into master Sep 6, 2021
@jonabc jonabc deleted the reload-bundler-runtime branch September 6, 2021 17:38
jonabc added a commit that referenced this pull request Sep 6, 2021
## 3.2.1

2021-09-06

### Changed

- Updated multiple dependency versions (:tada: @mmorel-35 #385, #389)
- Go homepage links use pkg.go.dev instead of godoc.org (:tada: @mmorel-35 73cfbbe)
- Local development ruby version changed to 2.7.4 (#393)

### Fixed

- Bundler source correctly finds platform specific dependencies (#392)
@jonabc jonabc mentioned this pull request Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Could not find nokogiri (1.11.4) in any sources
2 participants