Skip to content

Instantly share code, notes, and snippets.

@diegocstn
Created September 25, 2013 15:52
Show Gist options
  • Save diegocstn/6701712 to your computer and use it in GitHub Desktop.
Save diegocstn/6701712 to your computer and use it in GitHub Desktop.
Open Safari Mobile on iOS simulator passing a url with command line ( DRAFT )
#!/usr/bin/env ruby
basePath = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/"
simulatorPath = basePath + "Applications/iPhone\\ Simulator.app/Contents/MacOS/iPhone\\ Simulator -SimulateApplication"
sdkPath = basePath + "SDKs/"
safariPath = "Applications/MobileSafari.app/MobileSafari"
# check arguments
if ARGV.count > 3 || ARGV.count < 1
puts "Usage: safarimob url [--sdk 6.1|7.0 ]"
exit 0
end
# if no sdk is specified, default 7
sdk = ( ARGV[2] ) ? ARGV[2] : 7.0
url = ARGV[0]
# build application path with sdk version
safariPath = sdkPath+"iPhoneSimulator"+sdk.to_s+".sdk/"+safariPath
exec( simulatorPath + " " + safariPath )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment