aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-08-18 18:37:32 -0500
committerJack Nagel2012-08-18 19:33:39 -0500
commitc6b3cd7cf454d542f0d713472a4cea73746d57a2 (patch)
treec8a670acc703f767587ff37ed2389c9b68544745 /Library
parent93f7a0fa85a7dc61af8633747cff734dfffecb98 (diff)
downloadbrew-c6b3cd7cf454d542f0d713472a4cea73746d57a2.tar.bz2
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>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/upgrade.rb4
-rw-r--r--Library/Homebrew/formula.rb5
-rw-r--r--Library/Homebrew/formula_installer.rb3
3 files changed, 9 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 1afef1261..7ec02a0b5 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -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
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index d6f9f8f7b..57e5f76de 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -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
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 7421cabe0..06ac93975 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -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