From 654d0ea30950d7540e1dae65e4f9476909cc50fd Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sat, 7 Dec 2019 20:23:17 +0000 Subject: [PATCH] Default DENO_INSTALL to $HOME/.local (#89) --- README.md | 2 +- install.sh | 4 ++-- install_test.sh | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5d181bc..3d566cc 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ asdf local deno 0.2.10 ## Environment Variables -- `DENO_INSTALL` - The directory in which to install Deno. This defaults to `$HOME/.deno`. +- `DENO_INSTALL` - The directory in which to install Deno. On Linux, this defaults to `$HOME/.local`. One application of this is a system-wide Shell installation to `/usr/local`: ```sh diff --git a/install.sh b/install.sh index 64f0856..702f449 100755 --- a/install.sh +++ b/install.sh @@ -31,8 +31,8 @@ else deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno_${os}_x64.gz" fi -deno_install=${DENO_INSTALL:-$HOME/.deno} -bin_dir="${deno_install}/bin" +deno_install="${DENO_INSTALL:-$HOME/.local}" +bin_dir="$deno_install/bin" exe="$bin_dir/deno" if [ ! -d "$bin_dir" ]; then diff --git a/install_test.sh b/install_test.sh index 1bdb4bc..e53543c 100755 --- a/install_test.sh +++ b/install_test.sh @@ -5,12 +5,12 @@ set -e # Lint. # TODO(ry) shellcheck -s sh ./*.sh -# Test we can install a specific version. -rm -rf ~/.deno -DENO_INSTALL='' ./install.sh v0.13.0 -~/.deno/bin/deno --version | grep 0.13.0 +# Test that we can install the latest version at the default location. +unset DENO_INSTALL +sh ./install.sh +~/.local/bin/deno --version -# Test we can install the latest version. -rm -rf ~/.deno -DENO_INSTALL="$HOME/.deno-test" sh ./install.sh -~/.deno-test/bin/deno --version +# Test that we can install a specific version at a custom location. +export DENO_INSTALL="$HOME/deno-0.13.0" +./install.sh v0.13.0 +~/deno-0.13.0/bin/deno --version | grep 0.13.0