-
Notifications
You must be signed in to change notification settings - Fork 7
/
develop
executable file
·59 lines (51 loc) · 1.66 KB
/
develop
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
#!/usr/bin/env bash
#
# ./develop
# This is a helper script that wraps the typical commands you will execute on the Docker container. It saves the developer
# from needing to explicitly run the commands through docker-compose. E.g: `docker-compose exec app php` becomes
#
# See the comments in the script below for more detailed information.
#
# Create docker-compose command to run
COMPOSE="docker-compose -f docker-compose.yml"
# If we pass any arguments...
if [ $# -gt 0 ];then
# If "composer" is used, pass-thru to "composer"
# inside a new container
if [ "$1" == "composer" ]; then
shift 1
$COMPOSE run --rm \
-w /var/www \
pasvl \
php -dmemory_limit=-1 /usr/local/bin/composer "$@"
# If "test" is used, run unit tests,
# pass-thru any extra arguments to phpunit
elif [ "$1" == "test" ]; then
shift 1
$COMPOSE run --rm \
-w /var/www \
pasvl \
./vendor/phpunit/phpunit/phpunit "$@" --testdox
# If "debug" is used, run unit tests with xdebug enabled,
# pass-thru any extra arguments to phpunit
elif [ "$1" == "debug" ]; then
shift 1
$COMPOSE run --rm \
-w /var/www \
pasvl \
php -dxdebug.remote_autostart=1 ./vendor/phpunit/phpunit/phpunit "$@" --testdox
# If "php" is used, run php interpreter,
# pass-thru any extra arguments to php
elif [ "$1" == "php" ]; then
shift 1
$COMPOSE run --rm \
-w /var/www \
pasvl \
php "$@"
# Else, pass-thru args to docker-compose
else
$COMPOSE "$@"
fi
else
$COMPOSE ps
fi