diff --git a/README.md b/README.md index 1ba907bd7..7f0e3f53e 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,6 @@ It is recommended to keep your root docker config files in one repository, and y - `bin/copytocontainer`: Copy folders or files from host to container. Ex. `bin/copytocontainer --all` - `bin/dev-urn-catalog-generate`: Generate URN's for PHPStorm and remap paths to local host. Restart PHPStorm after running this command. - `bin/devconsole`: Alias for `bin/n98-magerun2 dev:console` -- `bin/devtools-cli-check`: Check & install the CLI devtools if missing from system. - `bin/download`: Download specific Magento version from Composer to `/var/www/html` directory within the container. Ex. `bin/download 2.4.3 community` - `bin/fixowns`: This will fix filesystem ownerships within the container. - `bin/fixperms`: This will fix filesystem permissions within the container. diff --git a/compose/bin/cache-clean b/compose/bin/cache-clean index 7cee1cce3..4c5147a72 100755 --- a/compose/bin/cache-clean +++ b/compose/bin/cache-clean @@ -1,2 +1,24 @@ #!/bin/bash -bin/cli /var/www/.composer-global/vendor/bin/cache-clean.js "$@" +COMPOSER_GLOBAL=/var/www/.composer-global +CACHE_CLEAN=${COMPOSER_GLOBAL}/vendor/bin/cache-clean.js + +if ! bin/cliq ls $CACHE_CLEAN; then + echo "Installing devtools metapackage, just a moment..." + bin/cliq mkdir -p ${COMPOSER_GLOBAL} + bin/composer init --working-dir=${COMPOSER_GLOBAL} --quiet --no-interaction + bin/composer require --working-dir=${COMPOSER_GLOBAL} --quiet markshust/magento2-metapackage-devtools-cli:^1.0 + echo "Devtools installed." +fi + +if [ "$1" == "--watch" ]; then + # Kill duplicate watch process + WATCH_PID=$(bin/clinotty ps -eaf | grep "$CACHE_CLEAN --quiet --watch" | grep -v grep | awk '{print $2}') + if [[ "" != "$WATCH_PID" ]]; then + bin/cliq kill -9 "$WATCH_PID" + fi + + # Run watch mode in the background + bin/cliq $CACHE_CLEAN --quiet --watch & +else + bin/cli $CACHE_CLEAN "$@" +fi diff --git a/compose/bin/clinotty b/compose/bin/clinotty index 03f650db1..6bbc871f7 100755 --- a/compose/bin/clinotty +++ b/compose/bin/clinotty @@ -1,3 +1,4 @@ #!/bin/bash [ -z "$1" ] && echo "Please specify a CLI command (ex. ls)" && exit +# -T: Disable pseudo-tty allocation docker-compose exec -T phpfpm "$@" diff --git a/compose/bin/cliq b/compose/bin/cliq index f7171fbeb..53e2dec4b 100755 --- a/compose/bin/cliq +++ b/compose/bin/cliq @@ -1,3 +1,4 @@ #!/bin/bash [ -z "$1" ] && echo "Please specify a CLI command (ex. ls)" && exit -bin/clinotty "$@" >/dev/null +# Without stdout and stderr +bin/clinotty "$@" >/dev/null 2>&1 diff --git a/compose/bin/devtools-cli-check b/compose/bin/devtools-cli-check deleted file mode 100755 index 49d985ef2..000000000 --- a/compose/bin/devtools-cli-check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -if ! bin/clinotty ls /var/www/.composer-global/vendor/bin/cache-clean.js 1> /dev/null 2>&1; then - echo "Installing devtools metapackage, just a moment..." - bin/cliq mkdir -p /var/www/.composer-global - bin/composer require --working-dir=/var/www/.composer-global --quiet markshust/magento2-metapackage-devtools-cli:^1.0 - echo "Devtools installed." -fi diff --git a/compose/bin/n98-magerun2 b/compose/bin/n98-magerun2 index 48db1cc45..d79335ab0 100755 --- a/compose/bin/n98-magerun2 +++ b/compose/bin/n98-magerun2 @@ -1,7 +1,14 @@ #!/bin/bash -if ! bin/clinotty ls bin/n98-magerun2.phar 1> /dev/null 2>&1; then - bin/clinotty mkdir -p bin - bin/clinotty curl https://files.magerun.net/n98-magerun2.phar -o bin/n98-magerun2.phar - bin/clinotty chmod +x bin/n98-magerun2.phar +if ! bin/cliq ls bin/n98-magerun2.phar; then + echo "Downloading n98-magerun2.phar, just a moment..." + bin/clinotty curl -sS -O https://files.magerun.net/n98-magerun2.phar + bin/clinotty curl -sS -o n98-magerun2.phar.sha256 https://files.magerun.net/sha256.php?file=n98-magerun2.phar + bin/clinotty shasum -a 256 -c n98-magerun2.phar.sha256 + [ $? != 0 ] && echo "sha256 checksum do not match!" && exit + + bin/cliq chmod +x n98-magerun2.phar + bin/cliq mkdir -p bin + bin/cliq mv n98-magerun2.phar bin fi + bin/cli bin/n98-magerun2.phar "$@" diff --git a/compose/bin/start b/compose/bin/start index 7aabc7e3f..7aa3b03f2 100755 --- a/compose/bin/start +++ b/compose/bin/start @@ -57,5 +57,4 @@ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --remove-or ## Then uncomment the below line (and leave uncommented) to start the agent automatically with bin/start: #bin/root /etc/init.d/blackfire-agent start -bin/devtools-cli-check -bin/cliq /var/www/.composer-global/vendor/bin/cache-clean.js --quiet --watch & +bin/cache-clean --watch