Skip to content
Snippets Groups Projects
Commit 584ea845 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #2547 from MikeMcQuaid/improve-install-upgrade-message

formula_installer: improve install/upgrade message
parents a3b6cbe2 18c2713d
No related branches found
No related tags found
No related merge requests found
......@@ -217,11 +217,20 @@ class FormulaInstaller
# function but after instantiating this class so that it can avoid having to
# relink the active keg if possible (because it is slow).
if formula.linked_keg.directory?
# some other version is already installed *and* linked
raise CannotInstallFormulaError, <<-EOS.undent
#{formula.name}-#{formula.linked_keg.resolved_path.basename} already installed
To install this version, first `brew unlink #{formula.name}`
message = <<-EOS.undent
#{formula.name} #{formula.linked_keg.resolved_path.basename} is already installed
EOS
message += if formula.outdated? && !formula.head?
<<-EOS.undent
To upgrade to #{formula.version}, run `brew upgrade #{formula.name}`
EOS
else
# some other version is already installed *and* linked
<<-EOS.undent
To install #{formula.version}, first run `brew unlink #{formula.name}`
EOS
end
raise CannotInstallFormulaError, message
end
check_conflicts
......
......@@ -77,7 +77,7 @@ describe "brew install", :integration_test do
EOS
expect { brew "install", "testball1" }
.to output(/first `brew unlink testball1`/).to_stderr
.to output(/`brew upgrade testball1`/).to_stderr
.and not_to_output.to_stdout
.and be_a_failure
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment