Add a helper to determine if a keg is linked
'keg.linked?' will return true if there is an entry for 'keg' in LinkedKegs. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
198135e8c0
commit
07b7dd7a7a
@ -45,6 +45,10 @@ class Keg < Pathname
|
||||
@linked_keg_record ||= HOMEBREW_REPOSITORY/"Library/LinkedKegs"/fname
|
||||
end
|
||||
|
||||
def linked?
|
||||
linked_keg_record.directory? and self == linked_keg_record.realpath
|
||||
end
|
||||
|
||||
def link
|
||||
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user