Commit c6e9a0f8 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-bundler-setup' into 'master'

Reset bundler settings after locating Gemfile

See merge request gitlab-org/gitlab!69770
parents 11900284 545f3a4f
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'bundler' require_relative '../config/bundler_setup'
ENV['BUNDLE_GEMFILE'] ||=
Bundler.settings[:gemfile] || File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle') load Gem.bin_path('bundler', 'bundle')
# frozen_string_literal: true # frozen_string_literal: true
require 'bundler' require_relative 'bundler_setup'
ENV['BUNDLE_GEMFILE'] ||=
Bundler.settings[:gemfile] || File.expand_path('../Gemfile', __dir__)
# Set up gems listed in the Gemfile.
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require 'bootsnap/setup' if ENV['RAILS_ENV'] != 'production' || %w(1 yes true).include?(ENV['ENABLE_BOOTSNAP']) require 'bootsnap/setup' if ENV['RAILS_ENV'] != 'production' || %w(1 yes true).include?(ENV['ENABLE_BOOTSNAP'])
# frozen_string_literal: true # 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' require 'bundler'
ENV['BUNDLE_GEMFILE'] ||= Bundler.settings[:gemfile] 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' require 'bundler/setup'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment