Created
August 2, 2017 09:48
-
-
Save esolitos/14107ee719865765906407e1b73c0607 to your computer and use it in GitHub Desktop.
Automatically updates a list of modules, asks for confirmation, and commits code changes. (has to be run from DRUPAL_ROOT)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DRUSH=$(which drush) | |
GIT=$(which git) | |
if [ -z $DRUSH -o -z $GIT ]; then | |
echo "Missing drush!" | |
exit -1 | |
fi | |
required_updates="$(drush up -q -n --pipe 2>/dev/null)" | |
for mdl in $required_updates; do | |
mdl_path="$(drush pmi --fields=path --format=list $mdl)" | |
echo "#" | |
echo "# Upgrading module: $mdl" | |
echo "#" | |
$DRUSH up -y "$mdl" | |
echo "#" | |
echo "# Git status after upgrade: $mdl" | |
echo "#" | |
$GIT status "$mdl_path" | |
echo "#" | |
echo "# Please test the site and come back." | |
echo "#" | |
read -p "Is the site working fine? " -n 1 -r | |
if [[ ! $REPLY =~ ^[Yy]$ ]] | |
then | |
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 | |
fi | |
$GIT add "$mdl_path" | |
$GIT commit -m "Update module: $mdl" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment