- Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathRakefile
77 lines (56 loc) · 2.47 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
defgit_has_uncommitted_changes
returnsystem("git diff-index --quiet --cached HEAD") == false
end
defgit_has_dirty_workspace
returnsystem("git diff-files --quiet") == false
end
defgit_has_untracked_files
return`git ls-files --exclude-standard --others`.strip.length > 0
end
defgit_is_status_clean
return`git status --porcelain`.strip.empty?
end
defgit_version
return`git describe --long`.strip
end
$workspace ="RXPromise.xcworkspace"
$allSchemes =['RXPromise-MacOS','RXPromise-iOS','RXPromise-tvOS','RXPromise-WatchOS']
$testSchemes =['RXPromise-MacOS','RXPromise-iOS','RXPromise-tvOS']
desc"Build all targets defined within the given schemes #{$allSchemes}"
task:builddo
$allSchemes.each{ |scheme|
sh"xctool -workspace #{$workspace} -scheme #{scheme} build"
}
end
desc"Clean all targets defined within the given schemes #{$allSchemes}"
task:cleando
$allSchemes.each{ |scheme|
sh"xctool -workspace #{$workspace} -scheme #{scheme} clean"
}
end
desc"Run all tests defined within the given schemes"
task:test=>[:build]do
sh"xcrun xcodebuild test -workspace RXPromise.xcworkspace -scheme RXPromise-MacOS -destination 'arch=x86_64'| xcpretty"
sh"xcrun xcodebuild test -workspace RXPromise.xcworkspace -scheme RXPromise-iOS -destination 'platform=iOS Simulator,name=iPhone 6' test | xcpretty"
sh"xcrun xcodebuild test -workspace RXPromise.xcworkspace -scheme RXPromise-tvOS -destination 'platform=tvOS Simulator,name=Apple TV 1080p' test | xcpretty"
end
namespace:versiondo
desc"Print a description of the current version"
task:describedo
puts"git HEAD: #{`git describe --dirty`}"
puts"Marketing version: #{`agvtool what-marketing-version -terse1`}"
puts"Build number: #{`agvtool what-version -terse`}"
end
desc"Udates BUNDLE_SHORT_VERSION with the specified version, then commits and pushes to origin"
task:releasedo
currentBranch=`git symbolic-ref --short HEAD`.strip
ifcurrentBranch != 'master'
abort"Error: You must be on the master branch in order to define a new release!"
end
if !git_is_status_clean
abort"Error: There are uncommitted changes. Please run tests and commit changes before creating a new release!"
end
puts"Current git description: #{`git describe --dirty`}"
puts"Current Marketing version: #{`agvtool what-marketing-version -terse1`}"
end
end