Sha256: 8c584076d0d675bb0ddc56630bfe4a593af88f37881e2deae92943a23bb15686

Contents?: true

Size: 681 Bytes

Versions: 7

Compression:

Stored size: 681 Bytes

Contents

module Sprinkle
  module Verifiers
    # = Directory Verifier
    #
    # Defines a verify which can be used to test the existence of a 
    # directory.
    module Directory
      Sprinkle::Verify.register(Sprinkle::Verifiers::Directory)
      
      # Tests that the directory <tt>dir</tt> exists.
      def has_directory(dir)
        dir = dir.to_s
        if RUBY_PLATFORM =~ /win32/
          dir += "\\" unless dir[-1,1] == "\\"
          command = "if exist \"#{dir}\" (exit 0) else (exit 1)"
          command << ' > NUL 2>&1' unless logger.debug?
        else
          command = "test -d #{dir}"
        end
        @commands << command
      end
      
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lachlan-sprinkle-0.0.10 lib/sprinkle/verifiers/directory.rb
lachlan-sprinkle-0.0.11 lib/sprinkle/verifiers/directory.rb
lachlan-sprinkle-0.0.13 lib/sprinkle/verifiers/directory.rb
lachlan-sprinkle-0.0.14 lib/sprinkle/verifiers/directory.rb
lachlan-sprinkle-0.0.15 lib/sprinkle/verifiers/directory.rb
lachlan-sprinkle-0.0.16 lib/sprinkle/verifiers/directory.rb
lachlan-sprinkle-0.0.9 lib/sprinkle/verifiers/directory.rb