aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index bae2e3314..0c19805a3 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -553,6 +553,28 @@ class Formula
Pathname.new("#{HOMEBREW_CELLAR}/#{name}/#{v}")
end
+ # Is the formula linked?
+ def linked?
+ linked_keg.symlink?
+ end
+
+ # Is the formula linked to opt?
+ def optlinked?
+ opt_prefix.symlink?
+ end
+
+ # Is formula's linked keg points to the prefix.
+ def prefix_linked?(v = pkg_version)
+ return false unless linked?
+ linked_keg.resolved_path == prefix(v)
+ end
+
+ # {PkgVersion} of the linked keg for the formula.
+ def linked_version
+ return unless linked?
+ Keg.for(linked_keg).version
+ end
+
# The parent of the prefix; the named directory in the cellar containing all
# installed versions of this software
# @private