module Sprinkle
module Verifiers
# = Symlink Verifier
#
# Contains a verifier to check the existance of a symbolic link.
#
# == Example Usage
#
# First, checking for the existence of a symlink:
#
# verify { has_symlink '/usr/special/secret/pointer' }
#
# Second, checking that the symlink points to a specific place:
#
# verify { has_symlink '/usr/special/secret/pointer', '/usr/local/realfile' }
module Symlink
Sprinkle::Verify.register(Sprinkle::Verifiers::Symlink)
# Checks that symlink is a symbolic link. If file is
# given, it checks that symlink points to file
def has_symlink(symlink, file = nil)
if file.nil?
test "-L #{symlink}"
else
test "'#{file}' = `readlink #{symlink}`"
end
end
end
end
end