-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (148 loc) · 4.99 KB
/
Copy pathMakefile
File metadata and controls
176 lines (148 loc) · 4.99 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
164
165
166
167
168
169
170
171
172
173
174
175
176
# IvyLevel Makefile
PROJECT_NAME = ivylevel
PROJECT_DIR = $(shell pwd)
PYTHON = python3
PIP = pip3
BACKEND_DIR = $(PROJECT_DIR)/backend/api
FRONTEND_DIR = $(PROJECT_DIR)/frontend
# Colors
GREEN = \033[0;32m
YELLOW = \033[1;33m
RED = \033[0;31m
NC = \033[0m # No Color
# Default target
.DEFAULT_GOAL := help
.PHONY: help
help: ## Show this help message
@echo '$(GREEN)IvyLevel Development Commands$(NC)'
@echo ''
@echo 'Usage:'
@echo ' make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " $(YELLOW)%-20s$(NC) %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Backend commands
.PHONY: backend-install
backend-install: ## Install backend dependencies
@echo "$(GREEN)Installing backend dependencies...$(NC)"
cd $(BACKEND_DIR) && $(PIP) install -r requirements.txt
.PHONY: backend-dev
backend-dev: ## Run backend in development mode
@echo "$(GREEN)Starting backend development server...$(NC)"
cd $(BACKEND_DIR) && $(PYTHON) main.py
.PHONY: backend-test
backend-test: ## Run backend tests
@echo "$(GREEN)Running backend tests...$(NC)"
cd $(BACKEND_DIR) && pytest tests/
.PHONY: backend-lint
backend-lint: ## Lint backend code
@echo "$(GREEN)Linting backend code...$(NC)"
cd $(BACKEND_DIR) && flake8 src/ --max-line-length=100
# Frontend commands
.PHONY: frontend-install
frontend-install: ## Install frontend dependencies
@echo "$(GREEN)Installing frontend dependencies...$(NC)"
cd $(FRONTEND_DIR)/student-app && npm install
cd $(FRONTEND_DIR)/coach-app && npm install
.PHONY: frontend-student
frontend-student: ## Run student app
@echo "$(GREEN)Starting student app...$(NC)"
cd $(FRONTEND_DIR)/student-app && npm start
.PHONY: frontend-coach
frontend-coach: ## Run coach app
@echo "$(GREEN)Starting coach app...$(NC)"
cd $(FRONTEND_DIR)/coach-app && npm start
# Database commands
.PHONY: db-init
db-init: ## Initialize database
@echo "$(GREEN)Initializing database...$(NC)"
$(PYTHON) scripts/manage_db.py init
.PHONY: db-migrate
db-migrate: ## Run database migrations
@echo "$(GREEN)Running database migrations...$(NC)"
$(PYTHON) scripts/manage_db.py upgrade
.PHONY: db-reset
db-reset: ## Reset database (WARNING: Deletes all data)
@echo "$(RED)WARNING: This will delete all data!$(NC)"
$(PYTHON) scripts/manage_db.py reset
# Celery commands
.PHONY: celery-worker
celery-worker: ## Start Celery worker
@echo "$(GREEN)Starting Celery worker...$(NC)"
cd $(BACKEND_DIR) && celery -A celery_app worker --loglevel=info
.PHONY: celery-beat
celery-beat: ## Start Celery beat scheduler
@echo "$(GREEN)Starting Celery beat...$(NC)"
cd $(BACKEND_DIR) && celery -A celery_app beat --loglevel=info
.PHONY: celery-flower
celery-flower: ## Start Celery Flower monitoring
@echo "$(GREEN)Starting Celery Flower...$(NC)"
cd $(BACKEND_DIR) && celery -A celery_app flower
# Docker commands
.PHONY: docker-build
docker-build: ## Build Docker images
@echo "$(GREEN)Building Docker images...$(NC)"
cd infrastructure/docker && docker-compose build
.PHONY: docker-up
docker-up: ## Start Docker containers
@echo "$(GREEN)Starting Docker containers...$(NC)"
cd infrastructure/docker && docker-compose up -d
.PHONY: docker-down
docker-down: ## Stop Docker containers
@echo "$(GREEN)Stopping Docker containers...$(NC)"
cd infrastructure/docker && docker-compose down
# Development setup
.PHONY: setup
setup: ## Complete development setup
@echo "$(GREEN)Setting up development environment...$(NC)"
@make backend-install
@make frontend-install
@make db-init
@echo "$(GREEN)Setup complete!$(NC)"
# Testing
.PHONY: test
test: ## Run all tests
@echo "$(GREEN)Running all tests...$(NC)"
@make backend-test
# Stripe setup
.PHONY: stripe-setup
stripe-setup: ## Set up Stripe products and prices
@echo "$(GREEN)Setting up Stripe...$(NC)"
$(PYTHON) scripts/setup_stripe_products.py
.PHONY: stripe-test
stripe-test: ## Test Stripe integration
@echo "$(GREEN)Testing Stripe integration...$(NC)"
$(PYTHON) scripts/test_stripe_integration.py
# Validation
.PHONY: validate
validate: ## Validate project structure
@echo "$(GREEN)Validating project structure...$(NC)"
$(PYTHON) scripts/validate_reorganization.py $(PROJECT_DIR)
# Update imports
.PHONY: update-imports
update-imports: ## Update Python imports
@echo "$(GREEN)Updating Python imports...$(NC)"
$(PYTHON) scripts/update_imports.py $(PROJECT_DIR)
# Clean
.PHONY: clean
clean: ## Clean generated files
@echo "$(GREEN)Cleaning generated files...$(NC)"
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name ".DS_Store" -delete
# All-in-one commands
.PHONY: dev
dev: ## Start all development services
@echo "$(GREEN)Starting all development services...$(NC)"
@make backend-dev &
@make frontend-student &
@make celery-worker &
@make celery-beat
@echo "$(GREEN)All services started!$(NC)"
.PHONY: stop
stop: ## Stop all services
@echo "$(RED)Stopping all services...$(NC)"
pkill -f "python.*main.py" || true
pkill -f "node.*start" || true
pkill -f "celery" || true
@echo "$(GREEN)All services stopped!$(NC)"