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:) ⇒ AppVersion

Calculate the next date-based release version.

If the current month is December, the method prompts the user to determine if the next release will be the first release of the next year. If so, it increments the major version and sets the minor version to 1, resetting the patch and build number components to zero. Otherwise, it calculates the next minor version.

Parameters:

  • version (AppVersion)

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

Returns:

  • (AppVersion)

    The next date-based release version.



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

def next_release_version(version:)
  new_version = version.dup
  first_release_of_year = FastlaneCore::UI.confirm('Is this release the first release of next year?') if Time.now.month == 12
  if first_release_of_year
    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