aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-10-09 19:03:20 +0800
committerXu Cheng2015-10-09 19:06:08 +0800
commit1ae44d44299803ec0da62731ac7b808d1d32f5aa (patch)
tree7b2fefd4e985908c1af29e271c48aa66789efbc8 /Library
parenta7df9c53eb7343f8f9b03e2220dba051c392aded (diff)
downloadbrew-1ae44d44299803ec0da62731ac7b808d1d32f5aa.tar.bz2
use directory? to check rack existence
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/install.rb2
-rw-r--r--Library/Homebrew/cmd/outdated.rb7
2 files changed, 4 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index f39ebbd2a..f7087ad8b 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -77,7 +77,7 @@ module Homebrew
msg = "#{f.full_name}-#{f.installed_version} already installed"
msg << ", it's just not linked" unless f.linked_keg.symlink? || f.keg_only?
opoo msg
- elsif f.oldname && (dir = HOMEBREW_CELLAR/f.oldname).exist? && !dir.subdirs.empty? \
+ elsif f.oldname && (dir = HOMEBREW_CELLAR/f.oldname).directory? && !dir.subdirs.empty? \
&& f.tap == Tab.for_keg(dir.subdirs.first).tap && !ARGV.force?
# Check if the formula we try to install is the same as installed
# but not migrated one. If --force passed then install anyway.
diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb
index d432c4e83..7a199fcae 100644
--- a/Library/Homebrew/cmd/outdated.rb
+++ b/Library/Homebrew/cmd/outdated.rb
@@ -18,10 +18,9 @@ module Homebrew
all_versions = []
older_or_same_tap_versions = []
- if f.oldname && !f.rack.exist? && (dir = HOMEBREW_CELLAR/f.oldname).exist?
- if f.tap == Tab.for_keg(dir.subdirs.first).tap
- raise Migrator::MigrationNeededError.new(f)
- end
+ if f.oldname && !f.rack.exist? && (dir = HOMEBREW_CELLAR/f.oldname).directory? &&
+ !dir.subdirs.empty? && f.tap == Tab.for_keg(dir.subdirs.first).tap
+ raise Migrator::MigrationNeededError.new(f)
end
f.rack.subdirs.each do |keg_dir|