Permalink
Browse files

Merge pull request #11 from calabash/master

Support for starting simulator without launch
  • Loading branch information...
2 parents 2cedf01 + fdb1b32 commit cd4cdecd2f9549c2f314ab0b8505f8904db70c06 @moredip committed Nov 17, 2012
@@ -9,6 +9,28 @@ def showsdks
run_synchronous_command( 'showsdks' )
end
+ def start_simulator(sdk_version=nil, device_family="iphone")
+ sdk_version ||= SdkDetector.new(self).latest_sdk_version
+ run_synchronous_command( :start, '--sdk', sdk_version, '--family', device_family, '--exit' )
+ end
+
+ def reset(sdks=nil)
+ script_dir = File.join(File.dirname(__FILE__),"..","..","scripts")
+ reset_script = File.expand_path("#{script_dir}/reset_simulator.applescript")
+
+ sdks ||= SimLauncher::SdkDetector.new(self).available_sdk_versions
+
+ sdks.each do |sdk_path_str|
+ start_simulator(sdk_path_str,"iphone")
+ system("osascript #{reset_script}")
+ start_simulator(sdk_path_str,"ipad")
+ system("osascript #{reset_script}")
+ end
+
+ quit_simulator
+
+ end
+
def launch_ios_app(app_path, sdk_version, device_family, app_args = nil)
if problem = SimLauncher.check_app_path( app_path )
bangs = '!'*80
@@ -1,3 +1,3 @@
module SimLauncher
- VERSION = "0.4.6"
+ VERSION = "0.4.7"
end
View
Binary file not shown.
@@ -0,0 +1,18 @@
+tell application "System Events"
+
+ tell process "iPhone Simulator"
+
+ tell menu bar 1
+ tell menu bar item "iOs Simulator"
+ tell menu "iOs Simulator"
+ click menu item "Reset Content and SettingsÉ"
+ end tell
+ end tell
+ end tell
+ delay 1
+ perform action "AXRaise" of window 1
+ tell window 1
+ click button "Reset"
+ end tell
+ end tell
+end tell

0 comments on commit cd4cdec

Please sign in to comment.