class Specinfra::Command::Darwin::Base::File
Public Class Methods
check_has_mode(file, mode)
click to toggle source
# File lib/specinfra/command/darwin/base/file.rb, line 19 def check_has_mode(file, mode) regexp = "^#{mode}$" "stat -f%Lp #{escape(file)} | grep -- #{escape(regexp)}" end
check_is_accessible_by_user(file, user, access)
click to toggle source
# File lib/specinfra/command/darwin/base/file.rb, line 3 def check_is_accessible_by_user(file, user, access) "sudo -u #{user} -s /bin/test -#{access} #{file}" end
check_is_grouped(file, group)
click to toggle source
# File lib/specinfra/command/darwin/base/file.rb, line 29 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/darwin/base/file.rb, line 15 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/darwin/base/file.rb, line 24 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/darwin/base/file.rb, line 7 def get_md5sum(file) "openssl md5 #{escape(file)} | cut -d'=' -f2 | cut -c 2-" end
get_mode(file)
click to toggle source
# File lib/specinfra/command/darwin/base/file.rb, line 34 def get_mode(file) "stat -f%Lp #{escape(file)}" end
get_owner_group(file)
click to toggle source
# File lib/specinfra/command/darwin/base/file.rb, line 42 def get_owner_group(file) "stat -f %Sg #{escape(file)}" end
get_owner_user(file)
click to toggle source
# File lib/specinfra/command/darwin/base/file.rb, line 38 def get_owner_user(file) "stat -f %Su #{escape(file)}" end
get_sha256sum(file)
click to toggle source
# File lib/specinfra/command/darwin/base/file.rb, line 11 def get_sha256sum(file) "ruby -e \"require 'digest'; puts Digest::SHA256.hexdigest File.read '#{escape(file)}'\"" end