Sha256: cc88035bc1e6c85b5ef09165ff1bf228e8861b36f4aff7ad9eba6fb42c68acdb

Contents?: true

Size: 891 Bytes

Versions: 12

Compression:

Stored size: 891 Bytes

Contents

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 <tt>symlink</tt> is a symbolic link. If <tt>file</tt> is 
      # given, it checks that <tt>symlink</tt> points to <tt>file</tt>
      def has_symlink(symlink, file = nil)
        if file.nil?
          test "-L #{symlink}"
        else
          test "'#{file}' = `readlink #{symlink}`"
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sprinkle-0.7.1.1 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.7.1 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.7 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.6.2 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.6.1.1 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.6.1 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.6.0 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.5.2 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.5.1.1 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.5.1 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.5.0 lib/sprinkle/verifiers/symlink.rb
sprinkle-0.5.0.rc1 lib/sprinkle/verifiers/symlink.rb