Sha256: 3efa4e81873cde061341cf73ad07346999239b5f13fa7003951aee09e015187d
Contents?: true
Size: 1000 Bytes
Versions: 3
Compression:
Stored size: 1000 Bytes
Contents
module Sprinkle module Verifiers # = File Verifier # # Contains a verifier to check the existance of a file. # # == Example Usage # # verify { has_file '/etc/apache2/apache2.conf' } # # verify { file_contains '/etc/apache2/apache2.conf', 'mod_gzip'} # module File Sprinkle::Verify.register(Sprinkle::Verifiers::File) # Checks to make sure <tt>path</tt> is a file on the remote server. def has_file(path) @commands << "test -f #{path}" end def file_contains(path, text) @commands << "grep '#{text}' #{path}" end def user_present(username) has_user username end def matches_local(localfile, remotefile, mode=nil) raise "Couldn't find local file #{localfile}" unless ::File.exists?(localfile) local = `md5 #{localfile}`.split.last @commands << %{[ "X$(md5sum #{remotefile}|cut -d\\ -f 1)" = "X#{local}" ]} end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sprinkle-0.4.2 | lib/sprinkle/verifiers/file.rb |
sprinkle-0.4.1 | lib/sprinkle/verifiers/file.rb |
sprinkle-0.4.0 | lib/sprinkle/verifiers/file.rb |