Skip to content

Commit

Permalink
Fix travis changed module detection
Browse files Browse the repository at this point in the history
If new module was added the dif contains only + and no - so from
now we chack on ^+ in Puppetfile diff.
  • Loading branch information
xbezdick committed Dec 8, 2014
1 parent b907c47 commit de49d50
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .travis.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash
set -ev
MODS="$(git diff HEAD~1 Puppetfile | grep ^- -B2 | grep mod | cut -d"'" -f2)"
MODS="$(git diff HEAD~1 Puppetfile | grep ^+ -B2 | grep mod | cut -d"'" -f2)"
rake validate_puppetfile SPEC_OPTS='--format documentation --color --backtrace' || exit 1
for module in ${MODS}; do
if [ -e ./${module}/Rakefile ]; then
rake test_modules[./${module}/Rakefile] SPEC_OPTS='--format documentation --color --backtrace' || exit 1
else
echo "Missing ./${module}/Rakefile, not running spec tests."
fi
done
if [ "${MODS}" != "" ]; then
for module in ${MODS}; do
if [ -e ./${module}/Rakefile ]; then
rake test_modules[./${module}/Rakefile] SPEC_OPTS='--format documentation --color --backtrace' || exit 1
else
echo "Missing ./${module}/Rakefile, not running spec tests. You have to manually check whether this is OK."
exit 1
fi
done
else
echo "No changed module detected. You have to manually check whether this is OK."
git diff HEAD~1 Puppetfile
exit 1
fi

0 comments on commit de49d50

Please sign in to comment.