diff options
| author | Jack Nagel | 2014-03-22 11:34:26 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-03-22 11:47:07 -0500 |
| commit | b4e5401e660ac1962a88b151f511a0eef9cee44c (patch) | |
| tree | c36c2c03c8c367f3f5a98432d28036235ab422d7 /Library/Homebrew | |
| parent | a8eb84812ae62292427cafa48a2c65e8e6693d3c (diff) | |
| download | brew-b4e5401e660ac1962a88b151f511a0eef9cee44c.tar.bz2 | |
Try to find install receipt when keg is unlinked
This roughly matches the logic we use to determine the active keg in
ARGV.kegs.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/tab.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 0c6fb7927..8016f588a 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -51,9 +51,21 @@ class Tab < OpenStruct end def self.for_formula f - path = [f.opt_prefix, f.linked_keg].map{ |pn| pn.join(FILENAME) }.find{ |pn| pn.exist? } - # Legacy kegs may lack a receipt. If it doesn't exist, fake one - if path.nil? then self.dummy_tab(f) else self.from_file(path) end + paths = [f.opt_prefix, f.linked_keg] + + if f.rack.directory? && (dirs = f.rack.subdirs).length == 1 + paths << dirs.first + end + + paths << f.prefix + + path = paths.map { |pn| pn.join(FILENAME) }.find(&:file?) + + if path + from_file(path) + else + dummy_tab(f) + end end def self.dummy_tab f=nil |
