-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
68 lines (51 loc) · 1.89 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
SHELL := /bin/bash
SERVER_PATH := /srv/http
ARROW := \033[1m\033[31m>\033[32m>\033[33m>\033[39m
CL_GREEN := \033[32m
CL_RESET := \033[39m
.SILENT:
.env:
echo 'APP_ENV=dev' > .env
echo 'APP_SECRET=15176f4509b8a40b28487e4738f79d89' >> .env
echo 'DATABASE_URL="mysql://[email protected]:3306/sport_ludique?serverVersion=mariadb-10.7.3"' >> .env
echo -e "[${CL_GREEN}OK${CL_RESET}] Environment file created"
vendor:
composer update
echo -e "[${CL_GREEN}OK${CL_RESET}] Composer updated"
public/css/style.css:
sass public/scss/style.scss public/css/style.css
echo -e "[${CL_GREEN}OK${CL_RESET}] Style compiled"
$(SERVER_PATH)/public/css/style.css:
sass $(SERVER_PATH)/public/scss/style.scss $(SERVER_PATH)/public/css/style.css
echo -e "[${CL_GREEN}OK${CL_RESET}] Style compiled"
clean:
echo -e "${ARROW} Deleting var directory..."
rm -rf var
echo -e "${ARROW} Deleting vendor directory..."
rm -rf vendor
echo -e "${ARROW} Deleting environment files..."
rm -f .env
rm -f .env.test
echo -e "[${CL_GREEN}OK${CL_RESET}] Cleaned !"
local: .env vendor public/css/style.css
# Start local server
echo -e "${ARROW} Creating local server..."
symfony server:start
prod: .env vendor $(SERVER_PATH)/public/css/style.css
echo -e "${ARROW} Creating production server..."
# Overriding the ownership of every server files
sudo chown -R $(shell whoami) $(SERVER_PATH)/*
rm -rf $(SERVER_PATH)/*
echo -e "[${CL_GREEN}OK${CL_RESET}] Server cleared"
# Copy Symfony files
cp -r .env $(SERVER_PATH)
cp -r * $(SERVER_PATH)
echo -e "[${CL_GREEN}OK${CL_RESET}] File copied"
# modify the .env to prod mode
sed -i 's/APP_ENV=dev/APP_ENV=prod/' $(SERVER_PATH)/.env
echo -e "[${CL_GREEN}OK${CL_RESET}] Enabled production mode"
# Fixing var http user permissions
sudo chown -R http $(SERVER_PATH)/var
sudo chmod -R u+rwx $(SERVER_PATH)/var
echo -e "[${CL_GREEN}OK${CL_RESET}] Done! http://localhost"
.PHONY: clean local prod