This repository was archived by the owner on Aug 11, 2020. It is now read-only.
forked from sendgrid/sendgrid-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprism.sh
More file actions
executable file
·58 lines (49 loc) · 1.41 KB
/
prism.sh
File metadata and controls
executable file
·58 lines (49 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -eu
install () {
echo "Installing Prism..."
UNAME=$(uname)
ARCH=$(uname -m)
if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then
echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases"
exit 1
fi
if [ "$UNAME" = "Darwin" ] ; then
OSX_ARCH=$(uname -m)
if [ "${OSX_ARCH}" = "x86_64" ] ; then
PLATFORM="darwin_amd64"
fi
elif [ "$UNAME" = "Linux" ] ; then
LINUX_ARCH=$(uname -m)
if [ "${LINUX_ARCH}" = "i686" ] ; then
PLATFORM="linux_386"
elif [ "${LINUX_ARCH}" = "x86_64" ] ; then
PLATFORM="linux_amd64"
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"
DEST=../prism/bin/prism
if [ -z $LATEST ] ; then
echo "Error requesting. Download binary from ${URL}"
exit 1
else
curl -L $URL -o $DEST
chmod +x $DEST
fi
}
run () {
echo "Running prism..."
cd ../prism/bin
./prism run --mock --spec https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json
}
if [ -f ../prism/bin/prism ]; then
echo "Prism is already installed."
run
else
echo "Prism is not installed."
install
run
fi