-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathRakefile
64 lines (59 loc) · 2 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
DESTINATIONS = ["name=iPhone Retina (3.5-inch),OS=7.0",
"name=iPhone Retina (4-inch),OS=7.0",
"name=iPhone Retina (4-inch 64-bit),OS=7.0"]
task :default => [:build, :clean, :test]
desc "build"
task :build, :workspace, :schemes do |t, args|
schemes = args[:schemes].gsub(/'/, '').split(' ')
schemes.each do |scheme|
options = {
workspace: "#{args[:workspace]}",
scheme: "#{scheme}"
}
options = join_option(options: options, prefix: "-", seperator: " ")
settings = {
CODE_SIGN_IDENTITY: "",
CODE_SIGNING_REQUIRED: "NO"
}
settings = join_option(options: settings, prefix: "", seperator: "=")
sh "xcodebuild #{options} #{settings} build | xcpretty -c; exit ${PIPESTATUS[0]}"
end
end
desc "clean"
task :clean, :workspace, :schemes do |t, args|
schemes = args[:schemes].gsub(/'/, '').split(' ')
schemes.each do |scheme|
options = {
workspace: "#{args[:workspace]}",
scheme: "#{scheme}"
}
options = join_option(options: options, prefix: "-", seperator: " ")
settings = {
CODE_SIGN_IDENTITY: "",
CODE_SIGNING_REQUIRED: "NO"
}
settings = join_option(options: settings, prefix: "", seperator: "=")
sh "xcodebuild #{options} #{settings} clean | xcpretty -c; exit ${PIPESTATUS[0]}"
end
end
desc "run unit tests"
task :test, :workspace, :schemes do |t, args|
schemes = args[:schemes].gsub(/'/, '').split(' ')
schemes.each do |scheme|
DESTINATIONS.each do |destination|
options = {
workspace: "#{args[:workspace]}",
scheme: "#{scheme}",
configuration: "Debug",
sdk: "iphonesimulator",
destination: "#{destination}"
}
options = join_option(options: options, prefix: "-", seperator: " ")
sh "xcodebuild test #{options} | xcpretty -tc; exit ${PIPESTATUS[0]}"
end
end
end
def join_option(options: {}, prefix: "", seperator: "")
_options = options.map { |k, v| %(#{prefix}#{k}#{seperator}"#{v}") }
_options = _options.join(" ")
end