From b90eba8ffd9549879bf4c911377d8d4cf9aa7b39 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 5 Sep 2016 14:21:00 +0100 Subject: [PATCH] Update Tap for alias_path --- Library/Homebrew/tab.rb | 6 +++++- Library/Homebrew/test/fixtures/receipt.json | 2 +- Library/Homebrew/test/test_tab.rb | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index ec8cbe2353..d84c643296 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -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 diff --git a/Library/Homebrew/test/fixtures/receipt.json b/Library/Homebrew/test/fixtures/receipt.json index 39dcaea079..585a4e27de 100644 --- a/Library/Homebrew/test/fixtures/receipt.json +++ b/Library/Homebrew/test/fixtures/receipt.json @@ -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": { diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index 85fcf4d162..be528390a8 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -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