Skip to content

Commit

Permalink
#7 Add script to update grumphp.yml to add DDEV support.
Browse files Browse the repository at this point in the history
  • Loading branch information
hkirsman committed Feb 23, 2024
1 parent 81e5197 commit b762036
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions scripts/update-grumphp-command.php
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src/InstallHelperPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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("<info>{$output}</info>");
$output = shell_exec('bash vendor/wunderio/ddev-drupal/scripts/update-grumphp-command.php');
$this->io->write("<info>{$output}</info>");
}

/**
Expand Down

0 comments on commit b762036

Please sign in to comment.