From 42e34db562445ef9f666b08b6b30effeb3220c76 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 7 Jun 2018 16:50:09 +0200 Subject: [PATCH] Always add `cask/lib` to `$LOAD_PATH`. --- Library/Homebrew/brew.rb | 4 ++++ Library/Homebrew/cmd/cask.rb | 1 - Library/Homebrew/dev-cmd/irb.rb | 1 - Library/Homebrew/test/spec_helper.rb | 1 + .../test/support/helper/spec/shared_context/homebrew_cask.rb | 2 -- .../support/helper/spec/shared_context/integration_test.rb | 1 + 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 0abb8d37b1..42ac131e14 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -20,6 +20,10 @@ unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) $LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s) end +unless $LOAD_PATH.include?("#{HOMEBREW_LIBRARY_PATH}/cask/lib") + $LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib") +end + require "global" begin diff --git a/Library/Homebrew/cmd/cask.rb b/Library/Homebrew/cmd/cask.rb index 550081d46d..b07e681deb 100644 --- a/Library/Homebrew/cmd/cask.rb +++ b/Library/Homebrew/cmd/cask.rb @@ -1,4 +1,3 @@ -$LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib") require "hbc" module Homebrew diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index 2c5afe5a1e..97a0045826 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -47,7 +47,6 @@ module Homebrew require "formula" require "keg" - $LOAD_PATH.unshift("#{HOMEBREW_LIBRARY_PATH}/cask/lib") require "hbc" ohai "Interactive Homebrew Shell" diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index daf5e1a3df..a09afa11b6 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -15,6 +15,7 @@ require "rubocop/rspec/support" require "find" $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew")) +$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/cask/lib")) $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/support/lib")) require "global" diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index 4a58fbf5a9..6160538bfb 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -1,5 +1,3 @@ -$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s) - require "hbc" require "test/support/helper/cask/fake_system_command" 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 a92c27fc49..41d7174cc3 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 @@ -85,6 +85,7 @@ RSpec.shared_context "integration test" do "-W0", "-I", "#{HOMEBREW_LIBRARY_PATH}/test/support/lib", "-I", HOMEBREW_LIBRARY_PATH.to_s, + "-I", "#{HOMEBREW_LIBRARY_PATH}/cask/lib", "-rconfig" ] if ENV["HOMEBREW_TESTS_COVERAGE"]