aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/hooks
diff options
context:
space:
mode:
authorMike McQuaid2014-03-31 13:15:07 -0500
committerMike McQuaid2014-04-10 15:25:30 +0100
commite2fbfc83901fbd885c7a1cc1f471b0f3fe071c15 (patch)
tree96cf7127ed6ce2601f700d1819948647586ec05d /Library/Homebrew/hooks
parentd6c9528e5946024486bdd7b68c6453cf3ba39018 (diff)
downloadbrew-e2fbfc83901fbd885c7a1cc1f471b0f3fe071c15.tar.bz2
Add hooks for pouring bottles.
This should give us a bit of control over what e.g. Boxen are doing whilst at the same time stopping us from accidentally breaking each other's stuff every so often. I'm aware this may be somewhat controversial so I'm open to other approaches.
Diffstat (limited to 'Library/Homebrew/hooks')
-rw-r--r--Library/Homebrew/hooks/bottles.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/Library/Homebrew/hooks/bottles.rb b/Library/Homebrew/hooks/bottles.rb
new file mode 100644
index 000000000..de321c09a
--- /dev/null
+++ b/Library/Homebrew/hooks/bottles.rb
@@ -0,0 +1,31 @@
+# Boxen (and perhaps others) want to override our bottling infrastructure so
+# they can avoid declaring checksums in formulae files.
+# Instead of periodically breaking their monkeypatches let's add some hooks that
+# we can query to allow their own behaviour.
+
+# PLEASE DO NOT EVER RENAME THIS CLASS OR ADD/REMOVE METHOD ARGUMENTS!
+module Homebrew
+ module Hooks
+ module Bottles
+ def self.setup_formula_has_bottle &block
+ @has_bottle = block
+ true
+ end
+
+ def self.setup_pour_formula_bottle &block
+ @pour_bottle = block
+ true
+ end
+
+ def self.formula_has_bottle?(formula)
+ return false unless @has_bottle
+ @has_bottle.call formula
+ end
+
+ def self.pour_formula_bottle(formula)
+ return false unless @pour_bottle
+ @pour_bottle.call formula
+ end
+ end
+ end
+end