brew.*: run Bundler immediately when needed.

This is needed to avoid gem conflicts when `global.rb` is loaded for some commands.
This commit is contained in:
Mike McQuaid 2019-02-20 12:29:31 +00:00
parent 4f76d12874
commit b3c33d6d51
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
2 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,12 @@ if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 3)
raise "Homebrew must be run under Ruby 2.3! You're running #{RUBY_VERSION}." raise "Homebrew must be run under Ruby 2.3! You're running #{RUBY_VERSION}."
end end
# Load Bundler first of all if it's needed to avoid Gem version conflicts.
if ENV["HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST"]
require_relative "utils/gems"
Homebrew.install_bundler_gems!
end
# Also define here so we can rescue regardless of location. # Also define here so we can rescue regardless of location.
class MissingEnvironmentVariables < RuntimeError; end class MissingEnvironmentVariables < RuntimeError; end

View File

@ -309,6 +309,11 @@ then
esac esac
fi fi
if [[ "$HOMEBREW_COMMAND" = "audit" || "$HOMEBREW_COMMAND" = "style" ]]
then
export HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST="1"
fi
# Set HOMEBREW_DEV_CMD_RUN for users who have run a development command. # Set HOMEBREW_DEV_CMD_RUN for users who have run a development command.
# This makes them behave like HOMEBREW_DEVELOPERs for brew update. # This makes them behave like HOMEBREW_DEVELOPERs for brew update.
if [[ -z "$HOMEBREW_DEVELOPER" ]] if [[ -z "$HOMEBREW_DEVELOPER" ]]