package refactoring
This commit is contained in:
parent
a5856fb422
commit
f5f8ac1bd4
12 changed files with 29 additions and 54 deletions
|
@ -1,7 +1,7 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="cli-MyIdeConfig.yaml" type="Application" factoryName="Application">
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="Kotlin SDK" />
|
||||
<option name="MAIN_CLASS_NAME" value="org.domaindrivenarchitecture.provs.application.CliKt" />
|
||||
<option name="MAIN_CLASS_NAME" value="org.domaindrivenarchitecture.provs.workplace.application.CliKt" />
|
||||
<module name="provs.main" />
|
||||
<option name="PROGRAM_PARAMETERS" value="MyIdeConfig.yaml" />
|
||||
<method v="2">
|
||||
|
|
32
build.gradle
32
build.gradle
|
@ -88,7 +88,7 @@ task fatJar(type: Jar) {
|
|||
manifest {
|
||||
attributes 'Implementation-Title': 'Gradle Jar File Example',
|
||||
'Implementation-Version': project.version,
|
||||
'Main-Class': 'org.domaindrivenarchitecture.provs.application.CliKt'
|
||||
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
||||
}
|
||||
archivesBaseName = project.name + '-all'
|
||||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||
|
@ -108,14 +108,13 @@ task fatJarLatest(type: Jar) {
|
|||
manifest {
|
||||
attributes 'Implementation-Title': 'Gradle Jar File Example',
|
||||
'Implementation-Version': project.version,
|
||||
'Main-Class': 'org.domaindrivenarchitecture.provs.application.CliKt'
|
||||
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
||||
}
|
||||
with jar
|
||||
archiveFileName = 'provs-fat-latest.jar'
|
||||
}
|
||||
|
||||
//create a single Jar with all dependencies incl. Kotlin libs
|
||||
task uberJar(type: Jar) {
|
||||
task uberjarWorkplace(type: Jar) {
|
||||
|
||||
from sourceSets.main.output
|
||||
|
||||
|
@ -130,30 +129,9 @@ task uberJar(type: Jar) {
|
|||
manifest {
|
||||
attributes 'Implementation-Title': 'Gradle Jar File Example',
|
||||
'Implementation-Version': project.version,
|
||||
'Main-Class': 'org.domaindrivenarchitecture.provs.application.CliKt'
|
||||
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
||||
}
|
||||
archiveClassifier = 'uber'
|
||||
}
|
||||
|
||||
//create a single Jar with all dependencies incl. Kotlin libs - as ...-latest
|
||||
task uberJarLatest(type: Jar) {
|
||||
|
||||
from sourceSets.main.output
|
||||
|
||||
dependsOn configurations.runtimeClasspath
|
||||
from {
|
||||
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
|
||||
} {
|
||||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes 'Implementation-Title': 'Gradle Jar File Example',
|
||||
'Implementation-Version': project.version,
|
||||
'Main-Class': 'org.domaindrivenarchitecture.provs.application.CliKt'
|
||||
}
|
||||
archiveFileName = 'provs-latest.jar'
|
||||
archiveFileName = 'provs-workplace.jar'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package org.domaindrivenarchitecture.provs.domain
|
||||
|
||||
enum class WorkplaceType {
|
||||
MINIMAL, OFFICE, IDE
|
||||
}
|
|
@ -2,10 +2,10 @@ package org.domaindrivenarchitecture.provs.extensions.workplace
|
|||
|
||||
import org.domaindrivenarchitecture.provs.core.*
|
||||
import org.domaindrivenarchitecture.provs.core.processors.RemoteProcessor
|
||||
import org.domaindrivenarchitecture.provs.domain.WorkplaceConfig
|
||||
import org.domaindrivenarchitecture.provs.domain.WorkplaceType
|
||||
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceConfig
|
||||
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
|
||||
import org.domaindrivenarchitecture.provs.extensions.workplace.base.*
|
||||
import org.domaindrivenarchitecture.provs.infrastructure.getConfig
|
||||
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
|
||||
import org.domaindrivenarchitecture.provs.ubuntu.git.provisionGit
|
||||
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
|
||||
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstallFromPpa
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package org.domaindrivenarchitecture.provs.application
|
||||
package org.domaindrivenarchitecture.provs.workplace.application
|
||||
|
||||
import org.domaindrivenarchitecture.provs.core.Password
|
||||
import org.domaindrivenarchitecture.provs.core.Prov
|
||||
import org.domaindrivenarchitecture.provs.core.ProvResult
|
||||
import org.domaindrivenarchitecture.provs.domain.WorkplaceConfig
|
||||
import org.domaindrivenarchitecture.provs.domain.WorkplaceType
|
||||
import org.domaindrivenarchitecture.provs.infrastructure.installDevOps
|
||||
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceConfig
|
||||
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
|
||||
import org.domaindrivenarchitecture.provs.workplace.infrastructure.installDevOps
|
||||
|
||||
/**
|
||||
* Use case for provisioning repos
|
|
@ -1,7 +1,7 @@
|
|||
package org.domaindrivenarchitecture.provs.application
|
||||
package org.domaindrivenarchitecture.provs.workplace.application
|
||||
|
||||
import org.domaindrivenarchitecture.provs.core.*
|
||||
import org.domaindrivenarchitecture.provs.infrastructure.getConfig
|
||||
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
|
||||
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.GopassSecretSource
|
||||
import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecretSource
|
||||
|
||||
|
@ -27,7 +27,7 @@ fun main(args: Array<String>) {
|
|||
private fun provision(cliCommand: CliCommand) {
|
||||
val filename = cliCommand.configFileName
|
||||
|
||||
// TODO: mv try-catch down to repository, throw runtime exc.
|
||||
// TODO: improve exceptions
|
||||
try {
|
||||
val conf = getConfig(filename)
|
||||
val password: Secret? = retrievePassword(cliCommand)
|
|
@ -1,4 +1,4 @@
|
|||
package org.domaindrivenarchitecture.provs.application
|
||||
package org.domaindrivenarchitecture.provs.workplace.application
|
||||
|
||||
import kotlinx.cli.ArgParser
|
||||
import kotlinx.cli.ArgType
|
|
@ -1,11 +1,7 @@
|
|||
package org.domaindrivenarchitecture.provs.domain
|
||||
package org.domaindrivenarchitecture.provs.workplace.domain
|
||||
|
||||
import com.charleskorn.kaml.Yaml
|
||||
import org.domaindrivenarchitecture.provs.ubuntu.keys.KeyPairSource
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.domaindrivenarchitecture.provs.core.tags.Api
|
||||
import java.io.*
|
||||
|
||||
|
||||
@Serializable
|
|
@ -0,0 +1,5 @@
|
|||
package org.domaindrivenarchitecture.provs.workplace.domain
|
||||
|
||||
enum class WorkplaceType {
|
||||
MINIMAL, OFFICE, IDE
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package org.domaindrivenarchitecture.provs.infrastructure
|
||||
package org.domaindrivenarchitecture.provs.workplace.infrastructure
|
||||
|
||||
import com.charleskorn.kaml.Yaml
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.domaindrivenarchitecture.provs.core.tags.Api
|
||||
import org.domaindrivenarchitecture.provs.domain.WorkplaceConfig
|
||||
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceConfig
|
||||
import java.io.*
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.domaindrivenarchitecture.provs.infrastructure
|
||||
package org.domaindrivenarchitecture.provs.workplace.infrastructure
|
||||
|
||||
import org.domaindrivenarchitecture.provs.core.Prov
|
||||
import org.domaindrivenarchitecture.provs.core.ProvResult
|
|
@ -1,10 +1,11 @@
|
|||
package org.domaindrivenarchitecture.provs.extensions.workplace
|
||||
|
||||
import org.domaindrivenarchitecture.provs.core.Password
|
||||
import org.domaindrivenarchitecture.provs.domain.WorkplaceType
|
||||
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
|
||||
|
||||
internal class ProvisionWorkplaceKtTest {
|
||||
|
||||
|
@ -34,7 +35,7 @@ internal class ProvisionWorkplaceKtTest {
|
|||
|
||||
// when
|
||||
// in order to test WorkplaceType.OFFICE: fix installing libreoffice for a fresh container as it hangs the first time but succeeds 2nd time
|
||||
val config = readWorkplaceConfigFromFile("src/test/resources/WorkplaceConfigExample.json")
|
||||
val config = getConfig("src/test/resources/WorkplaceConfigExample.json")
|
||||
?: throw Exception("Could not read WorkplaceConfig")
|
||||
val res = a.provisionWorkplace(
|
||||
config.type,
|
||||
|
|
Loading…
Reference in a new issue