public
Description: Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails, or Sinatra stack on a brand new slice directly after its been created
Homepage: http://github.com/crafterm/sprinkle
Clone URL: git://github.com/crafterm/sprinkle.git
Click here to lend your support to: sprinkle and make a donation at www.pledgie.com !
crafterm (author)
Wed Apr 01 03:42:44 -0700 2009
commit  518e33c835986c03ec7ae8ea88c657443b006f28
tree    4b5bce9aa7aca34449fa00f78d706598be6cb5ac
parent  8d80b31beb96094cc049f8528b74dd85688217dd
sprinkle / lib / sprinkle / verifiers / symlink.rb
100644 30 lines (29 sloc) 0.917 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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