mirror of
https://github.com/danbulant/deno_install
synced 2026-05-24 12:32:17 +00:00
Clean up install.sh and bump to v0.2.7 (#27)
This commit is contained in:
parent
0f88ed1d63
commit
9ff2b1432a
3 changed files with 28 additions and 66 deletions
24
.travis.yml
24
.travis.yml
|
|
@ -14,7 +14,7 @@ matrix:
|
||||||
- ./install.py
|
- ./install.py
|
||||||
- ./install_test.py
|
- ./install_test.py
|
||||||
|
|
||||||
- language: sh
|
- language: bash
|
||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
addons:
|
addons:
|
||||||
|
|
@ -31,25 +31,7 @@ matrix:
|
||||||
- curl --version
|
- curl --version
|
||||||
- shellcheck --version
|
- shellcheck --version
|
||||||
- curl -sSL "$SHFMT_DOWNLOAD_URL" -o $HOME/bin/shfmt;
|
- curl -sSL "$SHFMT_DOWNLOAD_URL" -o $HOME/bin/shfmt;
|
||||||
chmod +x $HOME/bin/shfmt;
|
- chmod +x $HOME/bin/shfmt;
|
||||||
shfmt --version
|
- 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
|
|
||||||
script:
|
script:
|
||||||
- ./install_test.sh
|
- ./install_test.sh
|
||||||
|
|
|
||||||
25
install.sh
25
install.sh
|
|
@ -5,31 +5,34 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
version="v0.2.6"
|
version="v0.2.7"
|
||||||
else
|
else
|
||||||
version=$1
|
version=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deno_dir="$HOME/.deno/bin"
|
bin_dir="$HOME/.deno/bin"
|
||||||
|
exe="$bin_dir/deno"
|
||||||
|
|
||||||
if [ ! -d "$deno_dir" ]; then
|
if [ ! -d "$bin_dir" ]; then
|
||||||
mkdir -p "$deno_dir"
|
mkdir -p "$bin_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin) os="osx" ;;
|
Darwin) os="osx" ;;
|
||||||
*) os="linux" ;;
|
*) os="linux" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
deno_uri="https://github.com/denoland/deno/releases/download/${version}/deno_${os}_x64.gz"
|
deno_uri="https://github.com/denoland/deno/releases/download/${version}/deno_${os}_x64.gz"
|
||||||
|
|
||||||
curl -fL# -o "$deno_dir/deno.gz" "$deno_uri"
|
curl -fL# -o "$exe.gz" "$deno_uri"
|
||||||
gunzip -df "$deno_dir/deno.gz"
|
gunzip -df "$exe.gz"
|
||||||
chmod +x "$deno_dir/deno"
|
chmod +x "$exe"
|
||||||
|
|
||||||
echo "Deno was installed successfully."
|
echo "Deno was installed successfully to $exe"
|
||||||
if command -v deno >/dev/null; then
|
if command -v deno >/dev/null; then
|
||||||
echo "Run 'deno --help' to get started."
|
echo "Run 'deno --help' to get started."
|
||||||
else
|
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
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,17 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -ev
|
||||||
chmod +x install.sh
|
|
||||||
|
|
||||||
# PATH tests
|
# Lint.
|
||||||
|
shellcheck -s sh ./*.sh
|
||||||
rm -rf ~/.deno
|
shfmt -d .
|
||||||
./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
|
|
||||||
|
|
||||||
|
# Test we can install a specific version
|
||||||
rm -rf ~/.deno
|
rm -rf ~/.deno
|
||||||
./install.sh v0.2.0
|
./install.sh v0.2.0
|
||||||
deno -v | grep -e 0.2.0
|
~/.deno/bin/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
|
|
||||||
|
|
||||||
|
# Test we can get the latest version.
|
||||||
rm -rf ~/.deno
|
rm -rf ~/.deno
|
||||||
curl -sSL "$e2e_url" | $SHELL
|
sh ./install.sh
|
||||||
deno -v
|
~/.deno/bin/deno -v
|
||||||
|
|
||||||
rm -rf ~/.deno
|
|
||||||
curl -sSL "$e2e_url" | $SHELL -s v0.2.0
|
|
||||||
deno -v | grep -e 0.2.0
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue