Better message if multiple kegs need linking

This commit is contained in:
Max Howell 2012-08-19 17:36:10 -04:00
parent 9274f7cda1
commit 4e7bb6c637

View File

@ -40,12 +40,13 @@ class FormulaInstaller
raise CannotInstallFormulaError, "No head is defined for #{f.name}"
end
f.recursive_deps.each do |dep|
if dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
raise CannotInstallFormulaError,
"You must `brew link #{dep}' before #{f} can be installed"
unless ignore_deps
unlinked_deps = f.recursive_deps.select do |dep|
dep.installed? and not dep.keg_only? and not dep.linked_keg.directory?
end
raise CannotInstallFormulaError,
"You must `brew link #{unlinked_deps*' '}' before #{f} can be installed" unless unlinked_deps.empty?
end
end unless ignore_deps
rescue FormulaUnavailableError => e
# this is sometimes wrong if the dependency chain is more than one deep