From 5cb3b25d4306625d69ce4072fffb3d6cc8f32cab Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Wed, 5 Mar 2014 20:51:37 -0800 Subject: [PATCH] document formula path helpers --- Library/Homebrew/formula.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index e11aa00195..43a67079d2 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -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