Sha256: 425836d2697fefb0c7cf55cedc892bcfa1438df5f010d6cf2762f2c5d9c03497

Contents?: true

Size: 917 Bytes

Versions: 45

Compression:

Stored size: 917 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?
          @commands << "test -L #{symlink}"
        else
          @commands << "test '#{file}' = `readlink #{symlink}`"
        end
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 12 rubygems

Version Path
auser-sprinkle-0.1.6 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.1.6 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.1.7 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.1.8 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.1.9 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.2.0 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.2.1 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.2.2 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.2.3 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.2.4 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.2.5 lib/sprinkle/verifiers/symlink.rb
crafterm-sprinkle-0.2.6 lib/sprinkle/verifiers/symlink.rb
jemmyw-sprinkle-0.2.3 lib/sprinkle/verifiers/symlink.rb
jemmyw-sprinkle-0.2.4 lib/sprinkle/verifiers/symlink.rb
jsierles-sprinkle-0.1.9 lib/sprinkle/verifiers/symlink.rb
justsee-sprinkle-0.2.4 lib/sprinkle/verifiers/symlink.rb
mdwan-sprinkle-0.2.2 lib/sprinkle/verifiers/symlink.rb
mdwan-sprinkle-0.2.3 lib/sprinkle/verifiers/symlink.rb
mitchellh-sprinkle-0.1.6 lib/sprinkle/verifiers/symlink.rb
trevorturk-sprinkle-0.2.2 lib/sprinkle/verifiers/symlink.rb