Skip to content

Commit 681d23d

Browse files
authored
use local deno install sh (#8126)
1 parent bb6785a commit 681d23d

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ before_install:
122122
fi;
123123
- pushd .; cd website; yarn install; popd
124124
# install Deno
125-
- curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.1.2
125+
- sh -s v1.1.2 < ./CI/deno_install.sh
126126
- export PATH="$HOME/.deno/bin:$PATH"
127127

128128
install:

CI/deno_install.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
# Copyright 2019 the Deno authors. All rights reserved. MIT license.
3+
# TODO(everyone): Keep this script simple and easily auditable.
4+
5+
set -e
6+
7+
if ! command -v unzip >/dev/null; then
8+
echo "Error: unzip is required to install Deno (see: https://github.com/denoland/deno_install#unzip-is-required)." 1>&2
9+
exit 1
10+
fi
11+
12+
if [ "$OS" = "Windows_NT" ]; then
13+
target="x86_64-pc-windows-msvc"
14+
else
15+
case $(uname -s) in
16+
Darwin) target="x86_64-apple-darwin" ;;
17+
*) target="x86_64-unknown-linux-gnu" ;;
18+
esac
19+
fi
20+
21+
if [ $# -eq 0 ]; then
22+
deno_uri="https://github.com/denoland/deno/releases/latest/download/deno-${target}.zip"
23+
else
24+
deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno-${target}.zip"
25+
fi
26+
27+
deno_install="${DENO_INSTALL:-$HOME/.deno}"
28+
bin_dir="$deno_install/bin"
29+
exe="$bin_dir/deno"
30+
31+
if [ ! -d "$bin_dir" ]; then
32+
mkdir -p "$bin_dir"
33+
fi
34+
35+
curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri"
36+
unzip -d "$bin_dir" -o "$exe.zip"
37+
chmod +x "$exe"
38+
rm "$exe.zip"
39+
40+
echo "Deno was installed successfully to $exe"
41+
if command -v deno >/dev/null; then
42+
echo "Run 'deno --help' to get started"
43+
else
44+
case $SHELL in
45+
/bin/zsh) shell_profile=".zshrc" ;;
46+
*) shell_profile=".bash_profile" ;;
47+
esac
48+
echo "Manually add the directory to your \$HOME/$shell_profile (or similar)"
49+
echo " export DENO_INSTALL=\"$deno_install\""
50+
echo " export PATH=\"\$DENO_INSTALL/bin:\$PATH\""
51+
echo "Run '$exe --help' to get started"
52+
fi

0 commit comments

Comments
 (0)