Monday May 14, 2012

✦ Close The Simulator After Running RubyMotion Specs

Here’s a quickie to add to your RubyMotion Rakefile.

task 'simclose' do
  sh "osascript -e 'tell application \"iphone simulator\" to quit'"

Now you can run your specs with:

rake specs simclose

And the simulator will close automatically after the specs are run.


I just realized that some of you would rather have the simulator close after every spec run, rather than explicitly specify it. To do that, just name the task “spec”. That will add the new task commands to the existing “spec” task.