-
Notifications
You must be signed in to change notification settings - Fork 122
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
[Bundler] Don't use Bundler.default_*file to find gem file and lock file #27
Conversation
Using these methods has undesirable effects - raises an error if a file can't be found - `ENV["BUNDLE_GEMFILE"]` overrides file search - potential mismatch in gem file name
# block. we shouldn't need to restore these values manually | ||
BUNDLER_ENV_KEYS.each { |k| ENV.delete(k) } | ||
# force bundler to use the local gem file | ||
ENV["BUNDLE_GEMFILE"] = gemfile_path.to_s |
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.
@jonabc Should this ENV
var be unset in the ensure
block below? Otherwise this method that takes a block leaks that environment variable?
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.
@dbussink It's not necessary and won't leak because ::Bundler.with_original_env
captures and restores the full ENV
object itself.
👍 to restoring the ENV
var in the ensure
block to be more explicit and avoid confusion though.
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.
Ah, thanks! Yeah, explicitly doing it is nice I think.
test/source/bundler_test.rb
Outdated
@@ -1,13 +1,22 @@ | |||
# frozen_string_literal: true | |||
require "test_helper" | |||
require "tmpdir" | |||
require "byebug" |
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.
You left byebug in here 😄
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.
🤦♂️ 🙇
make some implicit functionality explicit
Fixes #23
Fixes #24
Fixing a couple issues where
::Bundler.default_*file
does not behave ideally for usage in licensedENV["BUNDLE_GEMFILE"]
over searching for a gem file in the local file hierarchyENV["BUNDLE_GEMFILE"]
doesn't match the name of the file in the configured app source path (gems.rb vs Gemfile)Bundler::SharedHelpers::find_gemfile
The downside is that now the source has to either keep track of the possible gem file names itself or call the private
Bundler::SharedHelpers::gemfile_names
. This PR opts to keep track of the file names locally so that licensed doesn't take a dependency on a private method that could change without notice.