-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
87 lines (69 loc) · 1.78 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
85
86
87
PROJ_PATH="Demo/RZDebugMenuDemo.xcodeproj"
WORKSPACE_PATH="Demo/RZDebugMenuDemo.xcworkspace"
BUILD_SCHEME="RZDebugMenuDemo"
namespace :install do
task :tools do
# don't care if this fails on travis
sh("brew update") rescue nil
sh("brew upgrade xctool") rescue nil
sh("gem install cocoapods --no-rdoc --no-ri --no-document --quiet") rescue nil
end
task :pods do
sh("cd Demo && pod install")
end
end
task :install do
Rake::Task['install:tools'].invoke
Rake::Task['install:pods'].invoke
end
#
# Build
#
task :build do
sh("xctool -workspace '#{WORKSPACE_PATH}' -scheme '#{BUILD_SCHEME}' -sdk iphonesimulator clean build") rescue nil
end
#
# Clean
#
namespace :clean do
task :pods do
sh("rm -f Demo/Podfile.lock")
sh "rm -rf Demo/Pods"
sh("rm -rf Demo/*.xcworkspace")
end
task :demo do
sh("xctool -project '#{PROJ_PATH}' -scheme '#{TEST_SCHEME}' -sdk iphonesimulator clean") rescue nil
end
end
task :clean do
Rake::Task['clean:pods'].invoke
Rake::Task['clean:demo'].invoke
end
#
# Utils
#
task :usage do
puts "Usage:"
puts " rake install -- install all dependencies (xctool, cocoapods)"
puts " rake install:pods -- install cocoapods for tests/demo"
puts " rake install:tools -- install build tool dependencies"
puts " rake clean -- clean everything"
puts " rake clean:demo -- clean the demo project build artifacts"
puts " rake clean:pods -- clean up cocoapods artifacts"
puts " rake sync -- synchronize project/directory hierarchy (dev only)"
puts " rake usage -- print this message"
end
task :sync do
sync_project(PROJ_PATH, '--exclusion /Classes')
end
#
# Default
#
task :default => 'usage'
#
# Private
#
private
def sync_project(path, flags)
sh("synx #{flags} '#{path}'")
end