All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kiwiproject.changelog.config.RepoConfig.kt Maven / Gradle / Ivy

package org.kiwiproject.changelog.config

data class RepoConfig(
    val url: String,
    val apiUrl: String,
    val token: String,
    val repository: String,
    val previousRevision: String,
    val revision: String,
    private val milestone: String?
) {

    // Accepts v.. and optionally a "pre-release" version
    // such as "-beta" or any other characters after the patch version.
    private val revisionPattern = Regex("v\\d+\\.\\d+\\.\\d+.*")

    fun milestone(): String {
        if (milestone != null) {
            return milestone
        }

        require(revisionPattern.matches(revision)) {
            "revision should be in the format v.."
        }

        return revision.substring(1)
    }

    fun repoUrl(): String {
        return "$url/$repository"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy