This repository has been archived by the owner on Apr 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsf.sh
82 lines (67 loc) · 2.05 KB
/
sf.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
#!/bin/bash
# Commandes Disponibles
# - cache
# - cache:dev
# - cache:prod
# - composer:update
# - composer:install
# - composer:require string
# - php:ssh
# - mysql:ssh
# - apache:ssh
# - symfony:new
# - symfony:console command
# Doit correspondre au container_name du docker_composer.yml
PHP_container=sf_php
DB_container=sf_db
APACHE_container=sf_apache
if [ -z "$1" ]; then
COMMANDS="
Commande|Description\n
cache|Vide le cache de dev et prod\n
cache:dev|Vide le cache de dev\n
cache:prod|Vide le cache de prod\n
composer:update|Lance la commande composer:update\n
composer:install|Lance la commande composer:install\n
composer:require string|Lance la commande composer:require votrebunle\n
php:ssh|Vous connecte sur le container php en ssh\n
apache:ssh|Vous connecte sur le container apache en ssh\n
db:ssh|Vous connecte sur le container db en ssh\n
symfony:console string|Lance la commande de console de symfony avec vos paramètres\n
"
echo -e $COMMANDS | column -t -s "|"
fi
# Symfony
if [[ $1 == "cache" ]]; then
docker exec -it $PHP_container php app/console cache:clear
docker exec -it $PHP_container php app/console cache:clear -e=prod
fi
if [[ $1 == "cache:dev" ]]; then
docker exec -it $PHP_container php app/console cache:clear
fi
if [[ $1 == "cache:prod" ]]; then
docker exec -it $PHP_container php app/console cache:clear -e=prod
fi
if [[ $1 == "symfony:console" ]]; then
docker exec -it $PHP_container php app/console "${@:2}"
fi
# Composer
if [[ $1 == "composer:update" ]]; then
docker exec -it $PHP_container composer update
fi
if [[ $1 == "composer:install" ]]; then
docker exec -it $PHP_container composer install
fi
if [[ $1 == "composer:require" ]]; then
docker exec -it $PHP_container composer require "${@:2}"
fi
# SSH
if [[ $1 == "php:ssh" ]]; then
docker exec -it $PHP_container bash
fi
if [[ $1 == "apache:ssh" ]]; then
docker exec -it $APACHE_container bash
fi
if [[ $1 == "db:ssh" ]]; then
docker exec -it $DB_container bash
fi