Don't lie about upgrading up-to-date formulae

Usually, the "foo-version already installed" error is printed by
FormulaInstaller. However, if an up-to-date formula that has outdated
deps is passed on the command line, we proceed to upgrade the deps and
then print a message saying that the formulae given on the command line
is already installed.

Catch this earlier, when the outdated list is being populated, print an
appropriate message, and skip the up-to-date formula.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-08-18 18:37:32 -05:00
parent 93f7a0fa85
commit c6b3cd7cf4
3 changed files with 9 additions and 3 deletions

View File

@ -21,7 +21,9 @@ module Homebrew extend self
Homebrew.outdated_brews
else
ARGV.formulae.select do |f|
unless f.rack.exist? and not f.rack.children.empty?
if f.installed?
onoe "#{f}-#{f.installed_version} already installed"
elsif not f.rack.exist? or f.rack.children.empty?
onoe "#{f} not installed"
else
true

View File

@ -105,6 +105,11 @@ class Formula
end
end
def installed_version
require 'keg'
Keg.new(installed_prefix).version
end
def prefix
validate_variable :name
validate_variable :version

View File

@ -24,8 +24,7 @@ class FormulaInstaller
def check_install_sanity
if f.installed?
keg = Keg.new(f.installed_prefix)
raise CannotInstallFormulaError, "#{f}-#{keg.version} already installed"
raise CannotInstallFormulaError, "#{f}-#{f.installed_version} already installed"
end
# Building head-only without --HEAD is an error