diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Hugo.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Hugo.kt index 176219d..a149fad 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Hugo.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Hugo.kt @@ -6,15 +6,16 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInsta import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptPurge import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL +// see https://github.com/gohugoio/hugo/releases/ fun Prov.installHugoByDeb() = task { - val sha256sum = "46692ac9b79d5bc01b0f847f6dcf651d8630476de63e598ef61a8da9461d45cd" - val requiredHugoVersion = "0.125.5" - val filename = "hugo_extended_0.125.5_linux-amd64.deb" - val downloadUrl = "-L https://github.com/gohugoio/hugo/releases/download/v$requiredHugoVersion/$filename" + val sha256sum = "e72b3c374348240cfb21cf16a395d8722505b5ff3b1742012b9b3d0a53eaa886" + val version = "0.143.0" + val filename = "hugo_extended_${version}_linux-amd64.deb" + val downloadUrl = "-L https://github.com/gohugoio/hugo/releases/download/v$version/$filename" val downloadDir = "${userHome()}Downloads" val currentHugoVersion = cmdNoEval("hugo version").out ?: "" - if (needsHugoInstall(currentHugoVersion, requiredHugoVersion)) { + if (needsHugoInstall(currentHugoVersion, version)) { if (isHugoInstalled(currentHugoVersion)) { if (currentHugoVersion.contains("snap")) { cmd("snap remove hugo", sudo = true) @@ -82,8 +83,8 @@ fun compareVersions(firstVersion : List<Int>, secondVersion: List<Int>) : String * a version string like: hugo v0.126.1-3d40ab+extended linux/amd64 BuildDate=2024-05-15T10:42:34Z VendorInfo=snap:0.126.1 */ fun getHugoVersionNo(hugoVersion: String) : List<Int> { - var words = hugoVersion.split(" ") - var result = if (words.size > 1) words[1] else words[0] - result = result.split("-")[0].removePrefix("v") - return result.split(".").map { it.toInt() } + val words = hugoVersion.split(" ") + val result = if (words.size > 1) words[1] else words[0] + val versionString = result.split("-")[0].removePrefix("v") + return versionString.split(".").map { it.toInt() } } diff --git a/src/main/resources/version.txt b/src/main/resources/version.txt index 42e6efd..1c47306 100644 --- a/src/main/resources/version.txt +++ b/src/main/resources/version.txt @@ -1 +1 @@ -0.39.7-SNAPSHOT \ No newline at end of file +0.39.8-SNAPSHOT \ No newline at end of file diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/HugoTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/HugoKtTest.kt similarity index 87% rename from src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/HugoTest.kt rename to src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/HugoKtTest.kt index c57a931..0f80812 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/HugoTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/HugoKtTest.kt @@ -6,19 +6,21 @@ import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -internal class HugoTest { +internal class HugoKtTest { @ExtensiveContainerTest fun test_installHugoByDeb() { // given val prov = defaultTestContainer() // when - val res = prov.installHugoByDeb() - val res2 = prov.installHugoByDeb() // check idem-potency + val res = prov.task { + installHugoByDeb() + installHugoByDeb() // check repeatability + cmd("hugo version") // check if hugo is available + } // then assertTrue(res.success) - assertTrue(res2.success) } @Test