Created
September 14, 2020 08:40
-
-
Save opi/160a38319417a6e7957e20d798321161 to your computer and use it in GitHub Desktop.
Drupal 7 Contrib update
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 | |
function greenecho { | |
echo "" && echo -e "\e[30;48;5;82m ✔ $1 \e[0m" | |
} | |
function orangeecho { | |
echo "" && echo -e "\e[30;48;5;208m ⚠ $1 \e[0m" | |
} | |
greenecho "Here we are: "$(pwd) | |
#CONTRIB_NAME=$1 | |
# Update sources | |
greenecho "Update sources ..." | |
git pull --quiet origin master | |
greenecho "Check for outdated modules" | |
MODULE_LIST=$(drush pm-updatecode --no-core -n --pipe) | |
# drush pm-updatecode --no-core -n --pipe > $MODULE_LIST 2>/dev/null | |
if [ -n "$MODULE_LIST" ] ; then | |
# greenecho "Modules to update: $MODULE_LIST" | |
while read MODULE; do | |
greenecho "Updating $MODULE..." | |
drush up --quiet -y $MODULE > /dev/null | |
MODULE_NAME=$(drush pm-info ${MODULE} --fields=title --format=list) | |
MODULE_VERSION=$(drush pm-info ${MODULE} --fields=version --format=list) | |
MODULE_PATH=$(drush pm-info ${MODULE} --fields=path --format=list) | |
git add --all $MODULE_PATH > /dev/null | |
git commit -m "[up] $MODULE_NAME $MODULE_VERSION" | |
done < <(printf '%s\n' "$MODULE_LIST") | |
else | |
orangeecho "Nothing to update" | |
fi | |
greenecho "Push updated sources" | |
git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment