Tweak script to add POT generation on update

This commit is contained in:
Mike Jolley 2019-06-24 15:29:26 +01:00
parent dab6e4d257
commit fcf06e97a3
2 changed files with 29 additions and 8 deletions

View File

@ -15,15 +15,38 @@ output() {
echo "$(tput setaf "$1")$2$(tput sgr0)"
}
updating=false
# Script args.
while [ ! $# -eq 0 ]
do
case "$1" in
--updating | -u)
updating=true
;;
esac
shift
done
# Autoloader
output 3 "Updating autoloader classmaps..."
composer dump-autoload --no-dev
output 2 "Done"
# Convert textdomains
output 3 "Updating package textdomains..."
# Find woo-gutenberg-products-block textdomain and replace with woocommerce
# Replace text domains within packages with woocommerce
find ./packages/woocommerce-blocks -iname '*.php' -exec sed -i.bak -e "s/'woo-gutenberg-products-block'/'woocommerce'/g" {} \;
# Find woocommerce-rest-api textdomain and replace with woocommerce
find ./packages/woocommerce-rest-api -iname '*.php' -exec sed -i.bak -e "s/'woocommerce-rest-api'/'woocommerce'/g" {} \;
# Cleanup backup files
find ./packages -name "*.bak" -type f -delete
output 2 "Done"
if ( $updating ); then
# Update POT file
output 3 "Updating POT file..."
grunt makepot
output 2 "Done"
fi

View File

@ -32,12 +32,10 @@
},
"scripts": {
"post-install-cmd": [
"composer dump-autoload --no-dev",
"sh ./bin/replace-package-textdomains.sh"
"sh ./bin/package-update.sh"
],
"post-update-cmd": [
"composer dump-autoload --no-dev",
"sh ./bin/replace-package-textdomains.sh"
"sh ./bin/package-update.sh --updating"
],
"test": [
"phpunit"