-
Notifications
You must be signed in to change notification settings - Fork 2
/
template
executable file
·130 lines (114 loc) · 3.73 KB
/
template
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
#!/bin/bash
if [ -z "$1" ]
then
./template -h
elif [ "$1" = "switch" ]
then
if [ "$2" = "up" ]
then
cp bower_bkp.json bower.json
elif [ "$2" = "down" ]
then
cp bower_manter.json bower.json
else
echo "Defina porque irá trocar o arquivo"
echo " up -> irei upar pro github"
echo " down -> acabei de atualizar o template"
fi
elif [ "$1" = "update" ] ##############################################UPDATE
then
if [ -z "$2" ]
then
echo "Update simples"
bower update
cp --recursive bower_components/templatefsw/bootstrap ./
cp --recursive bower_components/templatefsw/dist ./
cp --recursive bower_components/templatefsw/plugins ./
else
if [ "$2" = "laravel" ]
then
echo "Fazendo o update do template, respeitando hierarquia laravel"
bower update
cp --recursive bower_components/templatefsw/bootstrap ./public/vendor/bootstrap
cp --recursive bower_components/templatefsw/dist/* ./public/dist/
cp --recursive bower_components/templatefsw/plugins ./public/plugins/
echo " Done"
else
echo "Ainda não há suporte para hierarquia $2"
fi
fi
elif [ "$1" = "install" ] #########################################INSTALL
then
if [ -z "$2" ]
then
echo "Instalando template"
bower install FSWTemplate
cp --recursive bower_components/templatefsw/bootstrap ./
cp --recursive bower_components/templatefsw/dist ./
cp --recursive bower_components/templatefsw/plugins ./
echo " Done"
else
if [ "$2" = "laravel" ]
then
echo "Instalando template, respeitando hierarquia laravel"
bower install FSWTemplate
cp --recursive bower_components/templatefsw/bootstrap ./public/vendor/bootstrap
cp --recursive bower_components/templatefsw/dist ./public/dist
cp --recursive bower_components/templatefsw/plugins ./public/plugins
else
echo "Ainda não há suporte para hierarquia $2"
fi
fi
elif [ "$1" = "fix-gulp" ]
then
echo "Instalando gulp local e plugins"
npm install gulp gulp-uglify gulp-less browser-sync gulp-header gulp-clean-css gulp-rename
echo " Done"
elif [ "$1" = "install-bower" ]
then
echo "Instalando bower"
sudo npm install bower -g
echo " Done"
elif [ "$1" = "install-gulp" ]
then
echo "Instalando gulp"
sudo npm install gulp -g
echo " Done"
elif [ "$1" = "laradock-up" ]
then
echo "Upando servidor \"laradock\""
cd laradock; sudo docker-compose up -d nginx phpmyadmin mysql
echo " Done"
elif [ "$1" = "laradock-down" ]
then
echo "Parando servidor \"laradock\""
cd laradock; sudo docker-compose down
echo " Done"
elif [ "$1" = "fix-laradock-error" ]
then
echo "Parando apache2"
sudo service apache2 stop
echo "Parando mysql"
sudo service mysql stop
echo "Parando phpmyadmin"
sudo service phpmyadmin stop
echo "Parando ssh"
sudo service ssh stop
echo " Done"
elif [ "$1" = "-h" ]
then
echo "Parâmetros aceitáveis"
echo " update → atualiza template (simples)"
echo " update laravel → atualiza template, respeitando pastas laravel"
echo " install → atualiza template (simples)"
echo " install laravel → instala template, respeitando pastas laravel"
echo " fix-gulp → instala gulp local e plugins necessários (do gulp)"
echo " install-bower → instala o bower globalmente (usando npm)"
echo " install-gulp → instala o gulp globalmente (usando npm)"
echo " laradock-up → upa o servidor laradock (se disponível)"
echo " laradock-down → upa o servidor laradock (se disponível)"
echo " fix-laradock-error → para serviços os quais provavelmente usam portas que o laradock irá usar (ssh, apache2, phpmyadmin e mysql)"
else
echo "ERRO: comando $1 não encontrado"
echo " Para saber os comandos disponíveis, use \"-h\""
fi