@@ -175,100 +175,100 @@ platform :android do
175175 )
176176 end
177177 end
178+ end
178179
179- #####################################################################################
180- # Versioning utils
181- #####################################################################################
182-
183- # Updates the build code in version.properties to the next build code and commits the change
184- #
185- def bump_build_code
186- VERSION_FILE . write_version (
187- version_name : release_version_current ,
188- version_code : build_code_next
189- )
190- commit_version_update ( message : '[skip ci] Bump build code' )
191- end
192-
193- # Updates the version name in version.properties to the next release version and commits the change
194- #
195- def bump_version
196- VERSION_FILE . write_version (
197- version_name : release_version_next
198- )
199- commit_version_update ( message : '[skip ci] Bump app version' )
200- end
201-
202- # Commits the version update to the version.properties file
203- #
204- def commit_version_update ( message :)
205- Fastlane ::Helper ::GitHelper . commit (
206- message : message ,
207- files : VERSION_PROPERTIES_PATH
208- )
209- end
180+ #####################################################################################
181+ # Versioning utils
182+ #####################################################################################
183+
184+ # Updates the build code in version.properties to the next build code and commits the change
185+ #
186+ def bump_build_code
187+ VERSION_FILE . write_version (
188+ version_name : release_version_current ,
189+ version_code : build_code_next
190+ )
191+ commit_version_update ( message : '[skip ci] Bump build code' )
192+ end
210193
211- # Returns the current version name from `version.properties` without needing formatting or calculations
212- #
213- def version_name_current
214- VERSION_FILE . read_version_name
215- end
194+ # Updates the version name in version.properties to the next release version and commits the change
195+ #
196+ def bump_version
197+ VERSION_FILE . write_version (
198+ version_name : release_version_next
199+ )
200+ commit_version_update ( message : '[skip ci] Bump app version' )
201+ end
216202
217- # Returns the release version of the app in the format `1.2` or `1.2.3` if it is a hotfix
218- #
219- def release_version_current
220- current_version = VERSION_FORMATTER . parse ( version_name_current )
221- VERSION_FORMATTER . release_version ( current_version )
222- end
203+ # Commits the version update to the version.properties file
204+ #
205+ def commit_version_update ( message :)
206+ Fastlane ::Helper ::GitHelper . commit (
207+ message : message ,
208+ files : VERSION_PROPERTIES_PATH
209+ )
210+ end
223211
224- # Returns the next release version of the app in the format `1.2` or `1.2.3` if it is a hotfix
225- #
226- def release_version_next
227- current_version = VERSION_FORMATTER . parse ( version_name_current )
228- release_version_next = VERSION_CALCULATOR . next_release_version ( version : current_version )
229- VERSION_FORMATTER . release_version ( release_version_next )
230- end
212+ # Returns the current version name from `version.properties` without needing formatting or calculations
213+ #
214+ def version_name_current
215+ VERSION_FILE . read_version_name
216+ end
231217
232- # Returns the current build code of the app
233- #
234- def build_code_current
235- build_code_current = VERSION_FILE . read_version_code
236- BUILD_CODE_FORMATTER . build_code ( build_code : build_code_current )
237- end
218+ # Returns the release version of the app in the format `1.2` or `1.2.3` if it is a hotfix
219+ #
220+ def release_version_current
221+ current_version = VERSION_FORMATTER . parse ( version_name_current )
222+ VERSION_FORMATTER . release_version ( current_version )
223+ end
238224
239- # Returns the next build code of the app
240- #
241- def build_code_next
242- build_code_current = VERSION_FILE . read_version_code
243- build_code_next = BUILD_CODE_CALCULATOR . next_build_code ( build_code : build_code_current )
244- BUILD_CODE_FORMATTER . build_code ( build_code : build_code_next )
245- end
225+ # Returns the next release version of the app in the format `1.2` or `1.2.3` if it is a hotfix
226+ #
227+ def release_version_next
228+ current_version = VERSION_FORMATTER . parse ( version_name_current )
229+ release_version_next = VERSION_CALCULATOR . next_release_version ( version : current_version )
230+ VERSION_FORMATTER . release_version ( release_version_next )
231+ end
246232
247- # Generates a build number for the prototype build
248- #
249- def generate_prototype_build_number
250- if ENV [ 'BUILDKITE' ]
251- commit = ENV . fetch ( 'BUILDKITE_COMMIT' , nil ) [ 0 , 7 ]
252- branch = ENV [ 'BUILDKITE_BRANCH' ] . parameterize
253- pr_num = ENV . fetch ( 'BUILDKITE_PULL_REQUEST' , nil )
233+ # Returns the current build code of the app
234+ #
235+ def build_code_current
236+ build_code_current = VERSION_FILE . read_version_code
237+ BUILD_CODE_FORMATTER . build_code ( build_code : build_code_current )
238+ end
254239
255- pr_num == 'false' ? "#{ branch } -#{ commit } " : "pr#{ pr_num } -#{ commit } "
256- else
257- repo = Git . open ( PROJECT_ROOT_FOLDER )
258- commit = repo . current_branch . parameterize
259- branch = repo . revparse ( 'HEAD' ) [ 0 , 7 ]
240+ # Returns the next build code of the app
241+ #
242+ def build_code_next
243+ build_code_current = VERSION_FILE . read_version_code
244+ build_code_next = BUILD_CODE_CALCULATOR . next_build_code ( build_code : build_code_current )
245+ BUILD_CODE_FORMATTER . build_code ( build_code : build_code_next )
246+ end
260247
261- "#{ branch } -#{ commit } "
262- end
248+ # Generates a build number for the prototype build
249+ #
250+ def generate_prototype_build_number
251+ if ENV [ 'BUILDKITE' ]
252+ commit = ENV . fetch ( 'BUILDKITE_COMMIT' , nil ) [ 0 , 7 ]
253+ branch = ENV [ 'BUILDKITE_BRANCH' ] . parameterize
254+ pr_num = ENV . fetch ( 'BUILDKITE_PULL_REQUEST' , nil )
255+
256+ pr_num == 'false' ? "#{ branch } -#{ commit } " : "pr#{ pr_num } -#{ commit } "
257+ else
258+ repo = Git . open ( PROJECT_ROOT_FOLDER )
259+ commit = repo . current_branch . parameterize
260+ branch = repo . revparse ( 'HEAD' ) [ 0 , 7 ]
261+
262+ "#{ branch } -#{ commit } "
263263 end
264+ end
264265
265- #####################################################################################
266- # Other utils
267- #####################################################################################
266+ #####################################################################################
267+ # Other utils
268+ #####################################################################################
268269
269- def require_env_vars! ( *keys )
270- keys . each do |key |
271- UI . user_error! ( "Environment variable '#{ key } ' is not set." ) unless ENV . key? ( key )
272- end
270+ def require_env_vars! ( *keys )
271+ keys . each do |key |
272+ UI . user_error! ( "Environment variable '#{ key } ' is not set." ) unless ENV . key? ( key )
273273 end
274274end
0 commit comments