Clean up install.sh and bump to v0.2.7 (#27)

This commit is contained in:
Ryan Dahl 2019-01-15 19:43:12 -05:00 committed by GitHub
parent 0f88ed1d63
commit 9ff2b1432a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 66 deletions

View file

@ -14,7 +14,7 @@ matrix:
- ./install.py
- ./install_test.py
- language: sh
- language: bash
os:
- linux
addons:
@ -31,25 +31,7 @@ matrix:
- curl --version
- shellcheck --version
- curl -sSL "$SHFMT_DOWNLOAD_URL" -o $HOME/bin/shfmt;
chmod +x $HOME/bin/shfmt;
shfmt --version
script:
- echo "Linting installer script using \`shellcheck\`:";
shellcheck -s sh *.sh;
shellcheck -s dash *.sh;
shellcheck -s ksh *.sh;
shellcheck -s bash *.sh
- echo "Checking script formatting using \`shfmt\`:";
shfmt -d -p -i 2 -ci .
- echo "Running test suite inside supported shells:";
echo "\`sh\`:"; sh ./install_test.sh;
echo "\`dash\`:"; dash ./install_test.sh;
echo "\`ksh\`:"; ksh ./install_test.sh;
echo "\`bash\`:"; bash ./install_test.sh;
echo "\`zsh\`:"; zsh ./install_test.sh
- language: bash
os:
- osx
- chmod +x $HOME/bin/shfmt;
- shfmt --version
script:
- ./install_test.sh

View file

@ -5,31 +5,34 @@
set -e
if [ $# -eq 0 ]; then
version="v0.2.6"
version="v0.2.7"
else
version=$1
version=$1
fi
deno_dir="$HOME/.deno/bin"
bin_dir="$HOME/.deno/bin"
exe="$bin_dir/deno"
if [ ! -d "$deno_dir" ]; then
mkdir -p "$deno_dir"
if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi
case $(uname -s) in
Darwin) os="osx" ;;
*) os="linux" ;;
Darwin) os="osx" ;;
*) os="linux" ;;
esac
deno_uri="https://github.com/denoland/deno/releases/download/${version}/deno_${os}_x64.gz"
curl -fL# -o "$deno_dir/deno.gz" "$deno_uri"
gunzip -df "$deno_dir/deno.gz"
chmod +x "$deno_dir/deno"
curl -fL# -o "$exe.gz" "$deno_uri"
gunzip -df "$exe.gz"
chmod +x "$exe"
echo "Deno was installed successfully."
echo "Deno was installed successfully to $exe"
if command -v deno >/dev/null; then
echo "Run 'deno --help' to get started."
echo "Run 'deno --help' to get started."
else
echo "Run '~/.deno/bin/deno --help' to get started."
echo "Manually add the directory to your \$HOME/.bash_profile (or similar)"
echo " export PATH=\"$bin_dir:\$PATH\""
echo "Run '$exe --help' to get started."
fi

View file

@ -1,40 +1,17 @@
#!/bin/sh
set -e
chmod +x install.sh
set -ev
# PATH tests
rm -rf ~/.deno
./install.sh | grep -e "Run '~/.deno/bin/deno --help' to get started."
~/.deno/bin/deno --help
PATH=$PATH:~/.deno/bin
rm -rf ~/.deno
./install.sh | grep -e "Run 'deno --help' to get started."
deno --help
# Version tests
# Lint.
shellcheck -s sh ./*.sh
shfmt -d .
# Test we can install a specific version
rm -rf ~/.deno
./install.sh v0.2.0
deno -v | grep -e 0.2.0
# End-to-end tests
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
repo=$TRAVIS_REPO_SLUG
branch=$TRAVIS_BRANCH
else
repo=$TRAVIS_PULL_REQUEST_SLUG
branch=$TRAVIS_PULL_REQUEST_BRANCH
fi
e2e_url=https://raw.githubusercontent.com/$repo/$branch/install.sh
~/.deno/bin/deno -v | grep -e 0.2.0
# Test we can get the latest version.
rm -rf ~/.deno
curl -sSL "$e2e_url" | $SHELL
deno -v
rm -rf ~/.deno
curl -sSL "$e2e_url" | $SHELL -s v0.2.0
deno -v | grep -e 0.2.0
sh ./install.sh
~/.deno/bin/deno -v