Sha256: 593a77c7fc13c4e7a5be2fd26cba681806676b8593a3e553ec13dd9f750a2b2b

Contents?: true

Size: 1.64 KB

Versions: 18

Compression:

Stored size: 1.64 KB

Contents

module Serverspec
  module Type
    class File < Base
      def file?
        backend.check_file(nil, @name)
      end

      def directory?
        backend.check_directory(nil, @name)
      end

      def contain(pattern, from, to)
        if (@from || @to).nil?
          cmd = backend.check_file_contain(nil, @name, pattern)
        else
          cmd = backend.check_file_contain_within(nil, @name, pattern, from, to)
        end
      end

      def mode?(mode)
        backend.check_mode(nil, @name, mode)
      end

      def owned_by?(owner)
        backend.check_owner(nil, @name, owner)
      end

      def grouped_into?(group)
        backend.check_grouped(nil, @name, group)
      end

      def linked_to?(target)
        backend.check_link(nil, @name, target)
      end

      def readable?(by_whom, by_user)
        if by_user != nil
          backend.check_access_by_user(nil, @name, by_user, 'r')
        else
          backend.check_readable(nil, @name, by_whom)
        end
      end

      def writable?(by_whom, by_user)
        if by_user != nil
          backend.check_access_by_user(nil, @name, by_user, 'w')
        else
          backend.check_writable(nil, @name, by_whom)
        end
      end

      def executable?(by_whom, by_user)
        if by_user != nil
          backend.check_access_by_user(nil, @name, by_user, 'x')
        else
          backend.check_executable(nil, @name, by_whom)
        end
      end

      def mounted?(attr, only_with)
        backend.check_mounted(nil, @name, attr, only_with)
      end

      def match_md5checksum(md5sum)
        backend.check_file_md5checksum(nil, @name, md5sum)
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
serverspec-0.5.3 lib/serverspec/type/file.rb
serverspec-0.5.2 lib/serverspec/type/file.rb
serverspec-0.5.1 lib/serverspec/type/file.rb
serverspec-0.5.0 lib/serverspec/type/file.rb
serverspec-0.4.14 lib/serverspec/type/file.rb
serverspec-0.4.13 lib/serverspec/type/file.rb
serverspec-0.4.12 lib/serverspec/type/file.rb
serverspec-0.4.11 lib/serverspec/type/file.rb
serverspec-0.4.10 lib/serverspec/type/file.rb
serverspec-0.4.9 lib/serverspec/type/file.rb
serverspec-0.4.8 lib/serverspec/type/file.rb
serverspec-0.4.7 lib/serverspec/type/file.rb
serverspec-0.4.6 lib/serverspec/type/file.rb
serverspec-0.4.5 lib/serverspec/type/file.rb
serverspec-0.4.4 lib/serverspec/type/file.rb
serverspec-0.4.3 lib/serverspec/type/file.rb
serverspec-0.4.2 lib/serverspec/type/file.rb
serverspec-0.4.1 lib/serverspec/type/file.rb