diff --git a/build.gradle b/build.gradle index 85abcf9..c7ec809 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization' group = 'org.domaindrivenarchitecture.provs' -version = '0.8.18' +version = '0.8.19' repositories { mavenCentral() @@ -83,30 +83,17 @@ dependencies { } -//create a single Jar with all dependencies excl. Kotlin libs -task fatJar(type: Jar) { - manifest { - attributes 'Implementation-Title': 'Gradle Jar File Example', - 'Implementation-Version': project.version, - 'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt' - } - archivesBaseName = project.name + '-all' - duplicatesStrategy(DuplicatesStrategy.EXCLUDE) - - from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } - with jar -} - -//create a single Jar with all dependencies excl. Kotlin libs without version-number but with suffix "latest" +//create a single Jar with all dependencies excl. Kotlin libs without version-number task fatJarLatest(type: Jar) { - doFirst { - from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } + from { + configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) } } - duplicatesStrategy(DuplicatesStrategy.EXCLUDE) exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' + duplicatesStrategy(DuplicatesStrategy.EXCLUDE) + manifest { - attributes 'Implementation-Title': 'Gradle Jar File Example', + attributes 'Implementation-Title': 'Fatjar of provs', 'Implementation-Version': project.version, 'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt' } @@ -127,7 +114,7 @@ task uberjarWorkplace(type: Jar) { } manifest { - attributes 'Implementation-Title': 'Gradle Jar File Example', + attributes 'Implementation-Title': 'Uberjar of provs', 'Implementation-Version': project.version, 'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt' } diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/UserConfig.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/UserConfig.kt index 746dc46..236b239 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/UserConfig.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/UserConfig.kt @@ -10,20 +10,3 @@ import java.io.FileWriter @Serializable class UserConfig(val userName: String, val gitEmail: String? = null, val gpg: KeyPairSource? = null, val ssh: KeyPairSource? = null) - - -// -------------------------------------------- file methods ------------------------------------ -@Suppress("unused") -fun readUserConfigFromFile(filename: String = "UserConfig.json") : UserConfig { - // read from file - val inputAsString = BufferedReader(FileReader(filename)).use { it.readText() } - - // serializing objects - return Json.decodeFromString(UserConfig.serializer(), inputAsString) -} - -fun writeUserConfigToFile(config: UserConfig) { - val fileName = "UserConfig.json" - - FileWriter(fileName).use { it.write(Json.encodeToString(UserConfig.serializer(), config)) } -} diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt index 57a5378..5161aef 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt @@ -1,11 +1,13 @@ package org.domaindrivenarchitecture.provs.workplace.application -import org.domaindrivenarchitecture.provs.core.* -import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig +import org.domaindrivenarchitecture.provs.core.Prov +import org.domaindrivenarchitecture.provs.core.Secret +import org.domaindrivenarchitecture.provs.core.local +import org.domaindrivenarchitecture.provs.core.remote import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.GopassSecretSource import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource - -import java.lang.RuntimeException +import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig +import java.io.File /** * Provisions according to the options either a meissa workplace, reposOnly or gopassOnly. @@ -37,9 +39,12 @@ private fun provision(cliCommand: CliCommand) { } catch (e: IllegalArgumentException) { println( "Error: File\u001b[31m $filename \u001b[0m was not found.\n" + - "Pls copy file \u001B[31m MeissaWorkplaceConfigExample.yaml \u001B[0m to file \u001B[31m $filename \u001B[0m " + + "Pls copy file \u001B[31m WorkplaceConfigExample.yaml \u001B[0m to file \u001B[31m $filename \u001B[0m " + "and change the content according to your needs.\n" ) + + // provide example config + File("WorkplaceConfigExample.yaml").writeText("type: \"MINIMAL\"\n") } } diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/ConfigRepository.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/ConfigRepository.kt index 104c0d8..2916658 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/ConfigRepository.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/ConfigRepository.kt @@ -29,7 +29,7 @@ internal fun getConfig(filename: String = "WorkplaceConfig.json"): WorkplaceConf } @Api -internal fun writeConfig(config: WorkplaceConfig, fileName: String = "WorkplaceConfig.yaml") { +internal fun writeConfig(config: WorkplaceConfig, fileName: String = "WorkplaceConfigExample.yaml") { if (fileName.lowercase().endsWith(".yaml")) { FileWriter(fileName).use { it.write(