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" group = "org.domaindrivenarchitecture.provs"
version = "0.12.1-SNAPSHOT" version = "release-0.12.1"
repositories { repositories {
mavenCentral() mavenCentral()

View file

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

View file

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

View file

@ -17,7 +17,7 @@ open class DesktopType(val name: String) {
@JvmStatic @JvmStatic
protected val values = listOf(BASIC, OFFICE, IDE) 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) { for (type in valueList) {
if (value.uppercase().equals(type.name)) { if (value.uppercase().equals(type.name)) {
return type 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.ServerType
import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sCliCommand
import org.domaindrivenarchitecture.provs.server.domain.k3s.provisionK3s 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 import kotlin.system.exitProcess

View file

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