Module: Mac::Exec
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
-
#modified_at(file, timestamp = nil) ⇒ Object
Update ModifiedDate on a file.
-
#selinux_enabled? ⇒ Boolean
Checks if selinux is enabled selinux is not availble on OS X.
-
#ssh_permit_user_environment ⇒ Result
private
Sets the PermitUserEnvironment setting & restarts the SSH service.
-
#ssh_service_restart ⇒ Result
Restarts the SSH service.
- #touch(file, abs = true) ⇒ Object
Methods included from Beaker::CommandFactory
Instance Method Details
#modified_at(file, timestamp = nil) ⇒ Object
Update ModifiedDate on a file
41 42 43 44 45 46 |
# File 'lib/beaker/host/mac/exec.rb', line 41 def modified_at(file, = nil) require 'date' time = ? DateTime.parse("#{}") : DateTime.now = time.strftime('%Y%m%d%H%M') execute("touch -mt #{} #{file}") end |
#selinux_enabled? ⇒ Boolean
Checks if selinux is enabled selinux is not availble on OS X
34 35 36 |
# File 'lib/beaker/host/mac/exec.rb', line 34 def selinux_enabled? false end |
#ssh_permit_user_environment ⇒ Result
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets the PermitUserEnvironment setting & restarts the SSH service
22 23 24 25 26 27 28 |
# File 'lib/beaker/host/mac/exec.rb', line 22 def ssh_permit_user_environment ssh_config_file = '/etc/sshd_config' ssh_config_file = '/private/etc/ssh/sshd_config' if /^osx-/.match?(self['platform']) exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> #{ssh_config_file}")) ssh_service_restart end |
#ssh_service_restart ⇒ Result
Restarts the SSH service
11 12 13 14 15 |
# File 'lib/beaker/host/mac/exec.rb', line 11 def ssh_service_restart launch_daemons_plist = '/System/Library/LaunchDaemons/ssh.plist' exec(Beaker::Command.new("launchctl unload #{launch_daemons_plist}")) exec(Beaker::Command.new("launchctl load #{launch_daemons_plist}")) end |
#touch(file, abs = true) ⇒ Object
4 5 6 |
# File 'lib/beaker/host/mac/exec.rb', line 4 def touch(file, abs = true) (abs ? '/usr/bin/touch' : 'touch') + " #{file}" end |