-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·49 lines (40 loc) · 1.39 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
set -e
REPO="arjun-vegeta/loopCode"
INSTALL_DIR="$HOME/.loopcode"
BIN_DIR="/usr/local/bin"
if ! command -v bun >/dev/null 2>&1; then
echo "Error: LoopCode requires Bun to be installed."
echo "Please install Bun first: curl -fsSL https://bun.sh/install | bash"
exit 1
fi
echo "Fetching latest release source of LoopCode..."
TARBALL_URL="https://github.com/$REPO/archive/refs/tags/v1.0.0.tar.gz"
echo "Downloading LoopCode from: $TARBALL_URL"
mkdir -p "$INSTALL_DIR"
curl -L "$TARBALL_URL" -o "$INSTALL_DIR/source.tar.gz"
echo "Extracting LoopCode..."
tar -xzf "$INSTALL_DIR/source.tar.gz" -C "$INSTALL_DIR" --strip-components=1
rm "$INSTALL_DIR/source.tar.gz"
echo "Installing dependencies..."
cd "$INSTALL_DIR"
bun install
echo "Building LoopCode..."
bun run build
echo "Creating launcher wrapper..."
cat << 'EOF' > "$INSTALL_DIR/loopcode-runner"
#!/usr/bin/env bash
exec bun "$HOME/.loopcode/dist/index.js" "$@"
EOF
chmod +x "$INSTALL_DIR/loopcode-runner"
echo "Installing loopcode binary link..."
if [ -w "$BIN_DIR" ]; then
ln -sf "$INSTALL_DIR/loopcode-runner" "$BIN_DIR/loopcode"
echo "✓ LoopCode installed to $BIN_DIR/loopcode"
else
LOCAL_BIN="$HOME/.local/bin"
mkdir -p "$LOCAL_BIN"
ln -sf "$INSTALL_DIR/loopcode-runner" "$LOCAL_BIN/loopcode"
echo "✓ LoopCode installed to $LOCAL_BIN/loopcode"
echo "Please ensure $LOCAL_BIN is in your PATH."
fi