Skip to content

Commit 485ac07

Browse files
committed
adding feature to change device orientation
1 parent cd4cdec commit 485ac07

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

lib/sim_launcher/direct_client.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ def launch
1818
SimLauncher::Simulator.new.launch_ios_app( @app_path, @sdk, @family )
1919
end
2020

21+
def rotate_left
22+
simulator = SimLauncher::Simulator.new
23+
simulator.rotate_left
24+
end
25+
26+
def rotate_right
27+
simulator = SimLauncher::Simulator.new
28+
simulator.rotate_right
29+
end
30+
31+
32+
2133
def relaunch
2234
simulator = SimLauncher::Simulator.new
2335
simulator.quit_simulator

lib/sim_launcher/simulator.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ def start_simulator(sdk_version=nil, device_family="iphone")
1414
run_synchronous_command( :start, '--sdk', sdk_version, '--family', device_family, '--exit' )
1515
end
1616

17+
18+
def rotate_left
19+
script_dir = File.join(File.dirname(__FILE__),"..","..","scripts")
20+
rotate_script = File.expand_path("#{script_dir}/rotate_simulator_left.applescript")
21+
system("osascript #{rotate_script}")
22+
end
23+
24+
def rotate_right
25+
script_dir = File.join(File.dirname(__FILE__),"..","..","scripts")
26+
rotate_script = File.expand_path("#{script_dir}/rotate_simulator_right.applescript")
27+
system("osascript #{rotate_script}")
28+
end
29+
1730
def reset(sdks=nil)
1831
script_dir = File.join(File.dirname(__FILE__),"..","..","scripts")
1932
reset_script = File.expand_path("#{script_dir}/reset_simulator.applescript")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tell application "System Events"
2+
3+
tell process "iPhone Simulator"
4+
5+
tell menu bar 1
6+
tell menu bar item "Hardware"
7+
tell menu "Hardware"
8+
click menu item "Rotate Left"
9+
end tell
10+
end tell
11+
end tell
12+
end tell
13+
end tell
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tell application "System Events"
2+
3+
tell process "iPhone Simulator"
4+
5+
tell menu bar 1
6+
tell menu bar item "Hardware"
7+
tell menu "Hardware"
8+
click menu item "Rotate Right"
9+
end tell
10+
end tell
11+
end tell
12+
end tell
13+
end tell

0 commit comments

Comments
 (0)