Skip to content

Instantly share code, notes, and snippets.

@jonathanpenn
Created May 2, 2012 16:23
Show Gist options
  • Save jonathanpenn/2577939 to your computer and use it in GitHub Desktop.
Save jonathanpenn/2577939 to your computer and use it in GitHub Desktop.
# This is part of a rakefile I use for UI Automation that's part of an
# upcoming (secret) project that I hope to announce soon.
# You need to set the $app_bundle global variable to point to the application's
# bundle on disk. Then hand in 1 for iPhone or 2 for iPad to this function
# and it will manipulate the plist of the device.
def pick_simulator_device index
# For now, the only way to tell UI Automation to run the iPad or iPhone
# simulator is to change the app bundle plist to require only that device.
sh %(/usr/libexec/PlistBuddy #{$app_bundle}/Info.plist \
-c "Delete :UIDeviceFamily" \
-c "Add :UIDeviceFamily array" \
-c "Add :UIDeviceFamily: integer #{index}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment