Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong jq calls and update jq-downloader repo and assets. #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ install() {

local escapedInstallVersion=$(echo $ASDF_INSTALL_VERSION | sed 's/\./\\\./g;s/\+/\\\+/g')
local jsonResponse=$(curl -sL "${versionListUrl}" | "${JQ_BIN}" --arg VERSION "${escapedInstallVersion}" '.releases[] | select((.version + "-" + .channel) | test("^v?" + $VERSION))')
local jsonResponseLength=$(echo "${jsonResponse}" | jq -s 'length')
local filePath=$(echo "${jsonResponse}" | jq -r '.archive')
local jsonResponseLength=$(echo "${jsonResponse}" | "${JQ_BIN}" -s 'length')
local filePath=$(echo "${jsonResponse}" | "${JQ_BIN}" -r '.archive')
if [ "$(uname -s)" == "Darwin" ] && [ ${jsonResponseLength} -gt 1 ]; then
local arch="x64"
if [ "$(uname -m)" == "arm64" ]; then
arch="arm64"
fi

channel=$(echo "$ASDF_INSTALL_VERSION" | grep -oE '(stable|beta|dev)$' || echo "stable")
filePath=$(echo "${jsonResponse}" | jq -r --arg ARCH "${arch}" --arg CHANNEL "${channel}" '. | select(.dart_sdk_arch == $ARCH and .channel == $CHANNEL) | .archive')
filePath=$(echo "${jsonResponse}" | "${JQ_BIN}" -r --arg ARCH "${arch}" --arg CHANNEL "${channel}" '. | select(.dart_sdk_arch == $ARCH and .channel == $CHANNEL) | .archive')
fi

if [ -z "${filePath}" ]; then
Expand Down
8 changes: 4 additions & 4 deletions bin/jq-downloader
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ get_jq_filename() {
case "$(uname -s)" in
Linux)
case "$(uname -m)" in
x86_64) echo jq-linux64 ;;
x86_64) echo jq-linux-amd64 ;;
esac ;;
Darwin)
case "$(uname -m)" in
x86_64) echo jq-osx-amd64 ;;
arm64) echo jq-osx-amd64 ;;
x86_64) echo jq-macos-amd64 ;;
arm64) echo jq-macos-arm64 ;;
esac ;;
esac
}
Expand All @@ -19,7 +19,7 @@ download_jq_if_not_exists() {
jq_path="$(type -p jq || echo ${currentDir}/jq)"

if [[ -z "$(type -p ${jq_path})" ]]; then
curl -sL "https://github.com/stedolan/jq/releases/latest/download/$(get_jq_filename)" -o "${jq_path}"
curl -sL "https://github.com/jqlang/jq/releases/latest/download/$(get_jq_filename)" -o "${jq_path}"
chmod +x "${jq_path}"
fi

Expand Down