-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·71 lines (58 loc) · 2.55 KB
/
install.sh
File metadata and controls
executable file
·71 lines (58 loc) · 2.55 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
# scratch-monkey install script
set -euo pipefail
TOOL_NAME="scratch-monkey"
BIN_DIR="$HOME/.local/bin"
CONFIG_DIR="$HOME/.config/scratch-monkey"
# ─── Check for uv ─────────────────────────────────────────────────────────────
if ! command -v uv &>/dev/null; then
echo "uv is not installed."
read -rp "Install uv now? [y/N] " answer
if [[ "$answer" =~ ^[Yy]$ ]]; then
curl -LsSf https://astral.sh/uv/install.sh | sh
# Re-source to pick up uv in PATH
export PATH="$HOME/.cargo/bin:$PATH"
if ! command -v uv &>/dev/null; then
echo "uv installed but not in PATH. Please add ~/.cargo/bin to your PATH and re-run."
exit 1
fi
else
echo "uv is required. Install it from https://github.com/astral-sh/uv"
exit 1
fi
fi
# ─── Install ──────────────────────────────────────────────────────────────────
# Parse options
WITH_GUI=false
for arg in "$@"; do
case "$arg" in
--gui) WITH_GUI=true ;;
esac
done
INSTALL_SPEC="."
if $WITH_GUI; then
INSTALL_SPEC=".[gui]"
fi
echo "Installing $TOOL_NAME..."
uv tool install --editable "$INSTALL_SPEC" --force
# ─── PATH check ───────────────────────────────────────────────────────────────
if ! echo "$PATH" | tr ':' '\n' | grep -qx "$BIN_DIR"; then
echo ""
echo "Warning: $BIN_DIR is not in your PATH."
echo "Add the following to your shell config (~/.bashrc or ~/.zshrc):"
echo ""
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
fi
# ─── Config directory ─────────────────────────────────────────────────────────
mkdir -p "$CONFIG_DIR"
# ─── Summary ──────────────────────────────────────────────────────────────────
echo ""
echo "✓ scratch-monkey installed successfully!"
echo ""
echo "Quick start:"
echo " scratch-monkey create myproject"
echo " scratch-monkey enter myproject"
echo ""
echo "For help:"
echo " scratch-monkey --help"