summaryrefslogtreecommitdiff
path: root/lib/bundler/settings.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-04 17:01:19 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-19 21:09:12 +0900
commitcf9a2883fea3c28c8d869c72b1b407162a28e0b3 (patch)
tree99789b969cc63394e49ca145be3f456c339cb12f /lib/bundler/settings.rb
parente107f3f4cb2e11ef6fd46db21392a22fdab4eb2a (diff)
downloadbundler-cf9a2883fea3c28c8d869c72b1b407162a28e0b3.tar.gz
Prefer `require_relative` for internal requires
Due to the way rubygems monkey-patched require interacts with default gems, and given that bundler is a default gem, and that bundler manipulates the LOAD_PATH in very intricated ways, we can reduce the risk of "leaking" to a different copy of `bundler` by using `require_relative` for internal requires.
Diffstat (limited to 'lib/bundler/settings.rb')
-rw-r--r--lib/bundler/settings.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index d21789dba1..2d0c4174ae 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -357,7 +357,7 @@ module Bundler
return unless file
SharedHelpers.filesystem_access(file) do |p|
FileUtils.mkdir_p(p.dirname)
- require "bundler/yaml_serializer"
+ require_relative "yaml_serializer"
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
end
end
@@ -397,7 +397,7 @@ module Bundler
SharedHelpers.filesystem_access(config_file, :read) do |file|
valid_file = file.exist? && !file.size.zero?
return {} unless valid_file
- require "bundler/yaml_serializer"
+ require_relative "yaml_serializer"
YAMLSerializer.load file.read
end
end