Sha256: ef51fa3fcbe80c8e7f14d630c28108ebd697b6c85724e7d1ab710eba1d4c6a96

Contents?: true

Size: 1.13 KB

Versions: 21

Compression:

Stored size: 1.13 KB

Contents

class Specinfra::Command::Freebsd::Base::File < Specinfra::Command::Base::File
  class << self
    def check_is_grouped(file, group)
      regexp = "^#{group}$"
      "stat -f%Sg #{escape(file)} | grep -- #{escape(regexp)}"
    end

    def get_owner_group(file)
      "stat -f%Sg #{escape(file)}"
    end

    def check_is_owned_by(file, owner)
      regexp = "^#{owner}$"
      "stat -f%Su #{escape(file)} | grep -- #{escape(regexp)}"
    end

    def get_owner_user(file)
      "stat -f%Su #{escape(file)}"
    end

    def check_has_mode(file, mode)
      "test `stat -f%Mp%Lp #{escape(file)}` -eq #{escape(mode)}"
    end

    def get_mode(file)
      "stat -f%M%Lp #{escape(file)}".oct.to_s(8) # to remove leading 0
    end

    def check_is_linked_to(link, target)
      "stat -f%Y #{escape(link)} | grep -- #{escape(target)}"
    end

    def get_mtime(file)
      "stat -f%m #{escape(file)}"
    end

    def get_size(file)
      "stat -f%z #{escape(file)}"
    end

    def get_sha256sum(file)
        "sha256 #{escape(file)} | cut -d ' ' -f 4"
    end

    def get_md5sum(file)
        "md5 #{escape(file)} | cut -d ' ' -f 4"
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
specinfra-rb19-2.44.7 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.49.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.48.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.47.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.47.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.46.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.45.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.8 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.7 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.6 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.5 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.4 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.3 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.2 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.44.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.43.11 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.43.10 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.43.9 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.43.8 lib/specinfra/command/freebsd/base/file.rb