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

org.icroco.cococha.generator.model.kt Maven / Gradle / Ivy

There is a newer version: 1.1.3
Show newest version
package org.icroco.cococha.generator

import java.time.LocalDate


enum class CommitType(val displayPriority: Int, val prefix: String, val fullName: String) : Comparable {
    BUILD(5, "build", "Builds"),
    TEST(6, "test", "Tests"),
    CI(9, "ci", "Continuous Integration"),
    CHORE(8, "chore", "Chores"),
    DOCS(7, "docs", "Documentation"),
    FEAT(1, "feat", "Features"),
    BUG_FIX(0, "fix", "Bug Fixes"),
    PERFORMANCE(2, "perf", "Performance Improvements"),
    STYLE(10, "style", "Styles"),
    REVERT(3, "revert", "Reverts"),
    REFACTOR(4, "refactor", "Code Refactoring"),
    UNKNOWN(1000, "unknown", "Others");

    companion object {
        public fun of(value: String, defaultValue: CommitType? = null): CommitType {
            for (type in values()) {
                if (type.prefix.equals(value, true)) {
                    return type
                }
            }
            return defaultValue
                    ?: throw IllegalStateException("Unknown commit type: '$value'. values: '${buildPattern()}'")
        }

        fun buildPattern(): String {
            return values().joinToString("|") { it.prefix }
        }

        val sortByPrio = compareBy() { it.displayPriority }
    }
}

data class CommitDesc(val type: CommitType,
                      val component: String?,
                      val description: String,
                      val issueIds: Set,
                      val commitId: String);


data class Category(val name: String, val messages: List)

data class Release(val name: String, val date: LocalDate, val messages: Map>) {
    fun categories(): List {
        return messages.entries.map { e -> Category(e.key, e.value) }
    }
}

data class Releases(val releases: List,
                    val gitUrl: String?,
                    val issueUrl: String?,
                    val header: String? = null,
                    val footer: String? = null)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy