Sha256: 3d8b749801335408415dd34f7c714e0e0b67974c4f3c9bc5ea81f9eb95459e91
Contents?: true
Size: 1.25 KB
Versions: 24
Compression:
Stored size: 1.25 KB
Contents
module Sprinkle module Verifiers # = Executable Verifier # # Contains a verifier to check the existance of an executable # script on your server. # # == Example Usage # # First, absolute path to an executable: # # verify { has_executable '/usr/special/secret/bin/scipt' } # # Second, a global executable which would be available anywhere on the # command line: # # verify { has_executable 'grep' } module Executable Sprinkle::Verify.register(Sprinkle::Verifiers::Executable) # Checks if <tt>path</tt> is an executable script. This verifier is "smart" because # if the path contains a forward slash '/' then it assumes you're checking an # absolute path to an executable. If no '/' is in the path, it assumes you're # checking for a global executable that would be available anywhere on the command line. def has_executable(path) # Be smart: If the path includes a forward slash, we're checking # an absolute path. Otherwise, we're checking a global executable if path.include?('/') @commands << "test -x #{path}" else @commands << "[ -n \"`echo \\`which #{path}\\``\" ]" end end end end end
Version data entries
24 entries across 24 versions & 9 rubygems