dcmeglio / hubitat-packagemanager

BSD 3-Clause "New" or "Revised" License
150 stars 56 forks source link

Suggestion: Make version checking more flexible #55

Closed markus-li closed 4 years ago

markus-li commented 4 years ago

If you updated newVersionAvailable with the below it will strip everything except digits and periods from the version number, that makes it more compatible with existing versioning, like mine: "v1.0.1.0420Tb", with the below addition it would become "1.0.1.0420".


def newVersionAvailable(versionStr, installedVersionStr) {
    if (versionStr == null)
        return false

    versionStr = versionStr.replaceAll("[^\\d.]", "")
    installedVersionStr = installedVersionStr.replaceAll("[^\\d.]", "")
    def installedVersionParts = installedVersionStr.split(/\./)
    def newVersionParts = versionStr.split(/\./)```