mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Tweak library load path insertion to be as early as possible
This commit is contained in:
parent
3d443e2ed3
commit
ec0434c549
@ -202,8 +202,10 @@ Performance/MethodObjectAsBlock:
|
||||
Rails:
|
||||
# Selectively enable what we want.
|
||||
Enabled: false
|
||||
# Do not use ActiveSupport in RuboCops.
|
||||
Exclude:
|
||||
# This file is loaded before any extra methods are defined.
|
||||
- "Homebrew/standalone/init.rb"
|
||||
# Do not use ActiveSupport in RuboCops.
|
||||
- "Homebrew/rubocops/**/*"
|
||||
|
||||
# These relate to ActiveSupport and not other parts of Rails.
|
||||
|
@ -39,7 +39,13 @@ if !gems_vendored && !ENV["HOMEBREW_SKIP_INITIAL_GEM_INSTALL"]
|
||||
ENV["HOMEBREW_SKIP_INITIAL_GEM_INSTALL"] = "1"
|
||||
end
|
||||
|
||||
$LOAD_PATH.unshift HOMEBREW_LIBRARY_PATH.to_s unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
||||
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
||||
# Insert the path after any existing Homebrew paths (e.g. those inserted by tests and parent processes)
|
||||
last_homebrew_path_idx = $LOAD_PATH.rindex do |path|
|
||||
path.start_with?(HOMEBREW_LIBRARY_PATH.to_s) && !path.include?("vendor/portable-ruby")
|
||||
end || -1
|
||||
$LOAD_PATH.insert(last_homebrew_path_idx + 1, HOMEBREW_LIBRARY_PATH.to_s)
|
||||
end
|
||||
require_relative "../vendor/bundle/bundler/setup"
|
||||
$LOAD_PATH.unshift "#{HOMEBREW_LIBRARY_PATH}/vendor/bundle/#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/" \
|
||||
"bundler-#{Homebrew::HOMEBREW_BUNDLER_VERSION}/lib"
|
||||
|
@ -33,7 +33,7 @@ require "find"
|
||||
require "byebug"
|
||||
require "timeout"
|
||||
|
||||
$LOAD_PATH.push(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib"))
|
||||
$LOAD_PATH.unshift(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib"))
|
||||
|
||||
require_relative "../global"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user