Class: Fastlane::Wpmreleasetoolkit::Versioning::AbstractVersionCalculator
- Inherits:
-
Object
- Object
- Fastlane::Wpmreleasetoolkit::Versioning::AbstractVersionCalculator
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb
Overview
The ‘AbstractVersionCalculator` class is responsible for performing version calculations and transformations. It can be used as a base class for version calculations that use different versioning schemes. It contains calculation and transformation methods that are shared by all platforms. It has the abstract suffix because it should not be instantiated directly.
Direct Known Subclasses
DateVersionCalculator, MarketingVersionCalculator, SemanticVersionCalculator
Instance Method Summary collapse
-
#next_build_number(version:) ⇒ AppVersion
This method increments the build number component.
-
#next_major_version(version:) ⇒ AppVersion
This method increments the major version component and resets minor, patch, and build number components to zero.
-
#next_minor_version(version:) ⇒ AppVersion
This method increments the minor version component and resets patch and build number components to zero.
-
#next_patch_version(version:) ⇒ AppVersion
This method increments the patch version component and resets the build number component to zero.
-
#previous_patch_version(version:) ⇒ AppVersion
Calculate the previous patch version by decrementing the patch version if it’s not zero.
-
#release_is_hotfix?(version:) ⇒ Boolean
Calculate whether a release is a hotfix release.
Instance Method Details
#next_build_number(version:) ⇒ AppVersion
This method increments the build number component.
62 63 64 65 66 67 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb', line 62 def next_build_number(version:) new_version = version.dup new_version.build_number += 1 new_version end |
#next_major_version(version:) ⇒ AppVersion
This method increments the major version component and resets minor, patch, and build number components to zero.
16 17 18 19 20 21 22 23 24 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb', line 16 def next_major_version(version:) new_version = version.dup new_version.major += 1 new_version.minor = 0 new_version.patch = 0 new_version.build_number = 0 new_version end |
#next_minor_version(version:) ⇒ AppVersion
This method increments the minor version component and resets patch and build number components to zero.
33 34 35 36 37 38 39 40 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb', line 33 def next_minor_version(version:) new_version = version.dup new_version.minor += 1 new_version.patch = 0 new_version.build_number = 0 new_version end |
#next_patch_version(version:) ⇒ AppVersion
This method increments the patch version component and resets the build number component to zero.
48 49 50 51 52 53 54 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb', line 48 def next_patch_version(version:) new_version = version.dup new_version.patch += 1 new_version.build_number = 0 new_version end |
#previous_patch_version(version:) ⇒ AppVersion
Calculate the previous patch version by decrementing the patch version if it’s not zero.
75 76 77 78 79 80 81 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb', line 75 def previous_patch_version(version:) new_version = version.dup new_version.patch -= 1 unless version.patch.zero? new_version.build_number = 0 new_version end |
#release_is_hotfix?(version:) ⇒ Boolean
Calculate whether a release is a hotfix release.
89 90 91 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/abstract_version_calculator.rb', line 89 def release_is_hotfix?(version:) version.patch.positive? end |