Normalize paths before calling Tab.from_file
This commit is contained in:
parent
4d11def53c
commit
391bc4c981
@ -32,7 +32,7 @@ class Tab < OpenStruct
|
|||||||
|
|
||||||
def self.from_file path
|
def self.from_file path
|
||||||
tab = Tab.new Utils::JSON.load(File.read(path))
|
tab = Tab.new Utils::JSON.load(File.read(path))
|
||||||
tab.tabfile = path.realpath
|
tab.tabfile = path
|
||||||
tab
|
tab
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,7 +51,15 @@ class Tab < OpenStruct
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.for_formula f
|
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
|
if f.rack.directory? && (dirs = f.rack.subdirs).length == 1
|
||||||
paths << dirs.first
|
paths << dirs.first
|
||||||
|
@ -93,7 +93,6 @@ class TabLoadingTests < Homebrew::TestCase
|
|||||||
@f.prefix.mkpath
|
@f.prefix.mkpath
|
||||||
@path = @f.prefix.join(Tab::FILENAME)
|
@path = @f.prefix.join(Tab::FILENAME)
|
||||||
@path.write Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json").read
|
@path.write Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json").read
|
||||||
@path = @path.realpath
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
Loading…
x
Reference in New Issue
Block a user