class Specinfra::Command::Openbsd::Base::File

Public Class Methods

check_has_mode(file, mode) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 15
def check_has_mode(file, mode)
  regexp = "^#{mode}$"
  "stat -f%Lp #{escape(file)} | grep #{escape(regexp)}"
end
check_is_grouped(file, group) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 25
def check_is_grouped(file, group)
  regexp = "^#{group}$"
  "stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}"
end
check_is_linked_to(link, target) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 11
def check_is_linked_to(link, target)
  "stat -f %Y #{escape(link)} | grep -- #{escape(target)}"
end
check_is_mounted(path) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 30
def check_is_mounted(path)
  regexp = "on #{path} "
  "mount | grep #{escape(regexp)}"
end
check_is_owned_by(file, owner) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 20
def check_is_owned_by(file, owner)
  regexp = "^#{owner}$"
  "stat -f %Su #{escape(file)} | grep -- #{escape(regexp)}"
end
get_md5sum(file) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 3
def get_md5sum(file)
  "cksum -qa md5 #{escape(file)} | cut -d ' ' -f 1"
end
get_mode(file) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 35
def get_mode(file)
  "stat -f%Lp #{escape(file)}"
end
get_mtime(file) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 39
def get_mtime(file)
  "stat -f %m #{escape(file)}"
end
get_sha256sum(file) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 7
def get_sha256sum(file)
  "cksum -qa sha256 #{escape(file)} | cut -d ' ' -f 1"
end
get_size(file) click to toggle source
# File lib/specinfra/command/openbsd/base/file.rb, line 43
def get_size(file)
  "stat -f %z #{escape(file)}"
end