-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
84 lines (73 loc) · 1.98 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
74
75
76
77
78
79
80
81
82
83
84
BUILD_DIR='build'
SDK_BUILD_VERSION=ENV["SDK_BUILD_VERSION"] || ""
def system_or_exit(cmd, log=nil)
puts "\033[32m==>\033[0m #{cmd}"
if log
logfile = "#{BUILD_DIR}/#{log}"
system("mkdir -p #{BUILD_DIR.inspect}")
unless system("#{cmd} 2>&1 > #{logfile.inspect}")
system("cat #{logfile.inspect}")
puts ""
puts ""
puts "[Failed] #{cmd}"
puts " Output is logged to: #{logfile}"
exit 1
end
else
unless system(cmd)
puts "[Failed] #{cmd}"
exit 1
end
end
end
class Simulator
def self.quit
system("osascript -e 'tell app \"iOS Simulator\" to quit' > /dev/null")
sleep(1)
end
end
def xcbuild(cmd)
Simulator.quit
unless system_or_exit("xcodebuild -project JKVValue.xcodeproj #{cmd}", "build.txt")
end
end
desc 'Cleans build directory'
task :clean do
system_or_exit("rm -rf #{BUILD_DIR.inspect} 2>&1 > '#{BUILD_DIR}/clean.txt' || true")
end
task :deps do
system_or_exit("carthage build")
end
desc 'Cleans build directory for OS X'
task osx_specs: :deps do
xcbuild("clean test -scheme JKVValue-OSX -sdk macosx -destination 'platform=OS X' SYMROOT=#{BUILD_DIR.inspect}")
end
desc 'Runs the iOS spec bundle'
task ios_specs: :deps do
xcbuild("clean test -scheme JKVValue-iOS -sdk iphonesimulator#{SDK_BUILD_VERSION} SYMROOT=#{BUILD_DIR.inspect} -destination 'name=iPhone 6s'")
end
desc 'Runs the tvOS spec bundle'
task tvos_specs: :deps do
xcbuild("clean test -scheme JKVValue-tvOS -sdk appletvsimulator#{SDK_BUILD_VERSION} SYMROOT=#{BUILD_DIR.inspect} -destination 'name=Apple TV 1080p'")
end
desc 'Runs the cocoapod spec linter'
task :lint do
system_or_exit('pod lib lint JKVValue.podspec')
end
desc 'Cuts a new release of JKVValue'
task :release, [:version] => [:default] do |t, args|
system_or_exit("scripts/release #{args[:version]}")
end
task :default => [
:clean,
:osx_specs,
:ios_specs,
:tvos_specs,
]
desc 'Runs what CI would run'
task :ci => [
:clean,
:osx_specs,
:ios_specs,
:tvos_specs,
]