-
Notifications
You must be signed in to change notification settings - Fork 241
/
dcp
executable file
·51 lines (49 loc) · 1.69 KB
/
dcp
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
#!/usr/bin/env bash
COMPOSE="docker-compose"
if [ $# -gt 0 ]; then
if [ "$1" == "up" ]; then
$COMPOSE up -d
elif [ "$1" == "reload" ] || [ "$1" == "restart" ] || [ "$1" == "rs" ] || [ "$1" == "rl" ]; then
$COMPOSE down && $COMPOSE up -d
elif [ "$1" == "artisan" ] || [ "$1" == "art" ] || [ "$1" == "a" ]; then
shift 1
EXEC_CMD="cd /var/www/html && php artisan $@"
$COMPOSE exec app bash -c "$EXEC_CMD"
elif [ "$1" == "bin/console" ]; then
shift 1
EXEC_CMD="cd /var/www/html && php bin/console $@"
$COMPOSE exec app bash -c "$EXEC_CMD"
elif [ "$1" == "app/console" ]; then
shift 1
EXEC_CMD="cd /var/www/html && php app/console $@"
$COMPOSE exec app bash -c "$EXEC_CMD"
elif [ "$1" == "test" ]; then
shift 1
$COMPOSE run --rm -w /var/www/html app ./vendor/bin/phpunit $@
elif [ "$1" == "t" ]; then
shift 1
$COMPOSE exec app bash -c "cd /var/www/html && ./vendor/bin/phpunit $@"
elif [ "$1" == "composer" ]; then
shift 1
EXEC_CMD="cd /var/www/html && composer $@"
$COMPOSE exec app bash -c "$EXEC_CMD"
elif [ "$1" == "yarn" ]; then
shift 1
$COMPOSE run --rm -w /var/www/html node yarn $@
elif [ "$1" == "npm" ]; then
shift 1
$COMPOSE run --rm -w /var/www/html node npm $@
elif [ "$1" == "php" ]; then
shift 1
EXEC_CMD="cd /var/www/html && php $@"
$COMPOSE exec app bash -c "$EXEC_CMD"
elif [ "$1" == "node" ]; then
shift 1
EXEC_CMD="cd /var/www/html && node $@"
$COMPOSE exec app bash -c "$EXEC_CMD"
else
$COMPOSE $@
fi
else
$COMPOSE ps
fi