Normalize paths before calling Tab.from_file

This commit is contained in:
Jack Nagel 2014-06-29 19:19:24 -05:00
parent 4d11def53c
commit 391bc4c981
2 changed files with 10 additions and 3 deletions

View File

@ -32,7 +32,7 @@ class Tab < OpenStruct
def self.from_file path
tab = Tab.new Utils::JSON.load(File.read(path))
tab.tabfile = path.realpath
tab.tabfile = path
tab
end
@ -51,7 +51,15 @@ class Tab < OpenStruct
end
def self.for_formula f
paths = [f.opt_prefix, f.linked_keg]
paths = []
if f.opt_prefix.symlink? && f.opt_prefix.directory?
paths << f.opt_prefix.resolved_path
end
if f.linked_keg.symlink? && f.linked_keg.directory?
paths << f.linked_keg.resolved_path
end
if f.rack.directory? && (dirs = f.rack.subdirs).length == 1
paths << dirs.first

View File

@ -93,7 +93,6 @@ class TabLoadingTests < Homebrew::TestCase
@f.prefix.mkpath
@path = @f.prefix.join(Tab::FILENAME)
@path.write Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json").read
@path = @path.realpath
end
def teardown