-
Notifications
You must be signed in to change notification settings - Fork 0
/
maintenance.sh
98 lines (82 loc) · 2.05 KB
/
maintenance.sh
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
#!/bin/bash
case $1 in
"build")
test -z "$2" && echo "build all / composer / node" && exit 2;
case $2 in
"all")
./maintenance.sh build composer && ./maintenance.sh build node
;;
"composer")
echo "rm composer.lock && rm -Ri vendor/ && composer update --ignore-platform-reqs";
rm composer.lock;
rm -Rif vendor/;
composer update --ignore-platform-reqs;
;;
"node")
rm yarn.lock;
rm -Rif .yarn;
rm -Rif node_modules/;
touch yarn.lock;
yarn install;
;;
esac
;;
"sync")
test -z "$2" && echo "sync all / vendor / node" && exit 2;
test -z "$3" && echo "pas de host mis pour 3ème argument" && exit 2;
hostsync=$3;
case $2 in
"all")
./maintenance.sh sync vendor $3 && ./maintenance.sh sync node $3
;;
"node")
echo rsync -av -e 'ssh -K ' node_modules/ creneaux@"$hostsync":~/www/node_modules;
rsync -av -e 'ssh -K ' node_modules/ creneaux@"$hostsync":~/www/node_modules;
;;
"vendor")
echo rsync -av -e 'ssh -K ' vendor/ creneaux@"$hostsync":~/www/vendor/;
rsync -av -e 'ssh -K ' vendor/ creneaux@"$hostsync":~/www/vendor/;
;;
esac
;;
"clear")
if [ -z "$2" ]
then
echo "clear all / composer / node";
exit 2;
fi
case $2 in
"all")
echo "rm -rf vendor/ ; rm -rf node_modules/ ; rm -f yarn.lock ; rm -f composer.lock";
rm -rf vendor/ ; rm -rf node_modules/ ; rm -f yarn.lock ; rm -f composer.lock;
;;
"node")
rm -rf node_modules/ && rm -f yarn.lock;
;;
"composer")
rm -rf vendor/ && rm composer.lock
;;
*)
echo "clear all / composer / node";
exit 2;
;;
esac;
;;
"optijs")
test -z "$2" && echo "optijs build / clear" && exit 2;
case $2 in
"build")
./maintenance.sh optijs clear
echo bin/optimize.sh js/build.js terser;
bin/optimize.sh js/build.js terser;
;;
"clear")
echo rm js/$(grep RJSFILE .env | cut -d= -f2 | sed s/\.js/\.\*/);
rm js/$(grep RJSFILE .env | cut -d= -f2 | sed s/\.js/\.\*/);
;;
esac;
;;
*)
echo "build / sync / clear / optijs" 1>&2 && exit 1;
;;
esac