forked from hoko/hoko-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
37 lines (28 loc) · 848 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
include FileUtils::Verbose
namespace :test do
task :prepare do
mkdir_p "Tests/Hoko Tests.xcodeproj/xcshareddata/xcschemes"
cp Dir.glob('Tests/Schemes/*.xcscheme'), "Tests/Hoko Tests.xcodeproj/xcshareddata/xcschemes/"
end
desc "Run the Hoko Tests"
task :ios => :prepare do
run_tests('iOS Tests', 'iphonesimulator')
tests_failed('iOS') unless $?.success?
end
end
desc "Run the Hoko Tests for iOS"
task :test do
Rake::Task['test:ios'].invoke
end
task :default => 'test'
private
def run_tests(scheme, sdk)
sh("xcodebuild -workspace Hoko.xcworkspace -scheme '#{scheme}' -sdk '#{sdk}' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
end
def tests_failed(platform)
puts red("#{platform} unit tests failed")
exit $?.exitstatus
end
def red(string)
"\033[0;31m! #{string}"
end