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 safe_candidate_version(candidate_version)
          if candidate_version.nil?
            TOKENIZED_WILDCARD
          else
            unless candidate_version.is_a?(LibertyBuildpack::Util::TokenizedVersion)
              raise "Invalid TokenizedVersion '#{candidate_version}'"
            end
            candidate_version
          end
        end
def safe_candidate_version ( candidate_version ) if candidate_version . nil? TOKENIZED_WILDCARD else unless candidate_version . is_a? ( LibertyBuildpack :: Util :: TokenizedVersion ) raise "Invalid TokenizedVersion '#{candidate_version}'" end candidate_version end 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 the collection of versions to resolve against
versions the collection of versions to resolve against