From 2ca8172fe9f1aba5188fc4ab164b34d5def607c9 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 28 Apr 2015 22:37:27 -0400 Subject: [PATCH] Let the test environment inject its own load path --- Library/Homebrew/cmd/postinstall.rb | 2 +- Library/Homebrew/cmd/test.rb | 2 +- Library/Homebrew/config.rb | 6 ++++++ Library/Homebrew/formula_installer.rb | 2 +- Library/Homebrew/test/lib/config.rb | 2 ++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index b92eb40df0..9009803559 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -9,7 +9,7 @@ module Homebrew args = %W[ nice #{RUBY_PATH} -W0 - -I #{HOMEBREW_LIBRARY_PATH} + -I #{HOMEBREW_LOAD_PATH} -- #{HOMEBREW_LIBRARY_PATH}/postinstall.rb #{formula.path} diff --git a/Library/Homebrew/cmd/test.rb b/Library/Homebrew/cmd/test.rb index 17ad7c220d..7430f69838 100644 --- a/Library/Homebrew/cmd/test.rb +++ b/Library/Homebrew/cmd/test.rb @@ -29,7 +29,7 @@ module Homebrew args = %W[ #{RUBY_PATH} -W0 - -I #{HOMEBREW_LIBRARY_PATH} + -I #{HOMEBREW_LOAD_PATH} -- #{HOMEBREW_LIBRARY_PATH}/test.rb #{f.path} diff --git a/Library/Homebrew/config.rb b/Library/Homebrew/config.rb index 505c49c6ec..294e32db20 100644 --- a/Library/Homebrew/config.rb +++ b/Library/Homebrew/config.rb @@ -50,3 +50,9 @@ end HOMEBREW_LOGS = Pathname.new(ENV['HOMEBREW_LOGS'] || '~/Library/Logs/Homebrew/').expand_path HOMEBREW_TEMP = Pathname.new(ENV.fetch('HOMEBREW_TEMP', '/tmp')) + +if not defined? HOMEBREW_LIBRARY_PATH + HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent.join("Homebrew") +end + +HOMEBREW_LOAD_PATH = HOMEBREW_LIBRARY_PATH diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 6271c08c1e..ee6627ba08 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -472,7 +472,7 @@ class FormulaInstaller args = %W[ nice #{RUBY_PATH} -W0 - -I #{HOMEBREW_LIBRARY_PATH} + -I #{HOMEBREW_LOAD_PATH} -- #{HOMEBREW_LIBRARY_PATH}/build.rb #{formula.path} diff --git a/Library/Homebrew/test/lib/config.rb b/Library/Homebrew/test/lib/config.rb index 919dfeaafd..af42adb582 100644 --- a/Library/Homebrew/test/lib/config.rb +++ b/Library/Homebrew/test/lib/config.rb @@ -11,6 +11,8 @@ TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") { |k| HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix") HOMEBREW_REPOSITORY = HOMEBREW_PREFIX HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+"Library" +HOMEBREW_LIBRARY_PATH = File.expand_path("../../..", __FILE__) +HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":") HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+"cache" HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+"formula_cache" HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+"cellar"