diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt index 2d832f7..7fee114 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/domain/ProvisionWorkplace.kt @@ -69,7 +69,7 @@ fun Prov.provisionWorkplace( installGopass() aptInstallFromPpa("nextcloud-devs", "client", "nextcloud-client") - optional() { + optional { aptInstall(DRAWING_TOOLS) } @@ -91,6 +91,7 @@ fun Prov.provisionWorkplace( // IDEs installVSC("python", "clojure") + //installVSC("python", "clojure") installIntelliJ() installDevOps() diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/VSCode.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/VSCode.kt index ef5e69e..d6f204a 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/VSCode.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/VSCode.kt @@ -14,12 +14,15 @@ fun Prov.installVSC(vararg options: String) = requireAll { prerequisitesVSCinstall() installVSCPackage() + installVSCodiumPackage() if (options.contains("clojure")) { - installExtensions(clojureExtensions) + installExtensionsCode(clojureExtensions) + installExtensionsCodium(clojureExtensions) } if (options.contains("python")) { - installExtensions(pythonExtensions) + installExtensionsCode(pythonExtensions) + installExtensionsCodium(pythonExtensions) } provisionAdditionalTools() @@ -57,8 +60,12 @@ private fun Prov.installVSCPackage() = def { // installVscWithApt() } +private fun Prov.installVSCodiumPackage() = def { + cmd("sudo snap install codium --classic") +} -private fun Prov.installExtensions(extensions: List) = optional { + +private fun Prov.installExtensionsCode(extensions: List) = optional { var res = ProvResult(true) for (ext in extensions) { res = cmd("code --install-extension $ext") @@ -67,10 +74,20 @@ private fun Prov.installExtensions(extensions: List) = optional { // Settings can be found at $HOME/.config/Code/User/settings.json } +private fun Prov.installExtensionsCodium(extensions: List) = optional { + var res = ProvResult(true) + for (ext in extensions) { + res = cmd("codium --install-extension $ext") + } + res + // Settings can be found at $HOME/.config/Code/User/settings.json +} -private fun Prov.provisionAdditionalTools() = requireAll { + +internal fun Prov.provisionAdditionalTools() = requireAll { // Joker - cmd("curl -Lo joker-0.12.2-linux-amd64.zip https://github.com/candid82/joker/releases/download/v0.12.2/joker-0.12.2-linux-amd64.zip") - cmd("unzip joker-0.12.2-linux-amd64.zip") + val version = "0.18.0" + cmd("curl -Lo joker-${version}-linux-amd64.zip https://github.com/candid82/joker/releases/download/v${version}/joker-${version}-linux-amd64.zip") + cmd("unzip joker-${version}-linux-amd64.zip") cmd("sudo mv joker /usr/local/bin/") } diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/VSCodeKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/VSCodeKtTest.kt new file mode 100644 index 0000000..ba3d988 --- /dev/null +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/VSCodeKtTest.kt @@ -0,0 +1,22 @@ +package org.domaindrivenarchitecture.provs.workplace.infrastructure + +import org.domaindrivenarchitecture.provs.test.defaultTestContainer +import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall +import org.junit.jupiter.api.Test + +import org.junit.jupiter.api.Assertions.* + +internal class VSCodeKtTest { + + @Test + fun provisionAdditionalTools() { + // given + defaultTestContainer().aptInstall("curl unzip") + + // when + val res = defaultTestContainer().provisionAdditionalTools() + + // then + assertTrue(res.success) + } +} \ No newline at end of file diff --git a/src/testFixtures/kotlin/org/domaindrivenarchitecture/provs/test/TestSetup.kt b/src/testFixtures/kotlin/org/domaindrivenarchitecture/provs/test/TestSetup.kt index 8f13a99..2016210 100644 --- a/src/testFixtures/kotlin/org/domaindrivenarchitecture/provs/test/TestSetup.kt +++ b/src/testFixtures/kotlin/org/domaindrivenarchitecture/provs/test/TestSetup.kt @@ -8,7 +8,7 @@ import org.domaindrivenarchitecture.provs.core.docker.dockerimages.UbuntuPlusUse import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode import org.domaindrivenarchitecture.provs.core.processors.ContainerUbuntuHostProcessor -val testDockerWithSudo = !"true".equals(System.getProperty("testdockerwithoutsudo")?.lowercase()) +val testDockerWithSudo = ("true" != System.getProperty("testdockerwithoutsudo")?.lowercase()) const val defaultTestContainerName = "provs_test"