Skip to content

Commit

Permalink
feat: use list-bin-path to expose the bin folder (#6)
Browse files Browse the repository at this point in the history
Thanks to gabrielbdsantos.
  • Loading branch information
gabrielbdsantos authored Apr 27, 2024
1 parent 090666b commit 44e1a27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 12 additions & 0 deletions bin/list-bin-paths
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euo pipefail

os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch_dir=""

[[ "$os" == "darwin" ]] &&
arch_dir="universal-darwin" ||
arch_dir="x86_64-linux"

echo "bin/${arch_dir}"
9 changes: 3 additions & 6 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ download_release() {
install_version() {
local install_type="$1"
local version="$2"
local install_path="${3%/bin}"
local install_path="$3"

local os arch_dir
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
Expand All @@ -67,15 +67,12 @@ install_version() {
fi

(
mkdir -p "$install_path/binaries/"
cp -r "$ASDF_DOWNLOAD_PATH"/bin/* "$install_path/binaries/"
ln -s "$install_path/binaries/${arch_dir}" "$install_path/bin"
rm -rf "${ASDF_DOWNLOAD_PATH:?}"/bin/
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"

local tool_cmd
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
test -x "$install_path/bin/$tool_cmd" || fail "Expected $install_path/bin/$tool_cmd to be executable."
test -x "$install_path/bin/${arch_dir}/$tool_cmd" ||
fail "Expected $install_path/bin/${arch_dir}/$tool_cmd to be executable."

echo "$TOOL_NAME $version installation was successful!"
) || (
Expand Down

0 comments on commit 44e1a27

Please sign in to comment.