forked from Quick/Quick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
73 lines (62 loc) · 2.12 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
def run(command)
system(command) or raise "RAKE TASK FAILED: #{command}"
end
def has_xcodebuild
system "which xcodebuild >/dev/null"
end
namespace "test" do
desc "Run unit tests for all iOS targets"
task :ios do |t|
run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-iOS -destination 'platform=iOS Simulator,name=iPhone 6' clean test"
end
desc "Run unit tests for all OS X targets"
task :osx do |t|
run "xcodebuild -workspace Quick.xcworkspace -scheme Quick-OSX clean test"
end
desc "Run unit tests for all iOS and OS X targets using xctool"
task xctool: %w[test:xctool:version test:xctool:ios test:xctool:osx]
namespace :xctool do
desc "Run unit tests for all iOS targets using xctool"
task :ios do |t|
Rake::Task["test:xctool:version"].invoke
run "xctool -workspace Quick.xcworkspace -scheme Quick-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6' clean test"
end
desc "Run unit tests for all OS X targets using xctool"
task :osx do |t|
Rake::Task["test:xctool:version"].invoke
run "xctool -workspace Quick.xcworkspace -scheme Quick-OSX clean test"
end
desc "Print the version of xctool being used"
task :version do
run "echo Using xctool v`xctool -v`..."
end
end
desc "Run unit tests for the current platform built by the Swift Package Manager"
task :swiftpm do |t|
run "swift build --clean && swift build"
run ".build/debug/QuickTests"
run ".build/debug/QuickFocusedTests"
end
end
namespace "templates" do
install_dir = File.expand_path("~/Library/Developer/Xcode/Templates/File Templates/Quick")
src_dir = File.expand_path("../Quick Templates", __FILE__)
desc "Install Quick templates"
task :install do
if File.exists? install_dir
raise "RAKE TASK FAILED: Quick templates are already installed at #{install_dir}"
else
mkdir_p install_dir
cp_r src_dir, install_dir
end
end
desc "Uninstall Quick templates"
task :uninstall do
rm_rf install_dir
end
end
if has_xcodebuild then
task default: ["test:ios", "test:osx"]
else
task default: ["test:swiftpm"]
end