From 93fc8ce35f32124694536969033550216aaa6244 Mon Sep 17 00:00:00 2001 From: Elmer Thomas Date: Fri, 25 May 2018 10:07:47 -0700 Subject: [PATCH] Update Prism --- .travis.yml | 4 ++-- test/prism.sh | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9705a57e9..ab4375d30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ addons: apt_packages: - pandoc before_script: -- . ./test/prism.sh -- prism version +- "./test/prism.sh &" +- sleep 20 script: - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then coverage run -m unittest2 discover; else coverage run -m unittest discover; fi after_script: diff --git a/test/prism.sh b/test/prism.sh index 9a37f7299..cc6a0bb15 100755 --- a/test/prism.sh +++ b/test/prism.sh @@ -1,8 +1,10 @@ #!/bin/bash +set -eu + install () { -set -eu +echo "Installing Prism..." UNAME=$(uname) ARCH=$(uname -m) @@ -25,25 +27,32 @@ elif [ "$UNAME" = "Linux" ] ; then fi fi +mkdir -p ../prism/bin #LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2) LATEST="v0.6.21" URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM" -DESTDIR=~/bin -DEST=$DESTDIR/prism +DEST=../prism/bin/prism if [ -z $LATEST ] ; then echo "Error requesting. Download binary from ${URL}" exit 1 else - mkdir -p $DESTDIR curl -L $URL -o $DEST chmod +x $DEST - export PATH=$PATH:$DESTDIR - prism version fi } -install +run () { + echo "Running prism..." + cd ../prism/bin + ./prism run --mock --spec https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json +} -# this is needed for travis internal scripts -set +u \ No newline at end of file +if [ -f ../prism/bin/prism ]; then + echo "Prism is already installed." + run +else + echo "Prism is not installed." + install + run +fi \ No newline at end of file