Skip to content

Commit

Permalink
Merge branch 'rangerz-cache-clean'
Browse files Browse the repository at this point in the history
  • Loading branch information
markshust committed Oct 14, 2021
2 parents 767d691 + 39938b8 commit 46e19ec
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 23 additions & 1 deletion compose/bin/cache-clean
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions compose/bin/clinotty
Original file line number Diff line number Diff line change
@@ -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 "$@"
3 changes: 2 additions & 1 deletion compose/bin/cliq
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions compose/bin/devtools-cli-check

This file was deleted.

15 changes: 11 additions & 4 deletions compose/bin/n98-magerun2
Original file line number Diff line number Diff line change
@@ -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 "$@"
3 changes: 1 addition & 2 deletions compose/bin/start
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 46e19ec

Please sign in to comment.