mirror of https://github.com/mum4k/termdash.git
Travis now checks for missing licences in files.
This commit is contained in:
parent
8e43506e75
commit
4cefd0b77f
|
@ -10,5 +10,6 @@ script:
|
|||
- go test -race ./...
|
||||
- go vet ./...
|
||||
- diff -u <(echo -n) <(gofmt -d -s .)
|
||||
- diff -u <(echo -n) <(scripts/autogen_licences.sh .)
|
||||
after_success:
|
||||
- ./scripts/coverage.sh
|
||||
|
|
|
@ -28,7 +28,11 @@ if [ "$#" -eq 0 ]; then
|
|||
fi
|
||||
|
||||
DIRECTORY="$1"
|
||||
WRITE="$2"
|
||||
|
||||
WRITE=""
|
||||
if [ "$#" -ge 3 ]; then
|
||||
WRITE="$2"
|
||||
fi
|
||||
|
||||
if [ ! -d "${BIN_DIR}" ]; then
|
||||
echo "Directory ${BIN_DIR} doesn't exist."
|
||||
|
@ -49,16 +53,23 @@ if [ "${WRITE}" == "WRITE" ]; then
|
|||
DRY_RUN=""
|
||||
else
|
||||
DRY_RUN="echo "
|
||||
echo "The WRITE argument not specified, dry run mode."
|
||||
echo "Would have executed:"
|
||||
fi
|
||||
|
||||
ADD_LICENCE="${DRY_RUN}${AUTOGEN} -i --no-top-level-comment"
|
||||
FIND_FILES="find ${DIRECTORY} -type f -name \*.go"
|
||||
LICENCE="Licensed under the Apache License"
|
||||
|
||||
MISSING=0
|
||||
|
||||
for FILE in `eval ${FIND_FILES}`; do
|
||||
if ! grep -q "${LICENCE}" "${FILE}"; then
|
||||
MISSING=1
|
||||
eval "${ADD_LICENCE} ${FILE}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ! -z "$DRY_RUN" ]] && [ $MISSING -eq 1 ]; then
|
||||
echo -e "\nFound files with missing licences. To fix, run the commands above."
|
||||
echo "Or just execute:"
|
||||
echo "$0 . WRITE"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue