lib/liberty_buildpack/repository/version_resolver.rb
# Resolves a version from a collection of versions.  The +candidate_version+ must be structured like:
#   * up to three numeric components, followed by an optional string component
#   * the final component may be a +
# The resolution returns the maximum of the versions that match the candidate version
#
# @param [TokenizedVersion] candidate_version the version, possibly containing a wildcard, to resolve.  If
#                                             +nil+, substituted with +.
# @param [Array<String>] versions the collection of versions to resolve against
# @return [TokenizedVersion] the resolved version or nil if no matching version is found
Resolves a version from a collection of versions.  The +candidate_version+ must be structured like:
up to three numeric components, followed by an optional string component
the final component may be a +
The resolution returns the maximum of the versions that match the candidate version
Resolves a version from a collection of versions . The + candidate_version + must be structured like : up to three numeric components followed by an optional string component the final component may be a + The resolution returns the maximum of the versions that match the candidate version
def resolve(candidate_version, versions)
          tokenized_candidate_version = safe_candidate_version candidate_version
          tokenized_versions          = versions.map { |version| create_token(version) }.compact
          version = tokenized_versions
                    .select { |tokenized_version| matches? tokenized_candidate_version, tokenized_version }
                    .max { |a, b| a <=> b }
          version
        end
def resolve ( candidate_version , versions ) tokenized_candidate_version = safe_candidate_version candidate_version tokenized_versions = versions . map { | version | create_token ( version ) } . compact version = tokenized_versions . select { | tokenized_version | matches? tokenized_candidate_version , tokenized_version } . max { | a , b | a <=> b } version end
Resolves a version from a collection of versions.
Resolves a version from a collection of versions .
the resolved version or nil if no matching version is found
the resolved version or nil if no matching version is found
TokenizedVersion
candidate_version
versions
versions the collection of versions to resolve against
versions the collection of versions to resolve against