/ bin / download
download
 1  #!/usr/bin/env bash
 2  
 3  set -euo pipefail
 4  
 5  current_script_path=${BASH_SOURCE[0]}
 6  plugin_dir=$(dirname "$(dirname "$current_script_path")")
 7  
 8  # shellcheck source=./lib/utils.bash
 9  source "${plugin_dir}/lib/utils.bash"
10  
11  mkdir -p "$ASDF_DOWNLOAD_PATH"
12  
13  release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
14  
15  # Download tar.gz file to the download directory
16  download_release "$ASDF_INSTALL_VERSION" "$release_file"
17  
18  #  Extract contents of tar.gz file into the download directory
19  tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"
20  
21  # Remove the tar.gz file since we don't need to keep it
22  rm "$release_file"