From e52d6dba790f7066154dade40a46bdb07d2fcf5e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 30 Jul 2018 09:16:53 +0100 Subject: [PATCH] formula: handle unavailable versioned formulae. If people decide to copy these into their Homebrew/homebrew-core `Formula` directory then it breaks generating the hash for any non-versioned formulae. See https://github.com/Homebrew/homebrew-bundle/issues/351 --- Library/Homebrew/formula.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 8cd37083b4..495c5483f3 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -385,8 +385,12 @@ class Formula return [] if versioned_formula? Pathname.glob(path.to_s.gsub(/\.rb$/, "@*.rb")).map do |path| - Formula[path.basename(".rb").to_s] - end.sort + begin + Formula[path.basename(".rb").to_s] + rescue FormulaUnavailableError + nil + end + end.compact.sort end # A named Resource for the currently active {SoftwareSpec}.