diff --git a/build.gradle b/build.gradle index c7ec809..d06a113 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization' group = 'org.domaindrivenarchitecture.provs' -version = '0.8.19' +version = '0.8.20' repositories { mavenCentral() diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplace.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplace.kt index aafd340..e4b4cf0 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplace.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplace.kt @@ -2,7 +2,6 @@ package org.domaindrivenarchitecture.provs.extensions.workplace import org.domaindrivenarchitecture.provs.core.* import org.domaindrivenarchitecture.provs.core.processors.RemoteProcessor -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.workplace.infrastructure.getConfig @@ -17,6 +16,7 @@ import org.domaindrivenarchitecture.provs.ubuntu.secret.secretSources.PromptSecr import org.domaindrivenarchitecture.provs.ubuntu.user.base.currentUserCanSudo import org.domaindrivenarchitecture.provs.ubuntu.user.base.makeUserSudoerWithNoSudoPasswordRequired import org.domaindrivenarchitecture.provs.ubuntu.user.base.whoami +import org.domaindrivenarchitecture.provs.workplace.infrastructure.installDevOps import java.net.InetAddress import kotlin.system.exitProcess @@ -97,6 +97,8 @@ fun Prov.provisionWorkplace( // IDEs cmd("sudo snap install intellij-idea-community --classic") installVSC("python", "clojure") + + installDevOps() } ProvResult(true) // dummy diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Application.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Application.kt index 3f1c50d..2176f11 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Application.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Application.kt @@ -1,18 +1,15 @@ 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.core.Secret +import org.domaindrivenarchitecture.provs.extensions.workplace.provisionWorkplace 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 + * Use case for provisioning a workplace */ -fun Prov.provision(conf: WorkplaceConfig) = def { - if (conf.type == WorkplaceType.IDE) { - installDevOps() +fun Prov.provision(conf: WorkplaceConfig, password: Secret?) = def { + with (conf) { + provisionWorkplace(type, ssh?.keyPair(), gpg?.keyPair(), gitUserName, gitEmail, password) } - ProvResult(true) } 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 5161aef..e765e4f 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/application/Cli.kt @@ -35,7 +35,7 @@ private fun provision(cliCommand: CliCommand) { val password: Secret? = retrievePassword(cliCommand) val prov: Prov = createProvInstance(cliCommand, password) - prov.provision(conf) + prov.provision(conf, password) } catch (e: IllegalArgumentException) { println( "Error: File\u001b[31m $filename \u001b[0m was not found.\n" +