cmd/install: use migration_needed?

Closes #411.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Vlad Shablinsky 2016-06-27 17:38:03 +03:00 committed by Xu Cheng
parent 0d3b5f6849
commit da06e813c2
No known key found for this signature in database
GPG Key ID: C2A3860FA0B459CE

View File

@ -132,8 +132,7 @@ module Homebrew
msg = "#{f.full_name}-#{f.installed_version} already installed" msg = "#{f.full_name}-#{f.installed_version} already installed"
msg << ", it's just not linked" unless f.linked_keg.symlink? || f.keg_only? msg << ", it's just not linked" unless f.linked_keg.symlink? || f.keg_only?
opoo msg opoo msg
elsif f.oldname && (dir = HOMEBREW_CELLAR/f.oldname).directory? && !dir.subdirs.empty? \ elsif f.migration_needed? && !ARGV.force?
&& f.tap == Tab.for_keg(dir.subdirs.first).tap && !ARGV.force?
# Check if the formula we try to install is the same as installed # Check if the formula we try to install is the same as installed
# but not migrated one. If --force passed then install anyway. # but not migrated one. If --force passed then install anyway.
opoo "#{f.oldname} already installed, it's just not migrated" opoo "#{f.oldname} already installed, it's just not migrated"