Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Piccioni committed Oct 27, 2024
1 parent ba86f01 commit 7339ee9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pixipin
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ download_pixi() {
exit 1
fi
fi
log "Using version: $version"

if [ ! -f "$PIXIPIN_CACHE_DIR/$pixi_filename$version" ]; then
mkdir -p "$PIXIPIN_CACHE_DIR"
Expand All @@ -63,6 +62,9 @@ download_pixi() {
curl --fail-with-body --silent -L -o "$tmp" "$url" || log_fatal "failed to download $url"
chmod u+x "$tmp"
mv "$tmp" "$PIXIPIN_CACHE_DIR/$pixi_filename$version"
log "Using version: $version"
else
log "Using version: $version [cached]"
fi
}

Expand Down
25 changes: 24 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ tmp=$(mktemp -d)
cachetmp=$(mktemp -d)
trap 'rm -fr $tmp $cachetmp' EXIT

git clone . "$tmp" 2>/dev/null
# Setup the test environment
cp pixipin "$tmp"
touch "$tmp/pixi.toml"

export PIXIPIN_CACHE_DIR=$cachetmp
pushd "$tmp" || exit 1
Expand All @@ -29,6 +31,27 @@ else
echo "TEST PASSED"
fi

echo
echo "[TEST CACHE]"
echo "v0.33.0" >.pixipinrc
if ! ./pixipin --version 2>&1 | grep 'v0.33.0 \[cached\]'; then
echo "TEST FAILED"
exit 1
else
echo "TEST PASSED"
fi

echo
echo "[TEST NO_GITHUB_TOKEN]"
echo "v0.33.0" >.pixipinrc
if ! PIXIPIN_GITHUB_TOKEN='' ./pixipin --version | grep "pixi 0.33.0"; then
echo "TEST FAILED"
exit 1
else
echo "TEST PASSED"
fi


echo
echo "[TEST .pixipinrc garbage]"
echo "garbage" >.pixipinrc
Expand Down

0 comments on commit 7339ee9

Please sign in to comment.