Skip to content

Commit d8237d5

Browse files
committed
Cleaned up and improved drush subcommand
1 parent 2844ef7 commit d8237d5

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

scripts/itkdev-docker-compose

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,9 @@ fi
542542

543543
# Helper function to call `docker compose` in the right context
544544
docker_compose () {
545-
# Note: Apparently, using --project-directory or --file options for `docker compose` will break use of `$PWD` in
546-
# compose file. Therefore, we `cd` before running `docker compose` command.
547-
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker compose "$@")
545+
# Note: Apparently, using --project-directory or --file options for `docker compose` will break use of `$PWD` in
546+
# compose file. Therefore, we `cd` before running `docker compose` command.
547+
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker compose "$@")
548548
}
549549

550550
cmd="$1"
@@ -824,17 +824,9 @@ EOF
824824
;;
825825

826826
drush)
827-
root=/app
828-
if [ -d $docker_compose_dir/web ]; then
829-
root=/app/web
830-
fi
831-
if [ -e $docker_compose_dir/vendor/bin/drush.php ]; then
832-
docker_compose exec phpfpm php /app/vendor/bin/drush.php --root=$root "$@"
833-
elif [ -e $docker_compose_dir/vendor/bin/drush ]; then
834-
docker_compose exec phpfpm /app/vendor/bin/drush --root=$root "$@"
835-
else
836-
docker_compose run --rm drush --root=$root "$@"
837-
fi
827+
# We use the `… phpfpm php vendor/bin/drush` to run Drush to make debugging (with Xdebug) work.
828+
# Calling `… phpfpm vendor/bin/drush` somehow does not trigger a debugging session.
829+
docker_compose exec phpfpm php vendor/bin/drush
838830
;;
839831

840832
composer)

0 commit comments

Comments
 (0)