document formula path helpers

This commit is contained in:
Adam Vandenberg 2014-03-05 20:51:37 -08:00
parent cb047a223b
commit 5cb3b25d43

View File

@ -163,9 +163,13 @@ class Formula
Keg.new(installed_prefix).version
end
# The directory in the cellar that the formula is installed to.
# This directory contains the formula's name and version.
def prefix(v=pkg_version)
Pathname.new("#{HOMEBREW_CELLAR}/#{name}/#{v}")
end
# The parent of the prefix; the named directory in the cellar containing all
# installed versions of this software
def rack; prefix.parent end
def bin; prefix+'bin' end
@ -210,6 +214,12 @@ class Formula
def plist_manual; self.class.plist_manual end
def plist_startup; self.class.plist_startup end
# A stable path for this formula, when installed. Contains the formula name
# but no version number. Only the active version will be linked here if
# multiple versions are installed.
#
# This is the prefered way to refer a formula in plists or from another
# formula, as the path is stable even when the software is updated.
def opt_prefix
Pathname.new("#{HOMEBREW_PREFIX}/opt/#{name}")
end