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.
This commit is contained in:
parent
15f3e9ea77
commit
3d5b4af523
@ -24,10 +24,24 @@ end
|
|||||||
|
|
||||||
class FormulaUnavailableError < RuntimeError
|
class FormulaUnavailableError < RuntimeError
|
||||||
attr :name
|
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
|
def initialize name
|
||||||
@name = name
|
@name = name
|
||||||
super "No available formula for #{name}"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,12 @@ class FormulaInstaller
|
|||||||
raise CannotInstallFormulaError, "You must `brew link #{dep}' before #{f} can be installed"
|
raise CannotInstallFormulaError, "You must `brew link #{dep}' before #{f} can be installed"
|
||||||
end
|
end
|
||||||
end unless ignore_deps
|
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
|
end
|
||||||
|
|
||||||
def install
|
def install
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user