aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_support.rb
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-10-23 10:41:39 +0200
committerXu Cheng2015-10-23 19:44:19 +0800
commit774a508d1ac9e8be8a2d3cc3a753d513e1b962e3 (patch)
tree5aed9b178c9ab62fa4c468b2928cc700106bf589 /Library/Homebrew/formula_support.rb
parentd6bf2f57493f2a94ecce9f07c8a0505a8f29e70a (diff)
downloadbrew-774a508d1ac9e8be8a2d3cc3a753d513e1b962e3.tar.bz2
audit: warn about unknown bottle modifiers
This prevents typos like `bottle :uneeded` or `bottle :disable` Closes Homebrew/homebrew#45264. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/formula_support.rb')
-rw-r--r--Library/Homebrew/formula_support.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb
index c76ed39f3..3d7f347b9 100644
--- a/Library/Homebrew/formula_support.rb
+++ b/Library/Homebrew/formula_support.rb
@@ -58,6 +58,8 @@ end
# Used to annotate formulae that don't require compiling or cannot build bottle.
class BottleDisableReason
+ SUPPORTED_TYPES = [:unneeded, :disabled]
+
def initialize(type, reason)
@type = type
@reason = reason
@@ -67,6 +69,10 @@ class BottleDisableReason
@type == :unneeded
end
+ def valid?
+ SUPPORTED_TYPES.include? @type
+ end
+
def to_s
if @type == :unneeded
"This formula doesn't require compiling."