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