2014-03-31 13:15:07 -05:00
|
|
|
# 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
|
2015-08-03 13:09:07 +01:00
|
|
|
def self.setup_formula_has_bottle(&block)
|
2014-03-31 13:15:07 -05:00
|
|
|
@has_bottle = block
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
def self.setup_pour_formula_bottle(&block)
|
2014-03-31 13:15:07 -05:00
|
|
|
@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
|
2014-10-29 23:49:52 -05:00
|
|
|
|
|
|
|
def self.reset_hooks
|
|
|
|
@has_bottle = @pour_bottle = nil
|
|
|
|
end
|
2014-03-31 13:15:07 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|