forked from AliSoftware/OHHTTPStubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
61 lines (50 loc) · 1.51 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
# Build & test OHHTTPStubs lib from the CLI
desc 'Build an iOS scheme'
task :ios, [:scheme, :ios_version, :action] do |_,args|
destination = "platform=iOS Simulator,name=iPhone 5,OS=#{args.ios_version}"
build("OHHTTPStubs #{args.scheme}", destination, args.action)
end
desc 'Build an OSX scheme'
task :osx, [:scheme, :arch, :action] do |_,args|
destination = "platform=OS X,arch=#{args.arch}"
build("OHHTTPStubs #{args.scheme}", destination, args.action)
end
desc 'Build a tvOS scheme'
task :tvos, [:scheme, :tvos_version, :action] do |_,args|
destination = "platform=tvOS Simulator,name=Apple TV 1080p,OS=#{args.tvos_version}"
build("OHHTTPStubs #{args.scheme}", destination, args.action)
end
desc 'List installed simulators'
task :simlist do
sh 'xcrun simctl list'
end
desc 'Run all travis env tasks locally'
task :travis do
require 'YAML'
travis = YAML.load_file('.travis.yml')
travis['env'].each do |env|
arg = env.split('=')[1]
puts "\n" + ('-'*80) + "\n\n"
sh "rake #{arg}"
end
end
# Build the xcodebuild command and run it
def build(scheme, destination, action)
puts <<-ANNOUNCE
=============================
| Action: #{action}
| Scheme: "#{scheme}"
| #{destination}
=============================
ANNOUNCE
cmd = %W(
xcodebuild
-workspace OHHTTPStubs/OHHTTPStubs.xcworkspace
-scheme "#{scheme}"
-configuration Debug
ONLY_ACTIVE_ARCH=NO
-destination '#{destination}'
clean #{action}
)
sh "set -o pipefail && #{cmd.join(' ')} | xcpretty -c"
end