class Specinfra::Command::Solaris::V10::File
Public Class Methods
check_contain(file, expected_pattern)
click to toggle source
# File lib/specinfra/command/solaris/v10/file.rb, line 29 def check_contain(file, expected_pattern) "grep -- #{escape(expected_pattern)} #{escape(file)}" end
check_has_mode(file, mode)
click to toggle source
reference: perldoc.perl.org/functions/stat.html
# File lib/specinfra/command/solaris/v10/file.rb, line 4 def check_has_mode(file, mode) regexp = "^#{mode}$" "perl -e 'printf \"%o\", (stat shift)[2]&07777' #{escape(file)} | grep -- #{escape(regexp)}" end
check_is_grouped(file, group)
click to toggle source
reference: perldoc.perl.org/functions/stat.html
http://www.tutorialspoint.com/perl/perl_getgrgid.htm
# File lib/specinfra/command/solaris/v10/file.rb, line 18 def check_is_grouped(file, group) regexp = "^#{group}$" "perl -e 'printf \"%s\", getgrgid((stat(\"#{escape(file)}\"))[5])' | grep -- #{escape(regexp)}" end
check_is_linked_to(link, target)
click to toggle source
reference: www.tutorialspoint.com/perl/perl_readlink.htm
# File lib/specinfra/command/solaris/v10/file.rb, line 24 def check_is_linked_to(link, target) regexp = "^#{target}$" "perl -e 'printf \"%s\", readlink(\"#{escape(link)}\")' | grep -- #{escape(regexp)}" end
check_is_owned_by(file, owner)
click to toggle source
reference: perldoc.perl.org/functions/stat.html
http://www.tutorialspoint.com/perl/perl_getpwuid.htm
# File lib/specinfra/command/solaris/v10/file.rb, line 11 def check_is_owned_by(file, owner) regexp = "^#{owner}$" "perl -e 'printf \"%s\", getpwuid((stat(\"#{escape(file)}\"))[4])' | grep -- #{escape(regexp)}" end
get_md5sum(file)
click to toggle source
# File lib/specinfra/command/solaris/v10/file.rb, line 33 def get_md5sum(file) "digest -a md5 -v #{escape(file)} | cut -d '=' -f 2 | cut -c 2-" end
get_mode(file)
click to toggle source
reference: perldoc.perl.org/functions/stat.html
# File lib/specinfra/command/solaris/v10/file.rb, line 38 def get_mode(file) "perl -e 'printf \"%o\", (stat shift)[2]&07777' #{escape(file)}" end