From 3d585d6e3fefedaa65f38ba646f0b12af84082c2 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Wed, 7 Oct 2015 18:51:02 +0800 Subject: [PATCH] add Formula#aliases Fixes Homebrew/homebrew#44331. Closes Homebrew/homebrew#44709. Signed-off-by: Xu Cheng --- Library/Homebrew/formula.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 8f0e0e1419..9377dfe77a 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -280,6 +280,18 @@ class Formula end end + # All of aliases for the formula + def aliases + @aliases ||= if core_formula? + Formula.core_alias_reverse_table[name] || [] + elsif tap? + user, repo = tap.split("/") + Tap.fetch(user, repo.sub("homebrew-", "")).alias_reverse_table[full_name] || [] + else + [] + end + end + # The {Resource}s for the currently active {SoftwareSpec}. def resources active_spec.resources.values @@ -1138,6 +1150,7 @@ class Formula "desc" => desc, "homepage" => homepage, "oldname" => oldname, + "aliases" => aliases, "versions" => { "stable" => (stable.version.to_s if stable), "bottle" => bottle ? true : false,