From 5ba6e748b71280ba81c57a89736c5bd8ff1e1a53 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 23 Aug 2016 23:07:42 -0700 Subject: [PATCH 1/3] [Tests] run shellcheck in tests. --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 39c5a44..10e522e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,18 @@ before_install: - $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL - curl --version - wget --version + - if [ -n "${SHELLCHECK-}" ]; then echo "deb http://archive.ubuntu.com/ubuntu/ wily universe" | sudo tee -a /etc/apt/sources.list && sudo apt-get update -q && sudo apt-get install shellcheck -y && shellcheck --version ; fi install: - (mkdir /tmp/urchin && cd /tmp/urchin && curl -s "$(curl -s https://registry.npmjs.com/urchin | grep -Eo '"tarball":\s*"[^"]+"' | tail -n 1 | awk -F\" '{ print $4 }')" -O && tar -x -f urchin*) - chmod +x /tmp/urchin/package/urchin - '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y' script: - export PATH=$(echo $PATH | sed 's/::/:/') - - NVM_DIR=$TRAVIS_BUILD_DIR make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin/package/urchin test-$SHELL + - export NVM_DIR="${TRAVIS_BUILD_DIR}" + - if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh && shellcheck -s bash install.sh ; fi + - if [ -z "${SHELLCHECK-}" ]; then make TEST_SUITE=$TEST_SUITE URCHIN=/tmp/urchin/package/urchin test-$SHELL ; fi env: + - SHELLCHECK=true - SHELL=bash TEST_SUITE=install_script - SHELL=sh TEST_SUITE=fast - SHELL=dash TEST_SUITE=fast From d0180f7eb2614c297bf527fd6d65390b445e7943 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 24 Aug 2016 00:11:50 -0700 Subject: [PATCH 2/3] [shellcheck] build from source to get v0.4.4 --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 10e522e..e891e22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,14 @@ addons: apt_packages: - zsh - ksh +cache: + directories: + - $HOME/.stack before_install: - $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL - curl --version - wget --version - - if [ -n "${SHELLCHECK-}" ]; then echo "deb http://archive.ubuntu.com/ubuntu/ wily universe" | sudo tee -a /etc/apt/sources.list && sudo apt-get update -q && sudo apt-get install shellcheck -y && shellcheck --version ; fi + - if [ -n "${SHELLCHECK-}" ]; then sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 575159689BEFB442 && echo 'deb http://download.fpcomplete.com/ubuntu precise main' | sudo tee /etc/apt/sources.list.d/fpco.list && sudo apt-get update && sudo apt-get install stack bc -y && stack setup && stack install ShellCheck && shellcheck --version ; fi install: - (mkdir /tmp/urchin && cd /tmp/urchin && curl -s "$(curl -s https://registry.npmjs.com/urchin | grep -Eo '"tarball":\s*"[^"]+"' | tail -n 1 | awk -F\" '{ print $4 }')" -O && tar -x -f urchin*) - chmod +x /tmp/urchin/package/urchin From 85c5e1271011c3f18b2d9759be4ef96851a93e5f Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 24 Aug 2016 00:50:08 -0700 Subject: [PATCH 3/3] [Refactor] `install.sh`: use curlies in a few places. --- install.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 7f272ee..b80c907 100755 --- a/install.sh +++ b/install.sh @@ -240,24 +240,24 @@ nvm_check_global_modules() { } nvm_do_install() { - if [ -z "$METHOD" ]; then + if [ -z "${METHOD}" ]; then # Autodetect install method - if nvm_has "git"; then + if nvm_has git; then install_nvm_from_git - elif nvm_has "nvm_download"; then + elif nvm_has nvm_download; then install_nvm_as_script else - echo >&2 "You need git, curl, or wget to install nvm" + echo >&2 'You need git, curl, or wget to install nvm' exit 1 fi - elif [ "~$METHOD" = "~git" ]; then - if ! nvm_has "git"; then + elif [ "${METHOD}" = 'git' ]; then + if ! nvm_has git; then echo >&2 "You need git to install nvm" exit 1 fi install_nvm_from_git - elif [ "~$METHOD" = "~script" ]; then - if ! nvm_has "nvm_download"; then + elif [ "${METHOD}" = 'script' ]; then + if ! nvm_has nvm_download; then echo >&2 "You need curl or wget to install nvm" exit 1 fi