diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt index 9da60dc..a3526c0 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScript.kt @@ -2,27 +2,32 @@ 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 import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled fun Prov.installShadowCljs(): ProvResult = task { if (!isPackageInstalled("npm")) { - aptInstall("npm") + // installation of npm is too chatty even with quite install and will hang when using Java ProcessBuilder => install with output must be ignored + optional { + // may fail for some packages, but this should in general not be an issue + cmd("sudo apt-get update") + } + cmd("sudo apt-get install -qy apt-utils") + cmd("sudo DEBIAN_FRONTEND=noninteractive apt-get install -qy npm > /dev/null") cmd("sudo npm install -g npx") cmd("sudo npm install -g shadow-cljs") } else { val npmVersion = cmd("npm --version") - ProvResult(true, out = "Package npm v$npmVersion already installed. Checking shadow-cljs now.") - if (chk("npm list -g shadow-cljs|grep empty")) { + addResultToEval(ProvResult(true, out = "Package npm v$npmVersion already installed. Checking shadow-cljs now.")) + if (chk("npm list -g shadow-cljs | grep empty")) { cmd("sudo npm install -g shadow-cljs") } else { - ProvResult(true, out = "Package shadow-cljs already installed.") + addResultToEval(ProvResult(true, out = "Package shadow-cljs already installed.")) } if (chk("npm list -g npx|grep empty")) { cmd("sudo npm install -g npx") } else { - ProvResult(true, out = "Package npx already installed.") + addResultToEval(ProvResult(true, out = "Package npx already installed.")) } } } diff --git a/src/main/resources/version.txt b/src/main/resources/version.txt index 2bee879..42e6efd 100644 --- a/src/main/resources/version.txt +++ b/src/main/resources/version.txt @@ -1 +1 @@ -0.39.6-SNAPSHOT \ No newline at end of file +0.39.7-SNAPSHOT \ No newline at end of file diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt index 916a708..610ff71 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/ClojureScriptKtTest.kt @@ -1,22 +1,23 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure +import org.domaindrivenarchitecture.provs.framework.core.processors.ContainerStartMode 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") + val prov = defaultTestContainer(ContainerStartMode.CREATE_NEW_KILL_EXISTING) // when - val res = defaultTestContainer().installShadowCljs() + val res = prov.installShadowCljs() + val res2 = prov.installShadowCljs() // check if it can be run twice successfully // then assertTrue(res.success) + assertTrue(res2.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 522e0d5..08417d0 100644 --- a/src/testFixtures/kotlin/org/domaindrivenarchitecture/provs/test/TestSetup.kt +++ b/src/testFixtures/kotlin/org/domaindrivenarchitecture/provs/test/TestSetup.kt @@ -41,7 +41,7 @@ private fun initDefaultTestContainer(startMode: ContainerStartMode): Prov { containerProv.sh(""" sudo apt-get update - sudo apt-get upgrade -qqq + sudo apt-get upgrade -qq """.trimIndent()) return containerProv