Skip to content

Commit

Permalink
Update Prism
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingserious committed May 25, 2018
1 parent 544fab7 commit 93fc8ce
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 18 additions & 9 deletions test/prism.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash

set -eu

install () {

set -eu
echo "Installing Prism..."

UNAME=$(uname)
ARCH=$(uname -m)
Expand All @@ -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
if [ -f ../prism/bin/prism ]; then
echo "Prism is already installed."
run
else
echo "Prism is not installed."
install
run
fi

0 comments on commit 93fc8ce

Please sign in to comment.