Release, ToDos, Refactorings

Cleanup todos and refactor some functions.
This also removes some overloading.
New release v0.12.1
This commit is contained in:
see 2022-06-30 14:00:57 +02:00
parent b265824b63
commit a60b98c8a5
6 changed files with 10 additions and 16 deletions

View file

@ -18,7 +18,7 @@ apply plugin: "kotlinx-serialization"
group = "org.domaindrivenarchitecture.provs"
version = "0.12.1-SNAPSHOT"
version = "release-0.12.1"
repositories {
mavenCentral()

View file

@ -24,7 +24,7 @@ open class CliArgumentsParser(name: String) : CliTargetParser(name) {
val module = modules.first { it.parsed }
return DesktopCliCommand(
DesktopType.valueOf(module.name.uppercase()),
DesktopType.returnIfExists(module.name.uppercase()),
TargetCliCommand(
target,
passwordInteractive

View file

@ -43,8 +43,7 @@ fun Prov.provisionDesktop(
gitEmail: String? = null,
) = task {
// TODO: jem - 2022-06-30: why?? We got already a typed var!
DesktopType.valueOf(desktopType.name) // throws exception when desktopType.name is unknown
DesktopType.returnIfExists(desktopType.name) // throws exception when desktopType.name is unknown
validatePrecondition()
provisionBaseDesktop(gpg, ssh, gitUserName, gitEmail)

View file

@ -17,7 +17,7 @@ open class DesktopType(val name: String) {
@JvmStatic
protected val values = listOf(BASIC, OFFICE, IDE)
fun valueOf(value: String, valueList: List<DesktopType> = values): DesktopType {
fun returnIfExists(value: String, valueList: List<DesktopType> = values): DesktopType {
for (type in valueList) {
if (value.uppercase().equals(type.name)) {
return type

View file

@ -4,8 +4,6 @@ import org.domaindrivenarchitecture.provs.framework.core.cli.createProvInstance
import org.domaindrivenarchitecture.provs.server.domain.ServerType
import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand
import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3s
// TODO: jem - 2022-06-30: unused import
import org.domaindrivenarchitecture.provs.server.infrastructure.provisionServerCliConvenience
import kotlin.system.exitProcess

View file

@ -14,21 +14,17 @@ fun Prov.provisionK3s(cli: K3sCliCommand) = task {
if (cli.submodules == null) {
// full k3s
val k3sConfig: K3sConfig = getK3sConfig(cli.configFileName)
provisionK3s(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
provisionK3sWorker(k3sConfig, grafanaConfigResolved, cli.applicationFileName)
} else {
// submodules only
provisionMeissaDesktopSubmodules(cli.submodules, grafanaConfigResolved)
provisionGrafanaSanitized(cli.submodules, grafanaConfigResolved)
}
// TODO: jem - 2022-06-30: das hier ist auf der falschen Ebene - gehört doch eher in die methode unten
provisionServerCliConvenience()
}
/**
* Installs a k3s server.
*/
// TODO: jem - 2022-06-30: die überladenen methoden sind schwierig - lieber unterschiedlich benennen
fun Prov.provisionK3s(
fun Prov.provisionK3sWorker(
k3sConfig: K3sConfig,
grafanaConfigResolved: GrafanaAgentConfigResolved? = null,
applicationFileName: ApplicationFileName? = null) = task {
@ -56,10 +52,11 @@ fun Prov.provisionK3s(
if (applicationFileName != null) {
provisionK3sApplication(applicationFileName)
}
provisionServerCliConvenience()
}
// TODO: jem - 2022-06-30: warum heisst diese methode meissa?
private fun Prov.provisionMeissaDesktopSubmodules(
private fun Prov.provisionGrafanaSanitized(
submodules: List<String>,
grafanaConfigResolved: GrafanaAgentConfigResolved?) = task {