Skip to content

Commit 8c42668

Browse files
committed
Update fastfile
1 parent 2d99eb4 commit 8c42668

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

Fastlane/Fastfile

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,57 @@ default_platform :ios
55

66
platform :ios do
77

8+
library_name = "MockingKit"
9+
pod_name = "MockingKit"
10+
main_branch = "master"
11+
build_folder_docs = ".build/docs"
12+
813

914
# Documentation ==============
1015

11-
desc "Build Documentation"
16+
desc "Generate documentation"
1217
lane :documentation do
13-
docc_web
18+
docc_web
1419
end
1520

1621

17-
# Linting ====================
22+
# Lint =======================
1823

1924
desc "Run SwiftLint"
2025
lane :lint do
2126
swiftlint(strict: true)
2227
end
2328

2429

25-
# Test =======================
26-
30+
# Test ===================
31+
2732
desc "Run unit tests"
2833
lane :test do
2934
sh("swift test")
3035
end
3136

3237

33-
# Version ====================
38+
# Validate ===================
3439

35-
desc "Create a new version"
36-
lane :version do |options|
40+
desc "Ensure that the repo is valid for release"
41+
lane :ensure_release_ready do
3742
ensure_git_status_clean
38-
ensure_git_branch(branch: 'master')
39-
43+
ensure_git_branch(branch: main_branch)
4044
lint
4145
test
46+
end
47+
48+
49+
# Version ================
50+
51+
desc "Create a new version"
52+
lane :version do |options|
53+
ensure_release_ready
4254
documentation
4355

4456
bump_type = options[:type]
4557
version = version_bump_podspec(
46-
path: "MockingKit.podspec",
58+
path: pod_name + '.podspec',
4759
bump_type: bump_type)
4860

4961
git_commit(path: "*", message: "Bump to #{version}")
@@ -58,7 +70,7 @@ platform :ios do
5870

5971
desc "Build documentation for all platforms"
6072
lane :docc do
61-
sh('cd .. && rm -rf Docs')
73+
sh('cd .. && rm -rf ' + build_folder_docs)
6274
docc_platform(destination: 'iOS', name: 'ios')
6375
docc_platform(destination: 'OS X', name: 'osx')
6476
docc_platform(destination: 'tvOS', name: 'tvos')
@@ -67,23 +79,23 @@ platform :ios do
6779

6880
desc "Build documentation for a single platform"
6981
lane :docc_platform do |values|
70-
sh('cd .. && mkdir -p Docs')
71-
docc_delete_derived_data
82+
sh('cd .. && mkdir -p ' + build_folder_docs)
83+
docc_delete_derived_data(lib: library_name)
7284
sh('cd .. && xcodebuild docbuild \
73-
-scheme MockingKit \
85+
-scheme ' + library_name + ' \
7486
-destination \'generic/platform=' + values[:destination] + '\'')
7587
sh('cd .. && \
7688
find ~/Library/Developer/Xcode/DerivedData \
77-
-name "MockingKit.doccarchive" \
78-
-exec cp -R {} Docs \;')
89+
-name "' + library_name + '.doccarchive" \
90+
-exec cp -R {} ' + build_folder_docs + ' \;')
7991
sh('cd .. && \
80-
mv Docs/MockingKit.doccarchive Docs/MockingKit_' + values[:name] + '.doccarchive')
92+
mv ' + build_folder_docs + '/' + library_name + '.doccarchive ' + build_folder_docs + '/' + library_name + '_' + values[:name] + '.doccarchive')
8193
end
8294

8395
desc "Delete documentation derived data (may be historic duplicates)"
8496
lane :docc_delete_derived_data do
8597
sh('find ~/Library/Developer/Xcode/DerivedData \
86-
-name "MockingKit.doccarchive" \
98+
-name "' + library_name + '.doccarchive" \
8799
-exec rm -Rf {} \; || true')
88100
end
89101

@@ -99,9 +111,9 @@ platform :ios do
99111
desc "Build static documentation website for a single platform"
100112
lane :docc_web_platform do |values|
101113
sh('cd .. && $(xcrun --find docc) process-archive \
102-
transform-for-static-hosting Docs/MockingKit_' + values[:name] + '.doccarchive \
103-
--output-path Docs/web_' + values[:name] + ' \
104-
--hosting-base-path MockingKit')
114+
transform-for-static-hosting ' + build_folder_docs + '/' + library_name + '_' + values[:name] + '.doccarchive \
115+
--output-path ' + build_folder_docs + '/web_' + values[:name] + ' \
116+
--hosting-base-path ' + library_name + '')
105117
end
106118

107119
end

0 commit comments

Comments
 (0)