From 4265540cc41959c4bf5d68cd5e9f046b8aa79cc5 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Wed, 1 Apr 2020 10:23:18 +0100 Subject: [PATCH] load_path: trim entries where possible to fix Ruby crashes --- Library/Homebrew/load_path.rb | 5 ++++- .../support/helper/spec/shared_context/integration_test.rb | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/load_path.rb b/Library/Homebrew/load_path.rb index c3eb983565..ea9f8a2306 100644 --- a/Library/Homebrew/load_path.rb +++ b/Library/Homebrew/load_path.rb @@ -4,6 +4,9 @@ require "pathname" HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath.freeze -$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) +$LOAD_PATH.push HOMEBREW_LIBRARY_PATH.to_s require "vendor/bundle/bundler/setup" + +$LOAD_PATH.select! { |d| Pathname(d).directory? } +$LOAD_PATH.uniq! diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index c5adb08b86..0a28b8b558 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -9,11 +9,6 @@ RSpec::Matchers.define_negated_matcher :be_a_failure, :be_a_success RSpec.shared_context "integration test" do extend RSpec::Matchers::DSL - if OS.mac? && - !RUBY_BIN.to_s.match?(%r{^/(System/Library/Frameworks/Ruby\.framework/Versions/(Current|\d+\.\d+)/)usr/bin$}) - skip "integration test requires system Ruby" - end - matcher :be_a_success do match do |actual| status = actual.is_a?(Proc) ? actual.call : actual