2020-09-21 14:20:18 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-10-06 07:36:18 +00:00
|
|
|
# Output colorized strings
|
|
|
|
#
|
|
|
|
# Color codes:
|
|
|
|
# 0 - black
|
|
|
|
# 1 - red
|
|
|
|
# 2 - green
|
|
|
|
# 3 - yellow
|
|
|
|
# 4 - blue
|
|
|
|
# 5 - magenta
|
|
|
|
# 6 - cian
|
|
|
|
# 7 - white
|
|
|
|
output() {
|
|
|
|
echo "$(tput setaf "$1")$2$(tput sgr0)"
|
|
|
|
}
|
2020-09-21 14:20:18 +00:00
|
|
|
|
|
|
|
output 6 "Prefixing the appropriate vendor namespaces with Automattic\WooCommerce\Vendor"
|
|
|
|
|
2020-09-22 07:19:12 +00:00
|
|
|
# Replace "League\Container" in "use" and "namespace" with "Automattic\WooCommerce\Vendor\League\Container".
|
|
|
|
REGEX='s/^[[:space:]]*(use|namespace)[[:space:]]*(League\\Container)/\1 Automattic\\WooCommerce\\Vendor\\\2/g'
|
|
|
|
|
2020-10-21 12:26:30 +00:00
|
|
|
find ./vendor/league/container -iname '*.php' -exec sed -i'.bak' -E -e "$REGEX" {} \;
|
2020-09-25 09:15:12 +00:00
|
|
|
find ./vendor/league/container -name "*.php.bak" -type f -delete
|
|
|
|
|
|
|
|
# Replace too in the composer.json file for the package.
|
2020-10-21 12:26:30 +00:00
|
|
|
sed -i'.bak' -E -e "s/\"(League\\\\\\\Container)/\"Automattic\\\\\\\WooCommerce\\\\\\\Vendor\\\\\\\\\1/g" vendor/league/container/composer.json
|
2020-09-25 09:15:12 +00:00
|
|
|
rm -f vendor/league/container/composer.json.bak
|
|
|
|
|