Class: Fastlane::Wpmreleasetoolkit::Versioning::DateVersionCalculator

Inherits:
AbstractVersionCalculator show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb

Overview

The ‘DateVersionCalculator` class is a specialized version calculator for date-based versions of an app, extending the `AbstractVersionCalculator` class.

Instance Method Summary collapse

Methods inherited from AbstractVersionCalculator

#next_build_number, #next_major_version, #next_minor_version, #next_patch_version, #previous_patch_version, #release_is_hotfix?

Instance Method Details

#next_release_version(version:, increment_to_next_year: false) ⇒ AppVersion

Calculate the next date-based release version.

When increment_to_next_year is true, increments the major version (representing the year) and resets all other components (minor to 1, patch and build number to 0). Otherwise, calculates the next minor version using the parent class implementation.

Parameters:

  • version (AppVersion)

    The version to calculate the next date-based release version for.

  • increment_to_next_year (Boolean) (defaults to: false)

    Whether to increment the version to the next year. Defaults to false.

Returns:

  • (AppVersion)

    The next date-based release version.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/calculators/date_version_calculator.rb', line 20

def next_release_version(version:, increment_to_next_year: false)
  if increment_to_next_year
    new_version = version.dup
    new_version.major += 1
    new_version.minor = 1
    new_version.patch = 0
    new_version.build_number = 0

    new_version
  else
    next_minor_version(version: version)
  end
end