Class: Specinfra::Command::Solaris::V10::File
- Inherits:
-
Base::File
- Object
- Base
- Base::File
- Base::File
- Specinfra::Command::Solaris::V10::File
- Defined in:
- lib/specinfra/command/solaris/v10/file.rb
Class Method Summary collapse
- .check_contain(file, expected_pattern) ⇒ Object
-
.check_has_mode(file, mode) ⇒ Object
reference: perldoc.perl.org/functions/stat.html.
- .check_is_grouped(file, group) ⇒ Object
-
.check_is_linked_to(link, target) ⇒ Object
reference: www.tutorialspoint.com/perl/perl_readlink.htm.
- .check_is_owned_by(file, owner) ⇒ Object
- .get_md5sum(file) ⇒ Object
-
.get_mode(file) ⇒ Object
reference: perldoc.perl.org/functions/stat.html.
Methods inherited from Base::File
check_contains_within, check_is_accessible_by_user
Methods inherited from Base::File
change_group, change_mode, change_owner, check_contains, check_contains_lines, check_contains_with_fixed_strings, check_contains_with_regexp, check_contains_within, check_exists, check_is_block_device, check_is_character_device, check_is_directory, check_is_file, check_is_link, check_is_mounted, check_is_pipe, check_is_socket, check_is_symlink, copy, create_as_directory, download, get_content, get_link_target, get_mtime, get_owner_group, get_owner_user, get_sha256sum, get_size, link_to, move, remove
Methods inherited from Base
Class Method Details
.check_contain(file, expected_pattern) ⇒ Object
29 30 31 |
# 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) ⇒ Object
reference: perldoc.perl.org/functions/stat.html
4 5 6 7 |
# 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) ⇒ Object
reference: perldoc.perl.org/functions/stat.html
http://www.tutorialspoint.com/perl/perl_getgrgid.htm
18 19 20 21 |
# 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) ⇒ Object
24 25 26 27 |
# 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) ⇒ Object
reference: perldoc.perl.org/functions/stat.html
http://www.tutorialspoint.com/perl/perl_getpwuid.htm
11 12 13 14 |
# 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) ⇒ Object
33 34 35 |
# 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) ⇒ Object
reference: perldoc.perl.org/functions/stat.html
38 39 40 |
# 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 |