-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (95 loc) · 2.94 KB
/
Makefile
File metadata and controls
99 lines (95 loc) · 2.94 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
.PHONY: build clean help
# Színek a terminál kimenethez
GREEN := \033[0;32m
YELLOW := \033[0;33m
BLUE := \033[0;34m
NC := \033[0m # No Color
help:
@echo "$(BLUE)WordPress Plugin Builder$(NC)"
@echo ""
@echo "Elérhető parancsok:"
@echo " $(GREEN)make build$(NC) - Plugin kiválasztása és ZIP készítése"
@echo " $(GREEN)make clean$(NC) - Összes generált ZIP fájl törlése"
@echo " $(GREEN)make help$(NC) - Súgó megjelenítése"
build:
@echo "$(BLUE)WordPress Plugin Builder$(NC)"
@echo ""
@echo "Elérhető pluginok:"
@echo ""
@# Plugin könyvtárak dinamikus felderítése
@plugins=$$(find . -maxdepth 1 -type d -not -name '.' -not -name '.git' -not -name '.*' | sed 's|^\./||' | sort); \
if [ -z "$$plugins" ]; then \
echo "$(YELLOW)Nem találhatók plugin könyvtárak!$(NC)"; \
exit 1; \
fi; \
i=1; \
for plugin in $$plugins; do \
if [ -f "$$plugin/$$plugin.php" ]; then \
echo " $(GREEN)$$i)$(NC) $$plugin"; \
i=$$((i+1)); \
fi; \
done; \
echo ""; \
if [ $$i -eq 1 ]; then \
echo "$(YELLOW)Nem találhatók érvényes pluginok!$(NC)"; \
exit 1; \
fi; \
read -p "Válassz egy plugint (szám): " choice; \
echo ""; \
selected_plugin=""; \
j=1; \
for plugin in $$plugins; do \
if [ -f "$$plugin/$$plugin.php" ]; then \
if [ $$j -eq $$choice ]; then \
selected_plugin=$$plugin; \
break; \
fi; \
j=$$((j+1)); \
fi; \
done; \
if [ -z "$$selected_plugin" ]; then \
echo "$(YELLOW)Érvénytelen választás!$(NC)"; \
exit 1; \
fi; \
echo "$(BLUE)Kiválasztva:$(NC) $$selected_plugin"; \
echo ""; \
plugin_file="$$selected_plugin/$$selected_plugin.php"; \
if [ ! -f "$$plugin_file" ]; then \
echo "$(YELLOW)Hiba: $$plugin_file nem található!$(NC)"; \
exit 1; \
fi; \
version=$$(grep -i "Version:" "$$plugin_file" | head -n1 | sed 's/.*Version:[[:space:]]*//' | sed 's/[[:space:]]*$$//' | tr -d '\r'); \
if [ -z "$$version" ]; then \
echo "$(YELLOW)Hiba: Nem található verzió információ a $$plugin_file fájlban!$(NC)"; \
exit 1; \
fi; \
echo "$(BLUE)Verzió:$(NC) $$version"; \
echo ""; \
zip_name="$$selected_plugin.zip"; \
echo "$(BLUE)ZIP fájl készítése:$(NC) $$zip_name"; \
if [ -f "$$zip_name" ]; then \
rm "$$zip_name"; \
echo "$(YELLOW)Korábbi ZIP fájl törölve.$(NC)"; \
fi; \
cd "$$selected_plugin" && zip -r "../$$zip_name" . -x "*.git*" -x "*.DS_Store" -x "*__MACOSX*" > /dev/null; \
if [ $$? -eq 0 ]; then \
echo "$(GREEN)✓ Sikeres!$(NC) A ZIP fájl elkészült: $$zip_name"; \
else \
echo "$(YELLOW)Hiba történt a ZIP fájl készítése során!$(NC)"; \
exit 1; \
fi
clean:
@echo "$(BLUE)ZIP fájlok törlése...$(NC)"
@removed=0; \
for zip in *.zip; do \
if [ -f "$$zip" ]; then \
rm "$$zip"; \
echo "$(YELLOW)Törölve:$(NC) $$zip"; \
removed=$$((removed+1)); \
fi; \
done; \
if [ $$removed -eq 0 ]; then \
echo "$(GREEN)Nincs törlendő ZIP fájl.$(NC)"; \
else \
echo "$(GREEN)✓ $$removed ZIP fájl törölve.$(NC)"; \
fi