diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index d5c9730fb0..5c48a94191 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2920,16 +2920,16 @@ class Formula # the {Formula} will be built from source and `reason` will be printed. # # Alternatively, a preset reason can be passed as a symbol: - #
pour_bottle? reason: :clt_required- def pour_bottle?(reason: nil, &block) + #
pour_bottle? requirement: :clt+ def pour_bottle?(requirement: nil, &block) @pour_bottle_check = PourBottleCheck.new(self) - if reason.present? && block.present? - raise ArgumentError, "Do not pass both a reason and a block to `pour_bottle?`" + if requirement.present? && block.present? + raise ArgumentError, "Do not pass both a requirement and a block to `pour_bottle?`" end - block ||= case reason - when :clt_required + block ||= case requirement + when :clt lambda do |_| on_macos do T.cast(self, PourBottleCheck).reason(+<<~EOS) @@ -2941,7 +2941,7 @@ class Formula end end else - raise ArgumentError, "Invalid `pour_bottle?` reason" if reason.present? + raise ArgumentError, "Invalid `pour_bottle?` requirement" if requirement.present? end @pour_bottle_check.instance_eval(&block) diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb index 79f484096e..8de34b5a92 100644 --- a/Library/Homebrew/test/formula_spec.rb +++ b/Library/Homebrew/test/formula_spec.rb @@ -996,37 +996,37 @@ describe Formula do expect(f).to pour_bottle end - it "returns false with `reason: :clt_required` on macOS", :needs_macos do + it "returns false with `requirement: :clt` on macOS", :needs_macos do # Pretend CLT is not installed allow(MacOS::CLT).to receive(:installed?).and_return(false) f = formula "foo" do url "foo-1.0" - pour_bottle? reason: :clt_required + pour_bottle? requirement: :clt end expect(f).not_to pour_bottle end - it "returns true with `reason: :clt_required` on macOS", :needs_macos do + it "returns true with `requirement: :clt` on macOS", :needs_macos do # Pretend CLT is installed allow(MacOS::CLT).to receive(:installed?).and_return(true) f = formula "foo" do url "foo-1.0" - pour_bottle? reason: :clt_required + pour_bottle? requirement: :clt end expect(f).to pour_bottle end - it "returns true with `reason: :clt_required` on Linux", :needs_linux do + it "returns true with `requirement: :clt` on Linux", :needs_linux do f = formula "foo" do url "foo-1.0" - pour_bottle? reason: :clt_required + pour_bottle? requirement: :clt end expect(f).to pour_bottle @@ -1037,12 +1037,12 @@ describe Formula do formula "foo" do url "foo-1.0" - pour_bottle? reason: :clt_required do + pour_bottle? requirement: :clt do reason "true reason" satisfy { true } end end - end.to raise_error(ArgumentError, "Do not pass both a reason and a block to `pour_bottle?`") + end.to raise_error(ArgumentError, "Do not pass both a requirement and a block to `pour_bottle?`") end it "throws an error if passed an invalid symbol" do @@ -1050,9 +1050,9 @@ describe Formula do formula "foo" do url "foo-1.0" - pour_bottle? reason: :foo + pour_bottle? requirement: :foo end - end.to raise_error(ArgumentError, "Invalid `pour_bottle?` reason") + end.to raise_error(ArgumentError, "Invalid `pour_bottle?` requirement") end end