2017-02-13 14:01:54 -05:00
|
|
|
#!/usr/bin/env bash
|
2016-01-07 13:57:15 -05:00
|
|
|
|
2016-10-12 15:25:49 -04:00
|
|
|
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
source "${SCRIPTDIR}/.validate"
|
2016-01-07 13:57:15 -05:00
|
|
|
|
|
|
|
IFS=$'\n'
|
2016-10-31 14:22:28 -04:00
|
|
|
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) )
|
2016-01-07 13:57:15 -05:00
|
|
|
unset IFS
|
|
|
|
|
|
|
|
if [ ${#files[@]} -gt 0 ]; then
|
2016-10-31 14:22:28 -04:00
|
|
|
# We run vndr to and see if we have a diff afterwards
|
|
|
|
vndr
|
2016-01-07 13:57:15 -05:00
|
|
|
# Let see if the working directory is clean
|
|
|
|
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
|
|
|
|
if [ "$diffs" ]; then
|
|
|
|
{
|
2016-10-31 14:22:28 -04:00
|
|
|
echo 'The result of vndr differs'
|
2016-01-07 13:57:15 -05:00
|
|
|
echo
|
|
|
|
echo "$diffs"
|
|
|
|
echo
|
2016-10-31 14:22:28 -04:00
|
|
|
echo 'Please vendor your package with github.com/LK4D4/vndr.'
|
2016-01-07 13:57:15 -05:00
|
|
|
echo
|
|
|
|
} >&2
|
|
|
|
false
|
|
|
|
else
|
|
|
|
echo 'Congratulations! All vendoring changes are done the right way.'
|
|
|
|
fi
|
2016-10-12 15:25:49 -04:00
|
|
|
else
|
|
|
|
echo 'No vendor changes in diff.'
|
2016-01-07 13:57:15 -05:00
|
|
|
fi
|