Skip to content

Instantly share code, notes, and snippets.

@Saeven
Created November 11, 2021 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Saeven/195029053f9e9c36bb9c8936de7da032 to your computer and use it in GitHub Desktop.
Save Saeven/195029053f9e9c36bb9c8936de7da032 to your computer and use it in GitHub Desktop.
Git Post-Checkout Hook to Switch between Laminas and Zend Framework
#!/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
@Saeven
Copy link
Author

Saeven commented Nov 11, 2021

If you have never used these before, just stick it in .git/hooks/post-checkout, and then make that script executable with chmod +x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment