cache-clean 834 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. COMPOSER_GLOBAL=/var/www/.composer-global
  3. CACHE_CLEAN=${COMPOSER_GLOBAL}/vendor/bin/cache-clean.js
  4. if ! bin/cliq ls $CACHE_CLEAN; then
  5. echo "Installing devtools metapackage, just a moment..."
  6. bin/cliq mkdir -p ${COMPOSER_GLOBAL}
  7. bin/composer init --working-dir=${COMPOSER_GLOBAL} --quiet --no-interaction
  8. bin/composer require --working-dir=${COMPOSER_GLOBAL} --quiet markshust/magento2-metapackage-devtools-cli:^1.0
  9. echo "Devtools installed."
  10. fi
  11. if [ "$1" == "--watch" ]; then
  12. # Kill duplicate watch process
  13. WATCH_PID=$(bin/clinotty ps -eaf | grep "$CACHE_CLEAN --quiet --watch" | grep -v grep | awk '{print $2}')
  14. if [[ "" != "$WATCH_PID" ]]; then
  15. bin/cliq kill -9 "$WATCH_PID"
  16. fi
  17. # Run watch mode in the background
  18. bin/cliq $CACHE_CLEAN --quiet --watch &
  19. else
  20. bin/cli $CACHE_CLEAN "$@"
  21. fi