Skip to content
Snippets Groups Projects
Commit 32389979 authored by Alan Nelson's avatar Alan Nelson
Browse files

Move common scripts to parent folder

parent 2dc8b045
No related branches found
No related tags found
2 merge requests!5Develop,!4Working copy
......@@ -15,16 +15,16 @@ all: \
# PHP Images
####################
php-lint_5.6:
docker build -t unl-its/php-lint:5.6 php-lint/5.6
docker build -t unl-its/php-lint:5.6 -f php-lint/5.6/Dockerfile php-lint
php-lint_7.0:
docker build -t unl-its/php-lint:7.0 php-lint/7.0
docker build -t unl-its/php-lint:7.0 -f php-lint/7.0/Dockerfile php-lint
php-lint_7.1:
docker build -t unl-its/php-lint:7.1 php-lint/7.1
docker build -t unl-its/php-lint:7.1 -f php-lint/7.1/Dockerfile php-lint
php-lint_7.2:
docker build -t unl-its/php-lint:7.2 php-lint/7.2
docker build -t unl-its/php-lint:7.2 -f php-lint/7.2/Dockerfile php-lint
php-lint_latest: php-lint_7.2
docker tag unl-its/php-lint:7.2 unl-its/php-lint:latest
......
#!/bin/bash
set -e
if [ "${1#-}" != "$1" ]; then
set -- php-lint "$@"
fi
exec "$@"
#!/bin/bash
# Read CLI options
LINT_DIRS=()
LINT_EXTS=()
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-e|--ext)
LINT_EXTS+=("$2")
shift
shift
;;
-d|--dir)
LINT_DIRS+=("$2")
shift
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-h|--help)
printf 'Usage: %s <options>\n' "$0"
printf '\t%s\n' "-e,--ext: Required argument: extensions to lint"
printf '\t%s\n' "-d,--dir: Required argument: directories to lint"
printf '\t%s\n' "-q,--quiet: Optional argument: Quiet mode, only print errors"
printf '\t%s\n' "-h,--help: Prints this help message"
exit 0
;;
*)
echo "Unrecognized option ${1}"
shift
;;
esac
done
# If no dirs were provided, use CWD
if [[ -z "$LINT_DIRS" ]]; then
LINT_DIRS=($(pwd))
fi
# If no extenions were provided, use reasonable defaults
if [[ -z "$LINT_EXTS" ]]; then
LINT_EXTS=(".php" ".phtml")
fi
# Run PHP Lint on all provided files and directories
for dir in "${LINT_DIRS[@]}"; do
for ext in "${LINT_EXTS[@]}"; do
echo "Scanning directory ${dir} for extension ${ext}"
# Scan current dir and ext and lint them
for f in $(find "${dir}" -type f -name "*${ext}"); do
OUTPUT=$(php -l $f 2>&1)
rc=$?
if [[ $rc != 0 ]]; then # Non-zero exit code, print error and exit
>&2 echo "$OUTPUT"
exit $rc
elif [[ $rc == 0 ]] && [[ $QUIET == false ]]; then # all ok
echo "$OUTPUT"
fi
done
done
done
#!/bin/bash
set -e
if [ "${1#-}" != "$1" ]; then
set -- php-lint "$@"
fi
exec "$@"
#!/bin/bash
# Read CLI options
LINT_DIRS=()
LINT_EXTS=()
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-e|--ext)
LINT_EXTS+=("$2")
shift
shift
;;
-d|--dir)
LINT_DIRS+=("$2")
shift
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-h|--help)
printf 'Usage: %s <options>\n' "$0"
printf '\t%s\n' "-e,--ext: Required argument: extensions to lint"
printf '\t%s\n' "-d,--dir: Required argument: directories to lint"
printf '\t%s\n' "-q,--quiet: Optional argument: Quiet mode, only print errors"
printf '\t%s\n' "-h,--help: Prints this help message"
exit 0
;;
*)
echo "Unrecognized option ${1}"
shift
;;
esac
done
# If no dirs were provided, use CWD
if [[ -z "$LINT_DIRS" ]]; then
LINT_DIRS=($(pwd))
fi
# If no extenions were provided, use reasonable defaults
if [[ -z "$LINT_EXTS" ]]; then
LINT_EXTS=(".php" ".phtml")
fi
# Run PHP Lint on all provided files and directories
for dir in "${LINT_DIRS[@]}"; do
for ext in "${LINT_EXTS[@]}"; do
echo "Scanning directory ${dir} for extension ${ext}"
# Scan current dir and ext and lint them
for f in $(find "${dir}" -type f -name "*${ext}"); do
OUTPUT=$(php -l $f 2>&1)
rc=$?
if [[ $rc != 0 ]]; then # Non-zero exit code, print error and exit
>&2 echo "$OUTPUT"
exit $rc
elif [[ $rc == 0 ]] && [[ $QUIET == false ]]; then # all ok
echo "$OUTPUT"
fi
done
done
done
#!/bin/bash
set -e
if [ "${1#-}" != "$1" ]; then
set -- php-lint "$@"
fi
exec "$@"
#!/bin/bash
# Read CLI options
LINT_DIRS=()
LINT_EXTS=()
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-e|--ext)
LINT_EXTS+=("$2")
shift
shift
;;
-d|--dir)
LINT_DIRS+=("$2")
shift
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-h|--help)
printf 'Usage: %s <options>\n' "$0"
printf '\t%s\n' "-e,--ext: Required argument: extensions to lint"
printf '\t%s\n' "-d,--dir: Required argument: directories to lint"
printf '\t%s\n' "-q,--quiet: Optional argument: Quiet mode, only print errors"
printf '\t%s\n' "-h,--help: Prints this help message"
exit 0
;;
*)
echo "Unrecognized option ${1}"
shift
;;
esac
done
# If no dirs were provided, use CWD
if [[ -z "$LINT_DIRS" ]]; then
LINT_DIRS=($(pwd))
fi
# If no extenions were provided, use reasonable defaults
if [[ -z "$LINT_EXTS" ]]; then
LINT_EXTS=(".php" ".phtml")
fi
# Run PHP Lint on all provided files and directories
for dir in "${LINT_DIRS[@]}"; do
for ext in "${LINT_EXTS[@]}"; do
echo "Scanning directory ${dir} for extension ${ext}"
# Scan current dir and ext and lint them
for f in $(find "${dir}" -type f -name "*${ext}"); do
OUTPUT=$(php -l $f 2>&1)
rc=$?
if [[ $rc != 0 ]]; then # Non-zero exit code, print error and exit
>&2 echo "$OUTPUT"
exit $rc
elif [[ $rc == 0 ]] && [[ $QUIET == false ]]; then # all ok
echo "$OUTPUT"
fi
done
done
done
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment