summaryrefslogtreecommitdiff
path: root/config/bundler_setup.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /config/bundler_setup.rb
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'config/bundler_setup.rb')
-rw-r--r--config/bundler_setup.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/config/bundler_setup.rb b/config/bundler_setup.rb
new file mode 100644
index 00000000000..7cb80836f88
--- /dev/null
+++ b/config/bundler_setup.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+# Instead of requiring 'bundle/setup' directly, we need the following
+# to make bundler more consistent when it comes to loading from
+# bundler config. See the following links for more context:
+# https://gitlab.com/gitlab-org/gitlab/-/issues/339939
+# https://github.com/rubygems/rubygems/pull/4892
+# https://github.com/rubygems/rubygems/issues/3363
+require 'bundler'
+ENV['BUNDLE_GEMFILE'] ||= Bundler.settings[:gemfile] || File.expand_path('../Gemfile', __dir__)
+Bundler::SharedHelpers.set_env('BUNDLE_GEMFILE', ENV['BUNDLE_GEMFILE'])
+
+if Bundler.respond_to?(:reset_settings_and_root!)
+ Bundler.reset_settings_and_root!
+else
+ # Bundler 2.1.4 does not have this method. Do the same as Bundler 2.2.26
+ # https://github.com/rubygems/rubygems/blob/bundler-v2.2.26/bundler/lib/bundler.rb#L612-L615
+ Bundler.instance_eval do
+ @settings = nil
+ @root = nil
+ end
+end
+
+require 'bundler/setup'