From b762036306e9e49524fb27d3d23d0cd4af25ae6e Mon Sep 17 00:00:00 2001 From: Hannes Kirsman Date: Fri, 23 Feb 2024 14:49:33 +0200 Subject: [PATCH] #7 Add script to update grumphp.yml to add DDEV support. --- scripts/update-grumphp-command.php | 28 ++++++++++++++++++++++++++++ src/InstallHelperPlugin.php | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100755 scripts/update-grumphp-command.php diff --git a/scripts/update-grumphp-command.php b/scripts/update-grumphp-command.php new file mode 100755 index 0000000..58f770d --- /dev/null +++ b/scripts/update-grumphp-command.php @@ -0,0 +1,28 @@ +#!/bin/bash + +# +# Script to update the grumphp.yml file to use both Lando and DDEV on GIT commit. +# +# It's run on composer install, only if grumphp.yml exists and if it contains: +# EXEC_GRUMPHP_COMMAND: lando php +# This is the previous default we've used. +# + +# Path to the grumphp.yml file +config_file="grumphp.yml" + +if [ -f "grumphp.yml" ]; then + sed -i "s#EXEC_GRUMPHP_COMMAND: lando php#EXEC_GRUMPHP_COMMAND: \"[ -d .ddev/traefik/ ] \&\& GRUMPHP_COMMAND='ddev php' || GRUMPHP_COMMAND='lando php' \&\& \$GRUMPHP_COMMAND\"#g" grumphp.yml + + # Did sed replace? + if [ $? -eq 0 ]; then + # Add a message to the user. + color_red="\033[0;31m" + color_reset="\033[0m" + printf "${color_red}Added DDEV support to $config_file.\n" + echo "Please run \"ddev grumphp git:init\" for the changes to take affect." + printf "${color_reset}" + fi + + +fi diff --git a/src/InstallHelperPlugin.php b/src/InstallHelperPlugin.php index 7f234a9..cff0d29 100644 --- a/src/InstallHelperPlugin.php +++ b/src/InstallHelperPlugin.php @@ -120,8 +120,8 @@ public function onWunderIoDdevDrupalPackageInstall(PackageEvent $event) { self::deployDdevFiles(); - #$output = shell_exec('bash vendor/wunderio/lando-drupal/scripts/load_extensions.sh'); - #$this->io->write("{$output}"); + $output = shell_exec('bash vendor/wunderio/ddev-drupal/scripts/update-grumphp-command.php'); + $this->io->write("{$output}"); } /**