-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·84 lines (71 loc) · 1.87 KB
/
setup.sh
File metadata and controls
executable file
·84 lines (71 loc) · 1.87 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
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Ralph CLI Setup Script
# Creates symlinks in ~/bin for easy access
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_DIR="$HOME/bin"
echo "Ralph CLI Setup"
echo "==============="
echo ""
# Create ~/bin if it doesn't exist
if [ ! -d "$BIN_DIR" ]; then
echo "Creating $BIN_DIR..."
mkdir -p "$BIN_DIR"
fi
# List of scripts to symlink
SCRIPTS=(
"ralph-once.sh"
"ralph.sh"
"ralph-init.sh"
)
echo "Creating symlinks in $BIN_DIR..."
echo ""
for script in "${SCRIPTS[@]}"; do
SOURCE="$SCRIPT_DIR/$script"
TARGET="$BIN_DIR/$script"
# Remove .sh extension for cleaner command names
if [[ "$script" == *.sh ]]; then
CLEAN_NAME="${script%.sh}"
TARGET="$BIN_DIR/$CLEAN_NAME"
fi
# Remove existing symlink or file
if [ -L "$TARGET" ]; then
echo " Removing existing symlink: $TARGET"
rm "$TARGET"
elif [ -f "$TARGET" ]; then
echo " Warning: $TARGET exists and is not a symlink"
read -p " Overwrite? (y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo " Skipping $script"
continue
fi
rm "$TARGET"
fi
# Create symlink
ln -s "$SOURCE" "$TARGET"
echo " ✓ $TARGET -> $SOURCE"
done
echo ""
echo "Setup complete!"
echo ""
# Check if ~/bin is in PATH
if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
echo "⚠️ $HOME/bin is not in your PATH"
echo ""
echo "Add it by running:"
echo " echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.bashrc"
echo " source ~/.bashrc"
echo ""
echo "Or for zsh:"
echo " echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.zshrc"
echo " source ~/.zshrc"
else
echo "✓ $HOME/bin is already in your PATH"
fi
echo ""
echo "Available commands:"
echo " ralph-init - Initialize new Ralph project"
echo " ralph-once - Run single iteration"
echo " ralph - Run multiple iterations"
echo ""
echo "Try: ralph-init to get started"