Skip to content

Commit

Permalink
fix: extract to tmp; fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
worldofgeese authored Nov 30, 2023
1 parent 3ee48c7 commit 94216e8
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions just/custom.just
Original file line number Diff line number Diff line change
Expand Up @@ -152,25 +152,27 @@ jetbrains-toolbox:
# Install garden.io, the Cloud Native DevOps automation platform | https://garden.io
garden:
#!/usr/bin/env bash
command -v garden &> /dev/null || (
ASSET_URL=$(curl -s https://api.github.com/repos/garden-io/garden/releases/latest | \
jq -r '.assets[] | select(.browser_download_url | test("linux-amd64.tar.gz$")) | .browser_download_url')
curl -sSL $ASSET_URL | tar xz && \
GARDEN_DIR=${HOME}/.garden
TARGET_PATH=${GARDEN_DIR}/bin
mkdir -p "${GARDEN_DIR}"
mv linux-amd64/* "${TARGET_PATH}")

echo ""
echo "🌺🌻 Garden has been successfully installed 🌷💐"
echo ""
echo "Add the Garden CLI to your path by adding the following to your .bashrc/.zshrc:"
echo ""
echo " export PATH=\$PATH:\$HOME/.garden/bin"
echo ""
echo "Head over to our documentation for next steps: https://docs.garden.io"
echo ""

if ! command -v garden &> /dev/null; then
ASSET_URL=$(curl -s https://api.github.com/repos/garden-io/garden/releases/latest | \
jq -r '.assets[] | select(.browser_download_url | test("linux-amd64.tar.gz$")) | .browser_download_url')
GARDEN_DIR="${HOME}/.garden/bin"
TMP_DIR=$(mktemp -d)
curl -sSL "$ASSET_URL" | tar -xz -C "$TMP_DIR"
mkdir -p "$GARDEN_DIR"
mv "$TMP_DIR"/linux-amd64/garden "$GARDEN_DIR"
rm -rf "$TMP_DIR"

echo ""
echo "🌺🌻 Garden has been successfully installed 🌷💐"
echo ""
echo "Add the Garden CLI to your path by adding the following to your .bashrc/.zshrc:"
echo ""
echo " export PATH=\$PATH:\$HOME/.garden/bin"
echo ""
echo "Head over to our documentation for next steps: https://docs.garden.io"
echo ""
fi

# Install nix and Devbox
nix-devbox:
echo 'Setting phasers to kill. Installing nix.'
Expand Down

0 comments on commit 94216e8

Please sign in to comment.