Skip to content

Commit de49d50

Browse files
committed
Fix travis changed module detection
If new module was added the dif contains only + and no - so from now we chack on ^+ in Puppetfile diff.
1 parent b907c47 commit de49d50

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.travis.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
#!/bin/bash
22
set -ev
3-
MODS="$(git diff HEAD~1 Puppetfile | grep ^- -B2 | grep mod | cut -d"'" -f2)"
3+
MODS="$(git diff HEAD~1 Puppetfile | grep ^+ -B2 | grep mod | cut -d"'" -f2)"
44
rake validate_puppetfile SPEC_OPTS='--format documentation --color --backtrace' || exit 1
5-
for module in ${MODS}; do
6-
if [ -e ./${module}/Rakefile ]; then
7-
rake test_modules[./${module}/Rakefile] SPEC_OPTS='--format documentation --color --backtrace' || exit 1
8-
else
9-
echo "Missing ./${module}/Rakefile, not running spec tests."
10-
fi
11-
done
5+
if [ "${MODS}" != "" ]; then
6+
for module in ${MODS}; do
7+
if [ -e ./${module}/Rakefile ]; then
8+
rake test_modules[./${module}/Rakefile] SPEC_OPTS='--format documentation --color --backtrace' || exit 1
9+
else
10+
echo "Missing ./${module}/Rakefile, not running spec tests. You have to manually check whether this is OK."
11+
exit 1
12+
fi
13+
done
14+
else
15+
echo "No changed module detected. You have to manually check whether this is OK."
16+
git diff HEAD~1 Puppetfile
17+
exit 1
18+
fi

0 commit comments

Comments
 (0)