Created
November 11, 2021 04:26
-
-
Save Saeven/195029053f9e9c36bb9c8936de7da032 to your computer and use it in GitHub Desktop.
Git Post-Checkout Hook to Switch between Laminas and Zend Framework
This file contains hidden or 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 | |
PWD = `pwd -P` | |
reinstall() { | |
rm -rf ${PWD}/vendor | |
composer install | |
bower install | |
} | |
if grep -q "zendframework/zend-servicemanager" "${PWD}/composer.json"; then | |
if [ ! -d "${PWD}/vendor/zendframework/zend-servicemanager" ]; then | |
echo "Composer is tuned for Zend Framework, but is not present in /vendor. Autoswitching..."; | |
reinstall | |
fi | |
elif grep -q "laminas/laminas-servicemanager" "${PWD}/composer.json"; then | |
if [ ! -d "${PWD}/vendor/laminas/laminas-servicemanager" ]; then | |
echo "Composer is tuned for Laminas, but is not present in /vendor. Autoswitching..."; | |
reinstall | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have never used these before, just stick it in .git/hooks/post-checkout, and then make that script executable with chmod +x