зеркало из https://github.com/mislav/hub.git
add script/test for running tests
Instruct it to fail on Ruby syntax warnings coming from only the code in this project.
This commit is contained in:
Родитель
0f71386f68
Коммит
5fbd7c75bd
|
@ -1,3 +1,5 @@
|
|||
script: script/test
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.2
|
||||
|
|
|
@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|||
s.files += Dir.glob("lib/**/*")
|
||||
s.files += Dir.glob("bin/**/*")
|
||||
s.files += Dir.glob("man/**/*")
|
||||
s.files += Dir.glob("script/**/*")
|
||||
s.files += Dir.glob("test/**/*")
|
||||
|
||||
s.executables = %w( hub )
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
STATUS=0
|
||||
warnings="${TMPDIR:-/tmp}/hub-warnings.$$"
|
||||
|
||||
run() {
|
||||
# Save warnings on stderr to a separate file
|
||||
RUBYOPT="$RUBYOPT -w" bundle exec "$@" \
|
||||
2> >(tee >(grep 'warning:' >>"$warnings") | grep -v 'warning:') || STATUS=$?
|
||||
}
|
||||
|
||||
check_warnings() {
|
||||
# Display Ruby warnings from this project's source files. Abort if any were found.
|
||||
num="$(grep -F "$PWD" "$warnings" | grep -v "${PWD}/bundle" | sort | uniq -c | sort -rn | tee /dev/stderr | wc -l)"
|
||||
rm -f "$warnings"
|
||||
if [ "$num" -gt 0 ]; then
|
||||
echo "FAILED: this test suite doesn't tolerate Ruby syntax warnings!" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run rake test
|
||||
run cucumber features
|
||||
|
||||
check_warnings
|
||||
|
||||
exit $STATUS
|
Загрузка…
Ссылка в новой задаче