From 203a42d83a5fdb95774a4c280552ac8cb8256c1f Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 2 Nov 2014 15:44:33 -0500 Subject: patch travis_fold and travis_nanoseconds to make it possible to test travis_helper.sh off travis --- scripts/travis_helper.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'scripts/travis_helper.sh') diff --git a/scripts/travis_helper.sh b/scripts/travis_helper.sh index 040ef29443..c42ce215e3 100755 --- a/scripts/travis_helper.sh +++ b/scripts/travis_helper.sh @@ -32,6 +32,26 @@ function mapbox_time { mapbox_time_finish $name $timer_id } +if [[ "${TRAVIS_COMMIT:-false}" == false ]]; then +function travis_fold { + local action=$1 + local name=$2 + echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}" +} +function travis_nanoseconds { + local cmd="date" + local format="+%s%N" + local os=$(uname) + + if hash gdate > /dev/null 2>&1; then + cmd="gdate" # use gdate if available + elif [[ "$os" = Darwin ]]; then + format="+%s000000000" # fallback to second precision on darwin (does not support %N) + fi + + $cmd -u $format +} +fi export ANSI_CLEAR export -f travis_fold -- cgit v1.2.1