Class: Serverspec::Commands::Darwin
- Inherits:
-
Base
- Object
- Base
- Serverspec::Commands::Darwin
show all
- Defined in:
- lib/serverspec/commands/darwin.rb
Defined Under Namespace
Classes: NotImplementedError
Instance Method Summary
collapse
Methods inherited from Base
#check_authorized_key, #check_belonging_group, #check_cron_entry, #check_directory, #check_enabled, #check_file, #check_file_contain, #check_file_contain_within, #check_gid, #check_group, #check_home_directory, #check_installed, #check_installed_by_gem, #check_ipfilter_rule, #check_ipnat_rule, #check_iptables_rule, #check_link, #check_listening, #check_login_shell, #check_mounted, #check_process, #check_reachable, #check_resolvable, #check_routing_table, #check_running, #check_running_under_supervisor, #check_selinux, #check_svcprop, #check_svcprops, #check_uid, #check_user, #check_zfs, #escape
Instance Method Details
#check_access_by_user(file, user, access) ⇒ Object
31
32
33
|
# File 'lib/serverspec/commands/darwin.rb', line 31
def check_access_by_user file, user, access
"sudo -u #{user} -s /bin/test -#{access} #{file}"
end
|
#check_file_md5checksum(file, expected) ⇒ Object
8
9
10
|
# File 'lib/serverspec/commands/darwin.rb', line 8
def check_file_md5checksum file, expected
"openssl md5 #{escape(file)} | cut -d'=' -f2 | cut -c 2- | grep -E ^#{escape(expected)}$"
end
|
#check_grouped(file, group) ⇒ Object
22
23
24
25
|
# File 'lib/serverspec/commands/darwin.rb', line 22
def check_grouped file, group
regexp = "^#{group}$"
"stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}"
end
|
#check_mode(file, mode) ⇒ Object
12
13
14
15
|
# File 'lib/serverspec/commands/darwin.rb', line 12
def check_mode file, mode
regexp = "^#{mode}$"
"stat -f%Lp #{escape(file)} | grep -- #{escape(regexp)}"
end
|
#check_owner(file, owner) ⇒ Object
17
18
19
20
|
# File 'lib/serverspec/commands/darwin.rb', line 17
def check_owner file, owner
regexp = "^#{owner}$"
"stat -f %Su #{escape(file)} | grep -- #{escape(regexp)}"
end
|
#get_mode(file) ⇒ Object
27
28
29
|
# File 'lib/serverspec/commands/darwin.rb', line 27
def get_mode(file)
"stat -f%Lp #{escape(file)}"
end
|