diff options
| author | Max Howell | 2012-03-16 11:55:30 +0000 |
|---|---|---|
| committer | Max Howell | 2012-03-16 21:06:17 +0000 |
| commit | b52085b00fae6da1df0d6ff74168f14fe9cbba66 (patch) | |
| tree | b19a5210044ec9331f350451ff386808f9ccddfd /Library | |
| parent | 0364fef0a36a52b40f53a31a654b9e887460af7a (diff) | |
| download | homebrew-b52085b00fae6da1df0d6ff74168f14fe9cbba66.tar.bz2 | |
Tell the user to tap (if req.) for tapped deps
Also propagate dependency info through exception if possible so the error message is more useful.
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 |
