diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 16 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 6 |
2 files changed, 21 insertions, 1 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 0d55336d1..f577ecae5 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -24,10 +24,24 @@ end class FormulaUnavailableError < RuntimeError attr :name + attr :dependent, true + + def dependent_s + "(dependency of #{dependent})" if dependent and dependent != name + end + + def to_s + if name =~ %r{(\w+)/(\w+)/(\w+)} then <<-EOS.undent + No available formula for #$3 #{dependent_s} + Please tap it and then try again: brew tap #$1/#$2 + EOS + else + "No available formula for #{name} #{dependent_s}" + end + end def initialize name @name = name - super "No available formula for #{name}" end end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 96dae5bac..76618ad0c 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -44,6 +44,12 @@ class FormulaInstaller raise CannotInstallFormulaError, "You must `brew link #{dep}' before #{f} can be installed" end end unless ignore_deps + + rescue FormulaUnavailableError => e + # this is sometimes wrong if the dependency chain is more than one deep + # but can't easily fix this without a rewrite FIXME-brew2 + e.dependent = f.name + raise end def install |
