Module: Fastlane::Helper::Ios::VersionHelper
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb
Overview
A module containing helper methods to manipulate/extract/bump iOS version strings in xcconfig files
Constant Summary collapse
- MAJOR_NUMBER =
The index for the major version number part
0
- MINOR_NUMBER =
The index for the minor version number part
1
- HOTFIX_NUMBER =
The index for the hotfix version number part
2
- BUILD_NUMBER =
The index for the build version number part
3
Class Method Summary collapse
-
.calc_next_release_version(version) ⇒ String
Compute the name of the next release version.
-
.get_version_parts(version) ⇒ Array<String>
Split a version string into its 4 parts, ensuring its parts count is valid.
-
.is_int?(string) ⇒ Bool
Check if a string is an integer.
Class Method Details
.calc_next_release_version(version) ⇒ String
Compute the name of the next release version.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb', line 26 def self.calc_next_release_version(version) vp = get_version_parts(version) vp[MINOR_NUMBER] += 1 if vp[MINOR_NUMBER] == 10 vp[MAJOR_NUMBER] += 1 vp[MINOR_NUMBER] = 0 end "#{vp[MAJOR_NUMBER]}.#{vp[MINOR_NUMBER]}" end |
.get_version_parts(version) ⇒ Array<String>
Note:
If the original version string contains less than 4 parts, the returned array is filled with zeros at the end to always contain 4 items.
Split a version string into its 4 parts, ensuring its parts count is valid
46 47 48 49 50 51 52 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb', line 46 def self.get_version_parts(version) parts = version.split('.') parts = parts.fill('0', parts.length...4).map(&:to_i) UI.user_error!("Bad version string: #{version}") if parts.length > 4 parts end |
.is_int?(string) ⇒ Bool
Check if a string is an integer
60 61 62 63 64 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb', line 60 def self.is_int?(string) true if Integer(string) rescue StandardError false end |