aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2015-10-07 18:51:02 +0800
committerXu Cheng2015-10-14 17:26:41 +0800
commit3d585d6e3fefedaa65f38ba646f0b12af84082c2 (patch)
treeb83a9a54fc38a41a760961d3a3f2048d922ce39e
parent98633e03c62bdf9f658338f57895da788c9eb76c (diff)
downloadbrew-3d585d6e3fefedaa65f38ba646f0b12af84082c2.tar.bz2
add Formula#aliases
Fixes Homebrew/homebrew#44331. Closes Homebrew/homebrew#44709. Signed-off-by: Xu Cheng <xucheng@me.com>
-rw-r--r--Library/Homebrew/formula.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 8f0e0e141..9377dfe77 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,