github.com/echohead/hub@v2.2.1+incompatible/script/ruby-test (about) 1 #!/usr/bin/env bash 2 set -e 3 4 STATUS=0 5 warnings="${TMPDIR:-/tmp}/gh-warnings.$$" 6 7 run() { 8 # Save warnings on stderr to a separate file 9 RUBYOPT="$RUBYOPT -w" bundle exec "$@" \ 10 2> >(tee >(grep 'warning:' >>"$warnings") | grep -v 'warning:') || STATUS=$? 11 } 12 13 check_warnings() { 14 # Display Ruby warnings from this project's source files. Abort if any were found. 15 num="$(grep -F "$PWD" "$warnings" | grep -v "${PWD}/vendor/bundle" | sort | uniq -c | sort -rn | tee /dev/stderr | wc -l)" 16 rm -f "$warnings" 17 if [ "$num" -gt 0 ]; then 18 echo "FAILED: this test suite doesn't tolerate Ruby syntax warnings!" >&2 19 exit 1 20 fi 21 } 22 23 if tmux -V; then 24 if [ -n "$CI" ]; then 25 git --version 26 bash --version | head -1 27 zsh --version 28 echo 29 fi 30 profile="all" 31 else 32 echo "warning: skipping shell completion tests (install tmux to enable)" >&2 33 profile="default" 34 fi 35 36 run cucumber -p "$profile" 37 check_warnings 38 39 exit $STATUS