Class: Fastlane::Wpmreleasetoolkit::Versioning::DerivedBuildCodeFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/versioning/formatters/derived_build_code_formatter.rb

Overview

The ‘DerivedBuildCodeFormatter` class is a specialized build code formatter for derived build codes. It takes in an AppVersion object and derives a build code from it.

Instance Method Summary collapse

Instance Method Details

#build_code(build_code = nil, version:) ⇒ String

Calculate the next derived build code.

This method derives a new build code from the given AppVersion object by concatenating the digit 1, the major version, the minor version, the patch version, and the build number.

to have a consistent signature with other build code formatters.

Parameters:

  • version (AppVersion)

    The AppVersion object to derive the next build code from.

  • build_code (BuildCode) (defaults to: nil)

    A BuildCode object. This parameter is ignored but is included

Returns:

  • (String)

    The formatted build code string.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/formatters/derived_build_code_formatter.rb', line 19

def build_code(build_code = nil, version:)
  format(
    # 1 is appended to the beginning of the string in case there needs to be additional platforms or
    # extensions that could then use a different digit prefix such as 2, etc.
    '1%<major>.2i%<minor>.2i%<patch>.2i%<build_number>.2i',
    major: version.major,
    minor: version.minor,
    patch: version.patch,
    build_number: version.build_number
  )
end