Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr authored Nov 20, 2023
1 parent 3873526 commit 6b27cd8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion denow
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh
set -e
deno_version="$__DENO_VERSION__"
# https://stackoverflow.com/questions/29832037/how-to-get-script-directory-in-posix-sh
dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
if [ ! -d "$dir/.deno" ]; then
if ! o=$(curl -fsSL https://deno.land/install.sh | DENO_INSTALL="$dir/.deno" sh -s "v$deno_version" 2>&1); then
Expand Down
13 changes: 7 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ else
base_url='https://deno.land/x/denow/'
fi

if [ "$OS" = "Windows_NT" ]; then
pwsh -Command "v='$1'; irm ${DENOW_DL_BASE_URL}/install.ps1 | iex"
exit 0
fi
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}

if command -v curl 2> /dev/null; then
curl -fsSL "${base_url}denow.bat" -o ./denow.bat
Expand All @@ -27,8 +29,7 @@ chmod +x ./denow
if [ -n "$1" ]; then
deno_version="$1"
elif command -v grep 2> /dev/null; then
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
deno_version=$(curl --silent "https://api.github.com/repos/denoland/deno/releases/latest" | grep -Po "(?<=\"tag_name\": \"v).*(?=\")")
deno_version=$(get_latest_release denoland/deno)
else
echo "Unable to fetch latest version" >&2
exit 1
Expand Down

0 comments on commit 6b27cd8

Please sign in to comment.