diff --git a/install.sh b/install.sh index 834c5b8..7b14414 100755 --- a/install.sh +++ b/install.sh @@ -8,22 +8,21 @@ else fi if [ "$OS" = "Windows_NT" ]; then - curl.exe -fsSL "${base_url}denow.bat" -o ./denow.bat - curl.exe -fsSL "${base_url}denow" -o ./denow - chmod +x ./denow + pwsh -Command "v='$1'; irm ${DENOW_DL_BASE_URL}/install.ps1 | iex" + exit 0 +fi + +if command -v curl 2> /dev/null; then + curl -fsSL "${base_url}denow.bat" -o ./denow.bat + curl -fsSL "${base_url}denow" -o ./denow +elif command -v wget 2> /dev/null; then + wget "${base_url}denow.bat" -O ./denow.bat + wget "${base_url}denow" -O ./denow else - if command -v curl 2> /dev/null; then - curl -fsSL "${base_url}denow.bat" -o ./denow.bat - curl -fsSL "${base_url}denow" -o ./denow - elif command -v wget 2> /dev/null; then - wget "${base_url}denow.bat" -O ./denow.bat - wget "${base_url}denow" -O ./denow - else - echo "Neither 'curl' nor 'wget' found." >&2 - exit 1 - fi - chmod +x ./denow + echo "Neither 'curl' nor 'wget' found." >&2 + exit 1 fi +chmod +x ./denow if [ -n "$1" ]; then deno_version="$1" @@ -35,12 +34,7 @@ else exit 1 fi -if [ "$OS" = "Windows_NT" ]; then - powershell -Command "(gc ./denow.bat) -replace '%__DENO_VERSION__%', '$deno_version' | Out-File -encoding ASCII ./denow.bat" - powershell -Command "(gc ./denow.bat) -replace '\$__DENO_VERSION__', '$deno_version' | Out-File -encoding ASCII ./denow" -else - sed -i "s/%__DENO_VERSION__%/$deno_version/g" ./denow.bat - sed -i "s/\$__DENO_VERSION__/$deno_version/g" ./denow -fi +sed -i "s/%__DENO_VERSION__%/$deno_version/g" ./denow.bat +sed -i "s/\$__DENO_VERSION__/$deno_version/g" ./denow echo "Created wrapper! You can use ./denow to launch Deno." diff --git a/install_test.sh b/install_test.sh index 5513457..2b10445 100644 --- a/install_test.sh +++ b/install_test.sh @@ -2,7 +2,7 @@ set -ex python -m http.server 7000 & -sleep 3s # let server get ready +sleep 3 # let server get ready export DENOW_DL_BASE_URL="http://localhost:7000/"