From 1ceaa2ebd37365a15a1b750718d1f105bf124ad5 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 19 Jul 2021 20:02:29 +0800 Subject: [PATCH] formula: add `:default_prefix` as a standard `pour_bottle?` requirement See discussion at Homebrew/homebrew-core#81408. --- Library/Homebrew/formula.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 8e76ee97e8..e72c53fdc7 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -3016,6 +3016,15 @@ class Formula T.cast(self, PourBottleCheck).satisfy { MacOS::CLT.installed? } end end + when :default_prefix + lambda do |_| + on_macos do + T.cast(self, PourBottleCheck).reason(+<<~EOS) + The bottle needs to be installed into #{Homebrew::DEFAULT_PREFIX}. + EOS + T.cast(self, PourBottleCheck).satisfy { HOMEBREW_PREFIX.to_s == Homebrew::DEFAULT_PREFIX } + end + end else raise ArgumentError, "Invalid preset `pour_bottle?` condition" if only_if.present? end