Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for starting simulator without launch #11

Merged
merged 5 commits into from Nov 17, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/sim_launcher/simulator.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/sim_launcher/version.rb
@@ -1,3 +1,3 @@
module SimLauncher
VERSION = "0.4.6"
VERSION = "0.4.7"
end
Binary file modified native/ios-sim
Binary file not shown.
18 changes: 18 additions & 0 deletions scripts/reset_simulator.applescript
@@ -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