<commit_before>return unless platform_family?('mac_os_x')

# https://support.apple.com/en-us/HT201710
execute 'activate remote desktop sharing for vagrant' do
  command <<EOF
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
 -activate -configure -access -on -users vagrant -privs -all -restart -agent -menu
EOF
end

execute 'switch to login window' do
  command <<EOF
sudo "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession" -suspend
EOF
end

execute 'login to gui' do
  command <<EOF
osascript -e '
  tell application "System Events"
    keystroke "vagrant"
    keystroke return
    delay 3.0
    keystroke "vagrant"
    delay 3.0
    keystroke tab
    keystroke return
    keystroke return
  end tell
'
EOF
end

execute 'wait for login to build remote desktop db' do
  command 'sleep 30'
  not_if { ::File.exist?('/Library/Application Support/com.apple.TCC/TCC.db') }
end<commit_msg>Fix setup<commit_after>return unless platform_family?('mac_os_x')

execute 'switch to login window' do
  command 'sudo "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession" -suspend'
end

execute 'login to gui' do
  command <<EOF
osascript -e '
  tell application "System Events"
    keystroke "vagrant"
    keystroke return
    delay 3.0
    keystroke "vagrant"
    delay 3.0
    keystroke tab
    keystroke return
    keystroke return
  end tell'
EOF
end

execute 'wait for login to build remote desktop db' do
  command 'sleep 15'
  not_if { ::File.exist?('/Library/Application Support/com.apple.TCC/TCC.db') }
end
{'fraction_non_alphanumeric': 0.09526774595267747, 'fraction_numerical': 0.0112079701120797, 'mean_word_length': 3.811377245508982, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4441727', 'n_tokens_mistral': 534, 'n_tokens_neox': 509, 'n_words': 158}