Sha256: d438c5fce3530752bb7c8edb4e89a1510db98e5217ff9db749a88cf22bdbea34

Contents?: true

Size: 1.1 KB

Versions: 218

Compression:

Stored size: 1.1 KB

Contents

class Specinfra::Command::Openbsd::Base::File < Specinfra::Command::Base::File
  class << self
    def get_md5sum(file)
      "cksum -qa md5 #{escape(file)} | cut -d ' ' -f 1"
    end

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

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

    def check_has_mode(file, mode)
      regexp = "^#{mode}$"
      "stat -f%Lp #{escape(file)} | grep #{escape(regexp)}"
    end

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

    def check_is_grouped(file, group)
      regexp = "^#{group}$"
      "stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}"
    end

    def check_is_mounted(path)
      regexp = "on #{path} "
      "mount | grep #{escape(regexp)}"
    end

    def get_mode(file)
      "stat -f%Lp #{escape(file)}"
    end

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

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

Version data entries

218 entries across 218 versions & 3 rubygems

Version Path
specinfra-2.82.5 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.82.4 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.82.3 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.82.2 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.82.1 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.82.0 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.81.0 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.80.0 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.79.0 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.78.2 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.78.1 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.78.0 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.77.3 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.77.2 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.77.1 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.77.0 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.76.9 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.76.8 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.76.7 lib/specinfra/command/openbsd/base/file.rb
specinfra-2.76.6 lib/specinfra/command/openbsd/base/file.rb