Sha256: 08608c0350b2da06dba4da1628c6e77750eff9e4682ef7cf66a9289397942196

Contents?: true

Size: 740 Bytes

Versions: 12

Compression:

Stored size: 740 Bytes

Contents

# encoding: utf-8

require 'resources/file'

module Inspec::Resources
  class Directory < FileResource
    name 'directory'
    supports platform: 'unix'
    supports platform: 'windows'
    desc 'Use the directory InSpec audit resource to test if the file type is a directory. This is equivalent to using the file InSpec audit resource and the be_directory matcher, but provides a simpler and more direct way to test directories. All of the matchers available to file may be used with directory.'
    example <<~EXAMPLE
      describe directory('path') do
        it { should be_directory }
      end
    EXAMPLE

    def exist?
      file.exist? && file.directory?
    end

    def to_s
      "Directory #{source_path}"
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
inspec-core-4.3.2 lib/resources/directory.rb
inspec-4.3.2 lib/resources/directory.rb
inspec-core-4.2.0.preview lib/resources/directory.rb
inspec-4.2.0.preview lib/resources/directory.rb
inspec-core-4.1.4.preview lib/resources/directory.rb
inspec-4.1.4.preview lib/resources/directory.rb
inspec-core-3.9.3 lib/resources/directory.rb
inspec-3.9.3 lib/resources/directory.rb
inspec-core-3.9.0 lib/resources/directory.rb
inspec-3.9.0 lib/resources/directory.rb
inspec-core-3.7.11 lib/resources/directory.rb
inspec-3.7.11 lib/resources/directory.rb