Update Tap for alias_path

This commit is contained in:
Alyssa Ross 2016-09-05 14:21:00 +01:00
parent 65ee5408c3
commit b90eba8ffd
3 changed files with 8 additions and 3 deletions

View File

@ -56,6 +56,10 @@ class Tab < OpenStruct
attributes["source_modified_time"] ||= 0
attributes["source"] ||= {}
if alias_path = attributes["alias_path"]
attributes["alias_path"] = Pathname.new(alias_path)
end
tapped_from = attributes["tapped_from"]
unless tapped_from.nil? || tapped_from == "path or URL"
attributes["source"]["tap"] = attributes.delete("tapped_from")
@ -294,7 +298,7 @@ class Tab < OpenStruct
"time" => time,
"source_modified_time" => source_modified_time.to_i,
"HEAD" => self.HEAD,
"alias_path" => alias_path,
"alias_path" => alias_path && alias_path.to_s,
"stdlib" => (stdlib.to_s if stdlib),
"compiler" => (compiler.to_s if compiler),
"source" => source

View File

@ -11,7 +11,7 @@
"poured_from_bottle": true,
"time": 1403827774,
"HEAD": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
"alias_path": "test-formula",
"alias_path": "/usr/local/Library/Taps/homebrew/homebrew-core/Aliases/test-formula",
"stdlib": "libcxx",
"compiler": "clang",
"source": {

View File

@ -100,6 +100,7 @@ class TabTests < Homebrew::TestCase
def test_from_file
path = Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json")
tab = Tab.from_file(path)
alias_path = Pathname.new("/usr/local/Library/Taps/homebrew/homebrew-core/Aliases/test-formula")
assert_equal @used.sort, tab.used_options.sort
assert_equal @unused.sort, tab.unused_options.sort
@ -117,7 +118,7 @@ class TabTests < Homebrew::TestCase
assert_equal "2.14", tab.stable_version.to_s
assert_equal "2.15", tab.devel_version.to_s
assert_equal "HEAD-0000000", tab.head_version.to_s
assert_equal "test-formula", tab.alias_path
assert_equal alias_path, tab.alias_path
end
def test_to_json