-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
95 lines (77 loc) · 2.59 KB
/
Rakefile
File metadata and controls
95 lines (77 loc) · 2.59 KB
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
88
89
90
91
92
93
94
95
## [ Defines ] #################################################################
projectName = "WorkflowTest"
## [ CocoaPods ] ###############################################################
desc "Install project dependencies"
desc "In case of need, pod repo update will be invoked"
task :pods do
begin
print_info "Installing dependencies from CocoaPods"
sh "pod install"
rescue
print_info "Install failed - trying repo update"
sh "pod repo update"
sh "pod install"
end
end
## [ Xcode ] ##################################################################
desc "Open the workspace in Xcode"
task :xcode do
workspace = "./#{projectName}.xcworkspace"
sh "open #{workspace}"
end
## [ Tools ] ###################################################################
desc "Install tools"
task :tools do
begin
print_info "Installing tools dependencies with Mint"
sh "mint bootstrap"
rescue
print_info "Failed - check if Mint installed"
end
end
desc "Setup test app environments"
task :environment do
begin
print_info "Runnin AutoEnvironment"
sh "mint run autoenvironment autoenvironment -p #{projectName}.xcodeproj/ -o ./#{projectName}"
rescue
print_info "Failed - check if Mint installed"
end
end
## [ Build ] ###################################################################
desc "Build SwiftyWorkflow"
task :build do
sh("swift build")
end
## [ Deploy ] ##################################################################
desc "Deploys new version of a binary, by pushing passed tag"
task :deploy do
ARGV.each { |a| task a.to_sym do ; end }
version = ARGV[1].to_s
if version
sh("sed 's|{{VERSION_NUMBER}}|#{version}|g' ./Podspec.template > ./SwiftyWorkflow.podspec")
sh("git add *")
sh("git commit -m \"Deploy #{version}\"")
sh("git push")
sh("git tag #{version} && git push --tags")
sh("pod trunk push")
end
end
## [ Mocks Generation ] ########################################################
desc "Regenerates mocks"
task :mock do
sh "mint run swiftymocky swiftymocky generate"
end
desc "Regenerates mocks with clearing cache"
task :mock_regen do
sh "mint run swiftymocky swiftymocky generate --disableCache"
end
## [ Helpers ] #################################################################
desc "Purge Derived data"
task :purge do
sh("rm -rf ~/Library/Developer/Xcode/DerivedData/*")
end
def print_info(str)
(red,clr) = (`tput colors`.chomp.to_i >= 8) ? %W(\e[33m \e[m) : ["", ""]
puts red, "== #{str.chomp} ==", clr
end