Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support for starting simulator without launch #11

Merged
merged 5 commits into from

2 participants

@krukow

Support for starting simulator without launch
(new ios-sim gem:
calabash/ios-sim@84e2070
).

Support for resetting simulator via applescript.

Example

krukow:~/github/Sim-Launcher$ rake install
sim_launcher 0.4.7 built to pkg/sim_launcher-0.4.7.gem
sim_launcher (0.4.7) installed
krukow:~/github/Sim-Launcher$ irb
irb(main):001:0> require 'sim_launcher'
=> true
irb(main):002:0> l=SimLauncher::Simulator.new
=> #
irb(main):003:0> l.reset
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
=> ""
irb(main):004:0> l.reset ["6.0"]
«class butT» Reset of window 1 of «class pcap» iPhone Simulator
«class butT» Reset of window 1 of «class pcap» iPhone Simulator

@moredip moredip merged commit cd4cdec into moredip:master
@moredip
Owner

I also just released the 0.4.7 gem based off of this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 9, 2012
  1. @krukow
Commits on Oct 10, 2012
  1. @krukow

    proper ios-sim build

    krukow authored
  2. @krukow

    text version

    krukow authored
Commits on Oct 16, 2012
  1. @krukow

    call plaintext version

    krukow authored
Commits on Nov 16, 2012
  1. @krukow

    merge

    krukow authored
This page is out of date. Refresh to see the latest.
View
22 lib/sim_launcher/simulator.rb
@@ -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
View
2  lib/sim_launcher/version.rb
@@ -1,3 +1,3 @@
module SimLauncher
- VERSION = "0.4.6"
+ VERSION = "0.4.7"
end
View
BIN  native/ios-sim
Binary file not shown
View
18 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
Something went wrong with that request. Please try again.