-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-project.sh
More file actions
executable file
·108 lines (93 loc) · 2.85 KB
/
Copy pathsetup-project.sh
File metadata and controls
executable file
·108 lines (93 loc) · 2.85 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
#!/usr/bin/env bash
# DEPRECATED (since v0.14.0):
# The canonical install path is now: pip install routemq[cli] && routemq new my-app
# See README.md for the recommended workflow.
# This script is retained for the "fork the framework" path; will be removed in v0.16.0.
# RouteMQ Project Setup Script
# This script initializes a fresh git repository for your project
set -e
echo "🚀 RouteMQ Project Setup"
echo "========================"
echo ""
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "❌ Error: git is not installed. Please install git first."
exit 1
fi
# Function to remove existing git repository
remove_git_history() {
if [ -d ".git" ]; then
echo "🗑️ Removing existing git history..."
rm -rf .git
echo "✅ Git history removed"
else
echo "ℹ️ No existing git history found"
fi
}
# Function to initialize new git repository
init_git_repo() {
echo ""
echo "📦 Initializing fresh git repository..."
git init
git add .
git commit -m "feat: initial commit from RouteMQ template"
echo "✅ Fresh repository initialized"
}
# Function to set up remote
setup_remote() {
echo ""
read -p "Do you want to add a remote repository? (y/n): " add_remote
if [[ $add_remote == "y" || $add_remote == "Y" ]]; then
read -p "Enter your remote repository URL (e.g., https://github.com/username/repo.git): " remote_url
if [ -n "$remote_url" ]; then
git remote add origin "$remote_url"
echo "✅ Remote 'origin' added: $remote_url"
echo ""
echo "To push your code, run:"
echo " git push -u origin main"
else
echo "⚠️ No remote URL provided, skipping..."
fi
fi
}
# Function to copy environment file
setup_env() {
echo ""
if [ -f ".env.example" ]; then
if [ ! -f ".env" ]; then
echo "📝 Creating .env file from .env.example..."
cp .env.example .env
echo "✅ .env file created (please configure it)"
else
echo "ℹ️ .env file already exists"
fi
fi
}
# Main execution
echo "This script will:"
echo " 1. Remove existing git history"
echo " 2. Initialize a fresh git repository"
echo " 3. Optionally set up your remote repository"
echo " 4. Set up environment configuration"
echo ""
read -p "Continue? (y/n): " confirm
if [[ $confirm != "y" && $confirm != "Y" ]]; then
echo "❌ Setup cancelled"
exit 0
fi
echo ""
# Execute setup steps
remove_git_history
init_git_repo
setup_remote
setup_env
echo ""
echo "🎉 Setup complete! Your project is ready."
echo ""
echo "Next steps:"
echo " 1. Configure your .env file"
echo " 2. Run: uv sync"
echo " 3. Run: uv run routemq --init"
echo " 4. Run: uv run routemq --run"
echo ""
echo "📚 See README.md for detailed documentation"