Group methods that operate on the linked keg record

This commit is contained in:
Jack Nagel 2014-06-30 20:09:13 -05:00
parent 4c05d411f3
commit 30e273c2d1

View File

@ -151,6 +151,17 @@ class Keg
path.rename(*args) path.rename(*args)
end end
def linked?
linked_keg_record.symlink? &&
linked_keg_record.directory? &&
path == linked_keg_record.resolved_path
end
def remove_linked_keg_record
linked_keg_record.unlink
linked_keg_record.parent.rmdir_if_possible
end
def uninstall def uninstall
path.rmtree path.rmtree
path.parent.rmdir_if_possible path.parent.rmdir_if_possible
@ -191,21 +202,10 @@ class Keg
ObserverPathnameExtension.total ObserverPathnameExtension.total
end end
def remove_linked_keg_record
linked_keg_record.unlink
linked_keg_record.parent.rmdir_if_possible
end
def lock def lock
FormulaLock.new(name).with_lock { yield } FormulaLock.new(name).with_lock { yield }
end end
def linked?
linked_keg_record.symlink? &&
linked_keg_record.directory? &&
path == linked_keg_record.resolved_path
end
def completion_installed? shell def completion_installed? shell
dir = case shell dir = case shell
when :bash then path.join("etc", "bash_completion.d") when :bash then path.join("etc", "bash_completion.d")