commandbox.system.modules.semver.models

Class SemanticVersion

lucee.Component
    extended by commandbox.system.modules.semver.models.SemanticVersion

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.coldbox.org | www.luismajano.com | www.ortussolutions.com Utility to parse and validate semantic versions Semantic version: major.minor.revision-preReleaseID+build http://semver.org/ https://github.com/npm/node-semver

Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
  • author : Luis Majano & Brad Wood
  •  
    Constructor Summary
    init()
          Constructor.
    Method Summary
    private any buildComparatorSet(string set)
    private any buildRange(string range)
    string clean(any version)
         Clean a version string from leading = or v.
    any compare(string current, string target, [boolean checkBuildID='true'])
    private any evaluateComparator(struct comparator, [any version])
    private any expandXRanges(struct sComparator)
    any getDefaultsVersion()
    string getVersionAsString(struct sVersion, [boolean includeBuildID='true'])
         Parse the incoming version struct and output it as a string.
    private any interestedInPreReleasesOfThisVersion(array comparatorSet, string version)
    boolean isEQ(string current, string target, [boolean checkBuildID='true'])
         Checks if the versions are equal.
    boolean isExactVersion(string version, [any includeBuildID='false'])
         True if a specific version, false if a range that could match multiple versions.
    boolean isNew(string current, string target, [boolean checkBuildID='true'])
         Checks if target version is a newer semantic version than the passed current version.
    boolean isPreRelease(string version)
         Verifies if the passed version string is in a pre-release state.
    struct parseVersion(string version, [any missingValuePlaceholder])
         Parse the semantic version.
    string parseVersionAsString(string version, [boolean includeBuildID='true'])
         Parse the incoming version string and conform it to semantic version.
    any preReleaseCompare([any targetPreReleaseID], [any currentPreReleaseID])
    any preReleaseCompareSegment([any targetPreReleaseID], [any currentPreReleaseID])
    boolean satisfies(string version, string range)
         Decides whether a version satisfies a range.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()

    Constructor


    Method Detail

    buildComparatorSet

    private any buildComparatorSet(string set)

    Parameters:
    set

    buildRange

    private any buildRange(string range)

    Parameters:
    range

    clean

    public string clean(any version)

    Clean a version string from leading = or v

    Parameters:
    version

    compare

    public any compare(string current, string target, [boolean checkBuildID='true'])

    Parameters:
    current
    target
    checkBuildID

    evaluateComparator

    private any evaluateComparator(struct comparator, [any version])

    Parameters:
    comparator
    version

    expandXRanges

    private any expandXRanges(struct sComparator)

    Parameters:
    sComparator

    getDefaultsVersion

    public any getDefaultsVersion()


    getVersionAsString

    public string getVersionAsString(struct sVersion, [boolean includeBuildID='true'])

    Parse the incoming version struct and output it as a string

    Parameters:
    sVersion
    includeBuildID
    Returns:
    string:{major.minor.revision[-preReleaseID]+buildid}

    interestedInPreReleasesOfThisVersion

    private any interestedInPreReleasesOfThisVersion(array comparatorSet, string version)

    Parameters:
    comparatorSet
    version

    isEQ

    public boolean isEQ(string current, string target, [boolean checkBuildID='true'])

    Checks if the versions are equal current.hint The current version of the system target.hint The target version to check

    Parameters:
    current
    target
    checkBuildID

    isExactVersion

    public boolean isExactVersion(string version, [any includeBuildID='false'])

    True if a specific version, false if a range that could match multiple versions version.hint A string that contains a version or a range

    Parameters:
    version
    includeBuildID

    isNew

    public boolean isNew(string current, string target, [boolean checkBuildID='true'])

    Checks if target version is a newer semantic version than the passed current version Note: To confirm to semvar, I think this needs to defer to gt().

    Parameters:
    current - The current version of the system
    target - The newer version received
    checkBuildID - If true it will check build equality, else it will ignore it

    isPreRelease

    public boolean isPreRelease(string version)

    Verifies if the passed version string is in a pre-release state Pre-release is defined by the existance of a preRelease ID

    Parameters:
    version

    parseVersion

    public struct parseVersion(string version, [any missingValuePlaceholder])

    Parse the semantic version. If no minor found, then 0. If not revision found, then 0. If not Bleeding Edge bit, then empty. If not buildID, then 0

    Parameters:
    version
    missingValuePlaceholder
    Returns:
    struct:{major,minor,revision,preReleaseID,buildid}

    parseVersionAsString

    public string parseVersionAsString(string version, [boolean includeBuildID='true'])

    Parse the incoming version string and conform it to semantic version. If preReleaseID is not found it is omitted.

    Parameters:
    version
    includeBuildID
    Returns:
    string:{major.minor.revision[-preReleaseID]+buildid}

    preReleaseCompare

    public any preReleaseCompare([any targetPreReleaseID], [any currentPreReleaseID])

    Parameters:
    targetPreReleaseID
    currentPreReleaseID

    preReleaseCompareSegment

    public any preReleaseCompareSegment([any targetPreReleaseID], [any currentPreReleaseID])

    Parameters:
    targetPreReleaseID
    currentPreReleaseID

    satisfies

    public boolean satisfies(string version, string range)

    Decides whether a version satisfies a range

    Parameters:
    version
    range