Class: Specinfra::Command::Openbsd::Base::File
Class Method Summary
collapse
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_dereferenceable, check_is_directory, check_is_file, check_is_link, check_is_pipe, check_is_socket, check_is_symlink, copy, create_as_directory, download, get_content, get_link_realpath, get_link_target, get_owner_group, get_owner_user, link_to, move, remove
Methods inherited from Base
create, escape
Class Method Details
.check_has_mode(file, mode) ⇒ Object
15
16
17
18
|
# 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) ⇒ Object
25
26
27
28
|
# 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) ⇒ Object
11
12
13
|
# 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) ⇒ Object
30
31
32
33
|
# 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) ⇒ Object
20
21
22
23
|
# 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) ⇒ Object
3
4
5
|
# 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) ⇒ Object
35
36
37
|
# File 'lib/specinfra/command/openbsd/base/file.rb', line 35
def get_mode(file)
"stat -f%Lp #{escape(file)}"
end
|
.get_mtime(file) ⇒ Object
39
40
41
|
# File 'lib/specinfra/command/openbsd/base/file.rb', line 39
def get_mtime(file)
"stat -f %m #{escape(file)}"
end
|
.get_sha256sum(file) ⇒ Object
7
8
9
|
# 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) ⇒ Object
43
44
45
|
# File 'lib/specinfra/command/openbsd/base/file.rb', line 43
def get_size(file)
"stat -f %z #{escape(file)}"
end
|