-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·163 lines (139 loc) · 4.84 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·163 lines (139 loc) · 4.84 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash
# Supervibes Installation Script
# One-liner: curl -fsSL "https://raw.githubusercontent.com/superwall/supervibes/refs/heads/main/install.sh?$(date +%s)" | bash
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
CYAN='\033[0;96m'
NC='\033[0m' # No Color
echo ""
echo -e "${CYAN}Installing Supervibes CLI...${NC}"
echo ""
# Check if git is installed
if ! command -v git &> /dev/null; then
echo -e "${RED}Error: git is not installed${NC}"
echo "Please install git first:"
echo " xcode-select --install"
exit 1
fi
# Remove old installation if exists
if [ -d ~/.supervibes ]; then
echo -e "${YELLOW}Removing old installation...${NC}"
rm -rf ~/.supervibes
fi
# Clone the repository
echo -e "${GREEN}Cloning Supervibes repository...${NC}"
if ! git clone https://github.com/superwall/supervibes.git ~/.supervibes; then
echo -e "${RED}Failed to clone repository${NC}"
echo ""
echo "Please check your internet connection and try again."
echo "If the problem persists, you can manually clone:"
echo " git clone https://github.com/superwall/supervibes.git ~/.supervibes"
exit 1
fi
# Make scripts executable
chmod +x ~/.supervibes/supervibes
chmod +x ~/.supervibes/check-setup.sh
echo -e "${GREEN}✓ Repository cloned successfully${NC}"
# Create bin directory
mkdir -p ~/.local/bin
# Create the supervibes wrapper script
echo -e "${GREEN}Creating supervibes command...${NC}"
cat > ~/.local/bin/supervibes << 'EOF'
#!/bin/bash
# Get the current working directory
WORKING_DIR=$(pwd)
# Path to the actual supervibes script
SUPERVIBES_CLI="$HOME/.supervibes/supervibes"
# Check if supervibes CLI exists
if [ ! -f "$SUPERVIBES_CLI" ]; then
echo "Error: Supervibes CLI not found at $SUPERVIBES_CLI"
echo "Please run the installation script again:"
echo " curl -fsSL \"https://raw.githubusercontent.com/superwall/supervibes/refs/heads/main/install.sh?\$(date +%s)\" | bash"
exit 1
fi
# Parse arguments and handle --projects-dir
ARGS=()
HAS_PROJECTS_DIR=false
for arg in "$@"; do
if [[ "$arg" == --projects-dir* ]]; then
HAS_PROJECTS_DIR=true
fi
ARGS+=("$arg")
done
# If no --projects-dir specified, use current directory
if [ "$HAS_PROJECTS_DIR" = false ]; then
# Add current directory as projects directory
exec "$SUPERVIBES_CLI" "${ARGS[@]}" --projects-dir="$WORKING_DIR"
else
# Pass through all arguments as-is
exec "$SUPERVIBES_CLI" "${ARGS[@]}"
fi
EOF
chmod +x ~/.local/bin/supervibes
# Detect shell and update appropriate config file
SHELL_NAME=$(basename "$SHELL")
CONFIG_FILE=""
case "$SHELL_NAME" in
bash)
if [ -f ~/.bash_profile ]; then
CONFIG_FILE=~/.bash_profile
elif [ -f ~/.bashrc ]; then
CONFIG_FILE=~/.bashrc
else
CONFIG_FILE=~/.bash_profile
touch "$CONFIG_FILE"
fi
;;
zsh)
CONFIG_FILE=~/.zshrc
if [ ! -f "$CONFIG_FILE" ]; then
touch "$CONFIG_FILE"
fi
;;
*)
echo -e "${YELLOW}Unknown shell: $SHELL_NAME${NC}"
echo -e "${YELLOW}Please manually add ~/.local/bin to your PATH${NC}"
;;
esac
# Add to PATH if config file was found
if [ -n "$CONFIG_FILE" ]; then
# Check if ~/.local/bin is already in PATH
if ! grep -q 'export PATH="$HOME/.local/bin:$PATH"' "$CONFIG_FILE"; then
echo -e "${GREEN}Adding ~/.local/bin to PATH in $CONFIG_FILE...${NC}"
echo "" >> "$CONFIG_FILE"
echo "# Local bin directory (for supervibes)" >> "$CONFIG_FILE"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$CONFIG_FILE"
echo -e "${GREEN}✓ Added to PATH${NC}"
PATH_ADDED=true
else
echo -e "${YELLOW}~/.local/bin already in PATH${NC}"
PATH_ADDED=false
fi
fi
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}✓ Supervibes installed successfully!${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
if [ "$PATH_ADDED" = true ]; then
echo "To start using supervibes, either:"
echo -e " 1. Run: ${CYAN}source $CONFIG_FILE${NC}"
echo -e " 2. Open a new terminal window"
echo ""
fi
echo "Usage:"
echo -e " ${CYAN}supervibes${NC} - Create project in current directory"
echo -e " ${CYAN}supervibes --test${NC} - Quick test mode"
echo -e " ${CYAN}supervibes --init${NC} - Regenerate project config from supervibes.local.json"
echo ""
echo "Installation directory: ~/.supervibes"
echo "Configuration file: ~/.supervibes/supervibes.json"
echo ""
echo "To update supervibes:"
echo -e " ${YELLOW}supervibes --update${NC}"
echo ""
echo "To uninstall:"
echo -e " ${YELLOW}supervibes --uninstall${NC}"