class Specinfra::Command::Freebsd::Base::File

Public Class Methods

check_has_mode(file, mode) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 21
def check_has_mode(file, mode)
  "test `stat -f%Mp%Lp #{escape(file)}` -eq #{escape(mode)}"
end
check_is_grouped(file, group) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 3
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/freebsd/base/file.rb, line 29
def check_is_linked_to(link, target)
  "stat -f%Y #{escape(link)} | grep -- #{escape(target)}"
end
check_is_owned_by(file, owner) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 12
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/freebsd/base/file.rb, line 45
def get_md5sum(file)
    "md5 #{escape(file)} | cut -d ' ' -f 4"
end
get_mode(file) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 25
def get_mode(file)
  "stat -f%M%Lp #{escape(file)}".oct.to_s(8) # to remove leading 0
end
get_mtime(file) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 33
def get_mtime(file)
  "stat -f%m #{escape(file)}"
end
get_owner_group(file) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 8
def get_owner_group(file)
  "stat -f%Sg #{escape(file)}"
end
get_owner_user(file) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 17
def get_owner_user(file)
  "stat -f%Su #{escape(file)}"
end
get_sha256sum(file) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 41
def get_sha256sum(file)
    "sha256 #{escape(file)} | cut -d ' ' -f 4"
end
get_size(file) click to toggle source
# File lib/specinfra/command/freebsd/base/file.rb, line 37
def get_size(file)
  "stat -f%z #{escape(file)}"
end