-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
48 lines (41 loc) · 1.01 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
class String
def self.colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
def red
self.class.colorize(self, 31)
end
def green
self.class.colorize(self, 32)
end
end
desc 'Run the tests'
task :build do
buildAndLogScheme("")
buildAndLogScheme("Example")
buildAndLogScheme("Tests")
end
task :default => :build
def buildAndLogScheme(name)
workspace = Dir["*.xcworkspace"].first
scheme = workspace.gsub(".xcworkspace", name)
result = compile(workspace, scheme)
log(scheme, result)
end
def log(scheme, result)
scheme = "Default" if scheme == ""
puts "#{scheme}: #{result == 0 ? 'PASSED'.green : 'FAILED'.red}"
end
def compile(workspace, scheme)
command = "xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug -sdk iphonesimulator -verbose"
IO.popen(command) do |io|
while line = io.gets do
puts line
if line == "** BUILD SUCCEEDED **\n"
return 0
elsif line == "** BUILD FAILED **\n"
return 1
end
end
end
end