-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·83 lines (74 loc) · 2.09 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·83 lines (74 loc) · 2.09 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
#!/bin/bash
# Setup Script for Smart Quiz System
# Checks dependencies and builds the project
echo "========================================"
echo " 🎓 Smart Quiz System - Setup"
echo "========================================"
# 1. Check Java
if ! command -v java &> /dev/null; then
echo "❌ Java is not installed."
echo " Please install JDK 17+ and try again."
exit 1
fi
echo "✅ Java found: $(java -version 2>&1 | head -n 1)"
# 2. Check Maven
if ! command -v mvn &> /dev/null; then
echo "❌ Maven is not installed."
echo " Please install Maven and try again."
exit 1
fi
echo "✅ Maven found: $(mvn -version | head -n 1)"
# 3. Check/Create .env
ENV_FILE="backend/.env"
if [ ! -f "$ENV_FILE" ]; then
echo "⚠️ .env file not found in backend/. Creating template..."
cat > "$ENV_FILE" << 'EOF'
GEMINI_API_KEY=replace_with_your_key
MAIL_USERNAME=your_email@gmail.com
MAIL_PASSWORD=your_app_password
EOF
echo "✅ Created backend/.env. Please edit it with your API Key & email credentials!"
else
echo "✅ backend/.env exists."
fi
# 4. Build Backend
echo ""
echo "📦 Building Backend..."
cd backend
mvn clean install -DskipTests
if [ $? -ne 0 ]; then
echo "❌ Backend build failed."
exit 1
fi
cd ..
echo "✅ Backend built successfully."
# 5. Build Client
echo ""
echo "📦 Building Client..."
cd client
mvn clean install -DskipTests
if [ $? -ne 0 ]; then
echo "❌ Client build failed."
exit 1
fi
cd ..
echo "✅ Client built successfully."
# 6. Install Student Portal JS test dependencies
echo ""
echo "📦 Installing Student Portal JS test dependencies..."
cd student_portal
npm install
if [ $? -ne 0 ]; then
echo "⚠️ npm install failed — JS tests won't run until fixed."
fi
cd ..
echo "✅ Student Portal JS dependencies installed."
echo ""
echo "========================================"
echo "🎉 Setup Complete! You can now run:"
echo " ./run.sh"
echo ""
echo " Test commands:"
echo " cd backend && mvn test (5 backend tests)"
echo " cd student_portal && npm test (51 JS tests)"
echo "========================================"