Module: Sprinkle::Verifiers::Symlink

Defined in:
lib/sprinkle/verifiers/symlink.rb

Overview

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' }

Instance Method Summary collapse

Instance Method Details

Checks that symlink is a symbolic link. If file is given, it checks that symlink points to file



21
22
23
24
25
26
27
# File 'lib/sprinkle/verifiers/symlink.rb', line 21

def has_symlink(symlink, file = nil)
  if file.nil?
    @commands << "test -L #{symlink}"
  else
    @commands << "test '#{file}' = `readlink #{symlink}`"
  end
end