Permalink
Browse files

Add SimLauncher::DirectClient, which calls the iphonesim exe directly

  • Loading branch information...
1 parent a3e3b12 commit 1de343c5da06626e1d9511e4ed00414c7130bef2 @moredip committed Mar 20, 2011
Showing with 33 additions and 7 deletions.
  1. +1 −3 bin/sim_launcher
  2. +3 −0 lib/sim_launcher.rb
  3. +25 −0 lib/sim_launcher/direct_client.rb
  4. +3 −3 lib/sim_launcher/simulator.rb
  5. +1 −1 lib/sim_launcher/version.rb
View
@@ -13,9 +13,7 @@ set :port, (ARGV[0] || 8881)
set :run, true
-IPHONESIM_PATH = File.join( File.dirname(__FILE__), '..', 'native', 'iphonesim' )
-
-shared_simulator = SimLauncher::Simulator.new( IPHONESIM_PATH )
+shared_simulator = SimLauncher::Simulator.new
get '/' do
<<EOS
View
@@ -0,0 +1,3 @@
+require 'sim_launcher/client'
+require 'sim_launcher/direct_client'
+require 'sim_launcher/simulator'
@@ -0,0 +1,25 @@
+module SimLauncher
+ class DirectClient
+ def initialize( app_path, sdk, family )
+ @app_path = File.expand_path( app_path )
+ @sdk = sdk
+ @family = family
+ end
+
+ def self.for_ipad_app( app_path, sdk = '4.2' )
+ self.new( app_path, sdk, 'ipad' )
+ end
+
+ def self.for_iphone_app( app_path, sdk = '4.2' )
+ self.new( app_path, sdk, 'iphone' )
+ end
+
+ def launch
+ SimLauncher::Simulator.new.launch_ios_app( @app_path, @sdk, @family )
+ end
+
+ def relaunch
+ launch
+ end
+ end
+end
@@ -1,8 +1,8 @@
module SimLauncher
class Simulator
- def initialize( iphonesim_path )
- @iphonesim_path = iphonesim_path
+ def initialize( iphonesim_path = nil )
+ @iphonesim_path = iphonesim_path || File.join( File.dirname(__FILE__), '..', '..', 'native', 'iphonesim' )
end
def showsdks
@@ -25,7 +25,7 @@ def launch_iphone_app( app_path, sdk )
def run_synchronous_command( *args )
cmd = cmd_line_with_args( args )
- puts "executing #{cmd}"
+ puts "executing #{cmd}" if $DEBUG
`#{cmd}`
end
@@ -1,3 +1,3 @@
module SimLauncher
- VERSION = "0.2.0"
+ VERSION = "0.3.0"
end

0 comments on commit 1de343c

Please sign in to comment.