Permalink
Browse files

Added launching simulator task

  • Loading branch information...
1 parent 1a2e4d1 commit 4de7d42317d92b2b739ca133c1c0c34d46b25a83 @burtlo committed Feb 1, 2012
Showing with 74 additions and 39 deletions.
  1. +39 −0 lib/xcode/builder_cedar.rb
  2. +33 −0 lib/xcode/builder_simulator.rb
  3. +2 −39 lib/xcoder_cedar.rb
@@ -0,0 +1,39 @@
+module Xcode
+
+ class Builder
+
+ def cedar
+ require 'tmpdir'
+
+ cmd = BuildCommand.new
+
+ # Similar to the xcoder gem these platform values and paths are hard-coded.
+ # This is likely a poor choice and one that will get this little plugin
+ # into some trouble when the iOS library upgrades.
+
+ cmd << "DYLD_ROOT_PATH=\"/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk\""
+ cmd << "IPHONE_SIMULATOR_ROOT=\"/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk\""
+
+ tempHome = Dir.mktmpdir("Cedar")
+ Dir.mkdir File.join(tempHome, "Documents")
+ Dir.mkdir File.join(tempHome, "Library")
+ Dir.mkdir File.join(tempHome, "Library/Preferences")
+ Dir.mkdir File.join(tempHome, "Library/Caches")
+ Dir.mkdir File.join(tempHome, "tmp")
+
+ cmd << "CFFIXED_USER_HOME=#{tempHome}"
+ cmd << "CEDAR_HEADLESS_SPECS=1"
+ cmd << "CEDAR_REPORTER_CLASS=CDRColorizedReporter"
+ cmd << "CEDAR_REPORTER_OPTS=nested"
+
+ cmd << "\"#{@build_path}#{@config.name}-iphonesimulator/#{@target.name}.app/#{@target.name}\""
+ cmd << "-RegisterForSystemEvents"
+
+ yield cmd if block_given?
+
+ Xcode::Shell.execute(cmd.to_a)
+
+ end
+
+ end
+end
@@ -0,0 +1,33 @@
+module Xcode
+
+ class Builder
+
+ def simulator
+
+ ios_sim = `which ios-sim`.strip
+
+ if ios_sim.empty?
+ puts "Please install ios-sim:"
+ puts "brew install ios-sim, or https://github.com/Fingertips/ios-sim"
+ exit
+ else
+
+ cmd = BuildCommand.new
+
+ cmd << ios_sim
+ cmd << "launch"
+ cmd << "\"#{@build_path}#{@config.name}-iphonesimulator/#{@target.name}.app\""
+ cmd << "--sdk 5.0"
+ cmd << "--family iphone"
+ cmd << "--stdout /dev/null"
+ cmd << "--stderr /dev/null"
+
+ Xcode::Shell.execute cmd.to_a
+
+ end
+
+ end
+
+ end
+
+end
View
@@ -1,41 +1,4 @@
require 'xcoder'
-module Xcode
-
- class Builder
-
- def cedar
- require 'tmpdir'
-
- cmd = BuildCommand.new
-
- # Similar to the xcoder gem these platform values and paths are hard-coded.
- # This is likely a poor choice and one that will get this little plugin
- # into some trouble when the iOS library upgrades.
-
- cmd << "DYLD_ROOT_PATH=\"/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk\""
- cmd << "IPHONE_SIMULATOR_ROOT=\"/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk\""
-
- tempHome = Dir.mktmpdir("Cedar")
- Dir.mkdir File.join(tempHome, "Documents")
- Dir.mkdir File.join(tempHome, "Library")
- Dir.mkdir File.join(tempHome, "Library/Preferences")
- Dir.mkdir File.join(tempHome, "Library/Caches")
- Dir.mkdir File.join(tempHome, "tmp")
-
- cmd << "CFFIXED_USER_HOME=#{tempHome}"
- cmd << "CEDAR_HEADLESS_SPECS=1"
- cmd << "CEDAR_REPORTER_CLASS=CDRColorizedReporter"
- cmd << "CEDAR_REPORTER_OPTS=nested"
-
- cmd << "\"#{@build_path}#{@config.name}-iphonesimulator/#{@target.name}.app/#{@target.name}\""
- cmd << "-RegisterForSystemEvents"
-
- yield cmd if block_given?
-
- Xcode::Shell.execute(cmd.to_a)
-
- end
-
- end
-end
+require 'xcode/builder_cedar'
+require 'xcode/builder_simulator'

0 comments on commit 4de7d42

Please sign in to comment.