diff --git a/bin/install b/bin/install index 9a24943..ae74822 100755 --- a/bin/install +++ b/bin/install @@ -52,7 +52,8 @@ asdf_yarn_v1_download() { } asdf_yarn_v1_install() { - local ASDF_YARN_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)" + local ASDF_YARN_DIR + ASDF_DATA_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)" ( cd "${ASDF_YARN_DIR}" @@ -82,7 +83,8 @@ asdf_yarn_v1_install() { } asdf_yarn_v2_plus_install() { - local ASDF_YARN_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)" + local ASDF_YARN_DIR + ASDF_YARN_DIR="$(mktemp -d -t asdf-yarn-XXXXXXX)" ( cd "${ASDF_YARN_DIR}" @@ -91,7 +93,7 @@ asdf_yarn_v2_plus_install() { wget -O yarn "https://repo.yarnpkg.com/${ASDF_INSTALL_VERSION}/packages/yarnpkg-cli/bin/yarn.js" else if [ -x "$(which curl)" ]; then - curl -sSL -o yarn "https://repo.yarnpkg.com/${ASDF_INSTALL_VERSION}/packages/yarnpkg-cli/bin/yarn.js" + curl -sSL -o yarn "https://repo.yarnpkg.com/${ASDF_INSTALL_VERSION}/packages/yarnpkg-cli/bin/yarn.js" fi fi ) @@ -110,8 +112,9 @@ asdf_yarn_v2_plus_install() { mv "${ASDF_YARN_DIR}/yarn" "${ASDF_INSTALL_PATH}/bin/yarn" } -asdf_yarn_install(){ - local MAJOR_VERSION="$(printf %.1s $ASDF_INSTALL_VERSION)" +asdf_yarn_install() { + local MAJOR_VERSION + MAJOR_VERSION=$(printf %.1s "$ASDF_INSTALL_VERSION") if [ "$MAJOR_VERSION" = "1" ]; then asdf_yarn_v1_install else @@ -122,7 +125,7 @@ asdf_yarn_install(){ [ "${ASDF_INSTALL_TYPE}" == 'ref' ] && asdf_yarn_fail "This plugin does not support installing by ref." [ -z "${ASDF_INSTALL_VERSION}" ] && asdf_yarn_fail "Unspecified install version." [ -z "${ASDF_INSTALL_PATH}" ] && asdf_yarn_fail "No installation directory was provided. Are you running this command via asdf? Try running 'asdf install yarn '" -[ -x "$(which wget)" -o -x "$(which curl)" ] || asdf_yarn_fail "Missing one of either of the following dependencies: wget, curl" -[ -x "$(which tar)" -a -x "$(which gpg)" ] || asdf_yarn_fail "Missing one or more of the following dependencies: tar, gpg" +[ -x "$(which wget)" ] || [ -x "$(which curl)" ] || asdf_yarn_fail "Missing one of either of the following dependencies: wget, curl" +{ [ -x "$(which tar)" ] && [ -x "$(which gpg)" ]; } || asdf_yarn_fail "Missing one or more of the following dependencies: tar, gpg" -asdf_yarn_install $* +asdf_yarn_install "$@" diff --git a/bin/list-all b/bin/list-all index ed7b8fc..ddbffd5 100755 --- a/bin/list-all +++ b/bin/list-all @@ -3,17 +3,17 @@ set -o nounset -o pipefail -o errexit IFS=$'\t\n' -VERSIONS_CLASSIC="$(git ls-remote --refs --tags "https://github.com/yarnpkg/yarn.git" \ -| sed -E 's|^.+refs/tags/||g' \ -| grep -E '^v' \ -| sort --version-sort \ -| sed -E 's|^v||g' \ -| grep -Ev '^0\.' \ -| xargs)" +VERSIONS_CLASSIC="$(git ls-remote --refs --tags "https://github.com/yarnpkg/yarn.git" | + sed -E 's|^.+refs/tags/||g' | + grep -E '^v' | + sort --version-sort | + sed -E 's|^v||g' | + grep -Ev '^0\.' | + xargs)" -VERSIONS_BERRY="$(git ls-remote --refs --tags "https://github.com/yarnpkg/berry.git" \ -| grep '@yarnpkg/cli' \ -| sed -E 's|^.+refs/tags/@yarnpkg/cli/||g' \ -| xargs)" +VERSIONS_BERRY="$(git ls-remote --refs --tags "https://github.com/yarnpkg/berry.git" | + grep '@yarnpkg/cli' | + sed -E 's|^.+refs/tags/@yarnpkg/cli/||g' | + xargs)" echo "$VERSIONS_CLASSIC $VERSIONS_BERRY" diff --git a/bin/uninstall b/bin/uninstall index ba16d7f..d35aee8 100755 --- a/bin/uninstall +++ b/bin/uninstall @@ -14,4 +14,4 @@ asdf_yarn_uninstall() { [ -z "${ASDF_INSTALL_PATH}" ] && asdf_yarn_fail "No installation directory was provided. Are you running this command via asdf? Try running 'asdf uninstall yarn '" -asdf_yarn_uninstall $* +asdf_yarn_uninstall "$@"