Skip to content

Commit 232a705

Browse files
committed
- update readme
- add install script
1 parent bc31fc1 commit 232a705

2 files changed

Lines changed: 60 additions & 1 deletion

File tree

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,22 @@ The perfect OAS (Swagger 2) companion. Turn any OAS file into an API server with
66

77
[Documentation - https://designer.stoplight.io/docs/prism](https://designer.stoplight.io/docs/prism?utm_source=github&utm_medium=prism)
88

9-
Downloads available over in [releases](https://github.com/stoplightio/prism/releases).
9+
## Installation
10+
11+
On OS X or Linux:
12+
13+
```
14+
curl https://raw.githubusercontent.com/stoplightio/prism/master/install.sh | sh
15+
```
16+
17+
On Windows download [binary](https://github.com/stoplightio/prism/releases).
18+
19+
## Update
20+
21+
```
22+
prism update
23+
```
24+
or
25+
```
26+
prism up
27+
```

install.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
3+
install () {
4+
5+
set -eu
6+
7+
UNAME=$(uname)
8+
ARCH=$(uname -m)
9+
if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then
10+
echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases"
11+
exit 1
12+
fi
13+
14+
if [ "$UNAME" = "Darwin" ] ; then
15+
OSX_ARCH=$(uname -m)
16+
if [ "${OSX_ARCH}" = "x86_64" ] ; then
17+
PLATFORM="darwin_amd64"
18+
fi
19+
elif [ "$UNAME" = "Linux" ] ; then
20+
LINUX_ARCH=$(uname -m)
21+
if [ "${LINUX_ARCH}" = "i686" ] ; then
22+
PLATFORM="linux_386"
23+
elif [ "${LINUX_ARCH}" = "x86_64" ] ; then
24+
PLATFORM="linux_amd64"
25+
fi
26+
fi
27+
28+
LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2)
29+
URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM"
30+
DEST=/usr/local/bin/prism
31+
32+
if [ -z $LATEST ] ; then
33+
echo "Error requesting. Download binary from ${URL}"
34+
exit 1
35+
else
36+
curl -sL $URL -o $DEST
37+
chmod +x $DEST
38+
fi
39+
}
40+
41+
install

0 commit comments

Comments
 (0)