-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
87 lines (73 loc) · 1.87 KB
/
Makefile
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
.DEFAULT_GOAL := help
## -- Container Launch --
## Bootstrap containers and compile opencart internals
.PHONY: bootstrap
bootstrap: up init
## Initialise repository - run install-opencart
.PHONY: init
init:
docker-compose exec -T web dockerize -wait tcp://db:3306 -timeout 60m /var/www/html/install.sh
## Launch docker-compose as background daemon
.PHONY: up
up:
docker-compose up -d
## Shut down docker-compose services
.PHONY: down
down:
docker-compose down
## -- Development Methods --
## Launch bash shell into opencart container
.PHONY: shell
shell:
docker-compose exec web bash
## Tail logs
.PHONY: logs
logs:
docker-compose logs -f
## Tail opencart logs only
.PHONY: logs-opencart
logs-opencart:
docker-compose logs -f web
## -- Misc --
## Update repository against origin/master
.PHONY: update
update:
git fetch
git merge --ff-only origin/master
## Bundle module
.PHONY: bundle
bundle:
cd src && zip -r -D idealpostcodes.ocmod.zip upload install.xml && mv idealpostcodes.ocmod.zip ../
## How to use this Makefile
.PHONY: help
help:
@printf "Usage\n";
@awk '{ \
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
helpCommand = substr($$0, index($$0, ":") + 2); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
helpCommand = substr($$0, 0, index($$0, ":")); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^##/) { \
if (helpMessage) { \
helpMessage = helpMessage"\n "substr($$0, 3); \
} else { \
helpMessage = substr($$0, 3); \
} \
} else { \
if (helpMessage) { \
print "\n "helpMessage"\n" \
} \
helpMessage = ""; \
} \
}' \
$(MAKEFILE_LIST)