diff --git a/get-lit.ps1 b/get-lit.ps1 index 7392d97..f40148e 100644 --- a/get-lit.ps1 +++ b/get-lit.ps1 @@ -1,6 +1,8 @@ +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" -$LUVI_VERSION = "2.14.0" -$LIT_VERSION = "3.8.5" +$LUVI_VERSION = "2.15.0" +$LIT_VERSION = "3.9.0" # Environment variables take precedence if (test-path env:LUVI_VERSION) { $LUVI_VERSION = $env:LUVI_VERSION } if (test-path env:LIT_VERSION) { $LIT_VERSION = $env:LIT_VERSION } @@ -14,7 +16,17 @@ if (test-path env:LUVI_ARCH) { $LUVI_ARCH = "Windows-ia32" } } -$LUVI_URL = "https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-regular-$LUVI_ARCH.exe" +if ([version]"2.15.0" -le [version]$LUVI_VERSION) { + if ($LUVI_ARCH -eq "Windows-i386") { + $LUVI_ARCH = "Windows-x86" + } + $LUVI_URL = "https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-$LUVI_ARCH-luajit-regular.exe" +} else { + if ($LUVI_ARCH -eq "Windows-x86") { + $LUVI_ARCH = "Windows-ia32" + } + $LUVI_URL = "https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-regular-$LUVI_ARCH.exe" +} $LIT_URL = "https://lit.luvit.io/packages/luvit/lit/v$LIT_VERSION.zip" function Download-File { diff --git a/get-lit.sh b/get-lit.sh index 7cf68b5..d3ae377 100755 --- a/get-lit.sh +++ b/get-lit.sh @@ -1,10 +1,18 @@ #!/bin/sh set -eu -LUVI_VERSION=${LUVI_VERSION:-2.14.0} -LIT_VERSION=${LIT_VERSION:-3.8.5} +LUVI_VERSION=${LUVI_VERSION:-2.15.0} +LIT_VERSION=${LIT_VERSION:-3.9.0} + +LUVI_OS=$(uname -s) +LUVI_ARCH=$(uname -m) + +# 2.15.0 or higher uses a different URL +if [ "2.15.0" = "$(printf '%s\n%s\n' "2.15.0" "$LUVI_VERSION" | sort -V | head -n 1)" ]; then + LUVI_URL="https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-${LUVI_OS}-${LUVI_ARCH}-luajit-regular" +else + LUVI_URL="https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-regular-${LUVI_OS}_$LUVI_ARCH" +fi -LUVI_ARCH=`uname -s`_`uname -m` -LUVI_URL="https://github.com/luvit/luvi/releases/download/v$LUVI_VERSION/luvi-regular-$LUVI_ARCH" LIT_URL="https://lit.luvit.io/packages/luvit/lit/v$LIT_VERSION.zip" # Download Files