Skip to content

Commit

Permalink
Merge pull request #3 from raimon49/fix-download-binary-filenames
Browse files Browse the repository at this point in the history
Support for changing the name of the distribution archive in v4.1.0
  • Loading branch information
raimon49 authored Sep 23, 2023
2 parents 680365c + d6663af commit d516669
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ jobs:
os:
- ubuntu-latest
- macos-latest
hurl-version:
- 4.0.0
- 4.1.0
runs-on: ${{ matrix.os }}
steps:
- name: asdf_plugin_test
uses: asdf-vm/actions/plugin-test@v1
uses: asdf-vm/actions/plugin-test@v2
with:
command: hurl --version
version: ${{ matrix.hurl-version }}
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install asdf dependencies
uses: asdf-vm/actions/install@v1
uses: asdf-vm/actions/install@v2

- name: Run ShellCheck
run: scripts/shellcheck.bash
Expand All @@ -23,10 +23,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install asdf dependencies
uses: asdf-vm/actions/install@v1
uses: asdf-vm/actions/install@v2

- name: List file to shfmt
run: shfmt -f .
Expand Down
23 changes: 18 additions & 5 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,24 @@ uname_s="$(uname -s)"
uname_m="$(uname -m)"
os=""

case "$uname_s" in
Darwin) os="macos" ;;
Linux) os="linux" ;;
*) fail "OS not supported: $uname_s" ;;
esac
install_numeric_version=$(numeric_version "${ASDF_INSTALL_VERSION}")
if [ "${install_numeric_version}" -ge "$(numeric_version 4.1.0)" ]; then
if [ "$uname_m" = "arm64" ]; then
uname_m="aarch64"
fi

case "$uname_s" in
Darwin) os="apple-darwin" ;;
Linux) os="unknown-linux-gnu" ;;
*) fail "OS not supported: $uname_s" ;;
esac
else
case "$uname_s" in
Darwin) os="macos" ;;
Linux) os="linux" ;;
*) fail "OS not supported: $uname_s" ;;
esac
fi
release_file="${TOOL_NAME}-${ASDF_INSTALL_VERSION}-${uname_m}-${os}.tar.gz"

# Download tar.gz file to the download directory
Expand Down
4 changes: 4 additions & 0 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ list_all_versions() {
list_github_tags
}

numeric_version() {
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'
}

download_release() {
local version filename url
version="$1"
Expand Down

0 comments on commit d516669

Please sign in to comment.