From ce122ac13a1e4b7bfc003b80bff02dd694d516ff Mon Sep 17 00:00:00 2001 From: az Date: Fri, 17 Jun 2022 14:11:29 +0200 Subject: [PATCH] add syspec-ide-config.yaml and syspec-office-config.yaml --- .../syspec/infrastructure/SyspecConfigRepo.kt | 8 ++++---- .../provs/syspec/syspec-ide-config.yaml | 14 ++++++++++++++ .../provs/syspec/syspec-office-config.yaml | 5 +++++ .../infrastructure/SyspecConfigRepoKtTest.kt | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/org/domaindrivenarchitecture/provs/syspec/syspec-ide-config.yaml create mode 100644 src/main/resources/org/domaindrivenarchitecture/provs/syspec/syspec-office-config.yaml diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/SyspecConfigRepo.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/SyspecConfigRepo.kt index 3c02b5d..6fc4179 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/SyspecConfigRepo.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/SyspecConfigRepo.kt @@ -4,7 +4,6 @@ import org.domaindrivenarchitecture.provs.configuration.domain.ConfigFileName import org.domaindrivenarchitecture.provs.framework.core.readFromFile import org.domaindrivenarchitecture.provs.framework.core.toYaml import org.domaindrivenarchitecture.provs.framework.core.yamlToType -import org.domaindrivenarchitecture.provs.syspec.domain.CommandSpec import org.domaindrivenarchitecture.provs.syspec.domain.SyspecConfig import java.io.File import java.io.FileWriter @@ -15,10 +14,10 @@ private const val DEFAULT_CONFIG_FILE = "syspec-config.yaml" internal fun findSpecConfigFromFile(file: ConfigFileName? = null): Result = runCatching { val filePath = file?.fileName ?: DEFAULT_CONFIG_FILE if ((filePath == DEFAULT_CONFIG_FILE) && !File(filePath).exists()) { - // provide default config - writeSpecConfigToFile(filePath, SyspecConfig(listOf(CommandSpec("echo just_for_demo", "just_for_demo")))) + // use default ide config + findSpecConfigFromResource("syspec/syspec-ide-config.yaml") } - readFromFile(filePath).yamlToType() + readFromFile(filePath).yamlToType() } @@ -30,5 +29,6 @@ internal fun findSpecConfigFromResource(resourcePath: String): Result