1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 18:04:03 +00:00

Shellify check script

This commit is contained in:
Viktor Szépe 2021-09-30 23:41:03 +02:00 committed by GitHub
parent 157318e61b
commit f53d2385b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

41
check
View file

@ -1,53 +1,56 @@
#!/bin/bash
set -e
offer_run() {
read -p "For more output, run $1. Run it now (Y/n)? " run
local run
case ${run:0:1} in
n|N )
exit 1
read -r -p "For more output, run ${*}. Run it now (Y/n)? " run
case "${run:0:1}" in
n|N)
exit 2
;;
* )
$1
*)
eval "${@}"
;;
esac
exit 1
}
if (php-cs-fixer fix --dry-run --config=.php-cs-fixer.php > /dev/null 2>/dev/null); then
set -e
if (php-cs-fixer fix --dry-run --config=.php-cs-fixer.php >/dev/null 2>&1); then
echo '✅ php-cs-fixer OK'
else
read -p "⚠️ php-cs-fixer found issues. Fix (Y/n)? " fix
case ${fix:0:1} in
n|N )
read -r -p "⚠️ php-cs-fixer found issues. Fix (Y/n)? " fix
case "${fix:0:1}" in
n|N)
echo '❌ php-cs-fixer FAIL'
offer_run 'php-cs-fixer fix --config=.php-cs-fixer.php'
offer_run php-cs-fixer fix --config=.php-cs-fixer.php
;;
* )
if (php-cs-fixer fix --config=.php-cs-fixer.php > /dev/null 2>/dev/null); then
*)
if (php-cs-fixer fix --config=.php-cs-fixer.php >/dev/null 2>&1); then
echo '✅ php-cs-fixer OK'
else
echo '❌ php-cs-fixer FAIL'
offer_run 'php-cs-fixer fix --config=.php-cs-fixer.php'
offer_run php-cs-fixer fix --config=.php-cs-fixer.php
fi
;;
esac
fi
if (./vendor/bin/phpstan analyse > /dev/null 2>/dev/null); then
if (./vendor/bin/phpstan analyse >/dev/null 2>&1); then
echo '✅ PHPStan OK'
else
echo '❌ PHPStan FAIL'
offer_run './vendor/bin/phpstan analyse'
offer_run ./vendor/bin/phpstan analyse
fi
if (./vendor/bin/pest > /dev/null 2>/dev/null); then
if (./vendor/bin/pest >/dev/null 2>&1); then
echo '✅ PEST OK'
else
echo '❌ PEST FAIL'
offer_run './vendor/bin/pest'
offer_run ./vendor/bin/pest
fi
echo '=================='