From 5fbe77f01398df12347efd051582ba3d31809f19 Mon Sep 17 00:00:00 2001 From: ansgarz Date: Thu, 17 Feb 2022 19:35:59 +0100 Subject: [PATCH] add installation of shadow-cljs to IDE --- .../provs/desktop/domain/DesktopService.kt | 2 ++ .../desktop/infrastructure/ClojureScript.kt | 11 ++++++++++ .../infrastructure/ClojureScriptKtTest.kt | 22 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt create mode 100644 src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt index 4e9fc8a..f46825d 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt @@ -125,6 +125,8 @@ fun Prov.provisionWorkplace( // IDEs installVSC("python", "clojure") aptInstall(CLOJURE_TOOLS) + installShadowCljs() + installIntelliJ() installDevOps() diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt new file mode 100644 index 0000000..1b7975d --- /dev/null +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt @@ -0,0 +1,11 @@ +package org.domaindrivenarchitecture.provs.desktop.infrastructure + +import org.domaindrivenarchitecture.provs.framework.core.Prov +import org.domaindrivenarchitecture.provs.framework.core.ProvResult +import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall + +fun Prov.installShadowCljs(): ProvResult = task { + aptInstall("npm") + cmd("npm install -g npx", sudo = true) + cmd("npm install -g shadow-cljs", sudo = true) +} diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt new file mode 100644 index 0000000..916a708 --- /dev/null +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt @@ -0,0 +1,22 @@ +package org.domaindrivenarchitecture.provs.desktop.infrastructure + +import org.domaindrivenarchitecture.provs.test.defaultTestContainer +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test + +internal class ClojureScriptKtTest { + + @Test + @Disabled // does not run the first time, probably hanging due to "E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 700 (apt-get)" + fun installShadowCljs() { + // given + defaultTestContainer().cmd("sudo apt-get upgrade") + + // when + val res = defaultTestContainer().installShadowCljs() + + // then + assertTrue(res.success) + } +} \ No newline at end of file