Sha256: b7bdcd224498a293a1942c181d73dbe122e169aa10532ba307914e2345d3791c
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 KB
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) symlink, file = symlink.to_s, file.to_s if RUBY_PLATFORM =~ /win32/ raise NotImplementedError, "Win32 platform does not support checking for symbolic links" else if file.empty? @commands << "test -L #{symlink}" else @commands << "test '#{file}' = `readlink #{symlink}`" end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems