Skip to content

Commit

Permalink
Improve rake spec task.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed May 25, 2011
1 parent f85b34d commit 4dd02cc
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,26 @@ task :serve_fixtures do
exec "rackup -s webrick ./Spec/fixtures/config.ru"
end

def is_fixture_server_running?
require 'socket'
TCPSocket.new('localhost', 9292)
true
rescue Errno::ECONNREFUSED
false
end

desc "Run the specs"
task :spec do
exec "ruby #{File.expand_path('../vendor/NuBacon/bin/nu-bacon.rb', __FILE__)} --project iTrakt.xcodeproj --target Specs"
ios_sim = `which ios-sim`.strip
if ios_sim.empty?
puts "[!] Unable to find `ios-sim'. Install it with: $ brew install ios-sim"
exit 1
elsif !is_fixture_server_running?
puts "[!] It seems the fixture server isn't running. Start it with: $ rake serve_fixtures"
else
sh "xcodebuild -project iTrakt.xcodeproj -target Specs -configuration Debug -sdk iphonesimulator4.2"
exec "#{ios_sim} launch build/Debug-iphonesimulator/Specs.app"
end
end

task :default => :spec

0 comments on commit 4dd02cc

Please sign in to comment.