Skip to content

Instantly share code, notes, and snippets.

@massich
Last active February 5, 2018 11:05
Show Gist options
  • Save massich/f382ec0181ce6603b38208f9dec3e4d4 to your computer and use it in GitHub Desktop.
Save massich/f382ec0181ce6603b38208f9dec3e4d4 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This script installs Travis helper functions and tools used in openmeeg repositories
#
# To use them, add the following lines in .travis.yml:
# - export DL_DIR=$HOME/downloads # Export the path where to store downloaded files
# - curl -fsSkL https://gist.github.com/massich/f382ec0181ce6603b38208f9dec3e4d4/raw > x.sh && source ./x.sh
function _download() {
url="$1"; f="${2:-$(basename $url)}";
if [ ! -e $DL_DIR/$f ] ; then
mkdir -p $DL_DIR ;
echo "Downloading: ${DL_DIR}/$f" ;
travis_retry wget --no-verbose $url -O $DL_DIR/$f ;
else
echo "Reading from cache: ${DL_DIR}/$f" ;
fi
}
function download() { _download "$1" "" ; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment