-
Notifications
You must be signed in to change notification settings - Fork 85
/
setup.sh
58 lines (45 loc) · 1.72 KB
/
setup.sh
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
#!/usr/bin/env bash
PROJECT=$project
FORK=${FORK:-"swagger-api/swagger-inflector/master"}
if [ "$PROJECT" == "" ]
then
echo "set a project name like so:"
echo ""
echo "project=my-project"
echo ""
echo "and try again"
exit
fi
echo "fetching setup files from $FORK"
# setup dirs
mkdir -p editor
mkdir -p src/main/swagger
mkdir -p src/main/webapp/WEB-INF
if [ ! -f editor/swagger-editor.war ]; then
echo "...fetching editor webapp"
curl -sL "https://raw.githubusercontent.com/$FORK/scripts/bin/swagger-editor.war" -o editor/swagger-editor.war
curl -sL "https://raw.githubusercontent.com/$FORK/scripts/bin/jetty-runner.jar" -o editor/jetty-runner.jar
fi
echo "...fetching editor scripts"
curl -sL "https://raw.githubusercontent.com/$FORK/scripts/editor.sh" -o ./editor.sh
echo "...fetching sample swagger description"
wget --quiet --no-check-certificate "https://raw.githubusercontent.com/$FORK/scripts/openapi.yaml" -O src/main/swagger/openapi.yaml
echo "...fetching inflector configuration"
curl -sL "https://raw.githubusercontent.com/$FORK/scripts/inflector.yaml" -o ./inflector.yaml
echo "...fetching project pom"
curl -sL "https://raw.githubusercontent.com/$FORK/scripts/pom.xml" -o ./pom.xml
echo "...fetching web.xml"
curl -sL "https://raw.githubusercontent.com/$FORK/scripts/web.xml" -o src/main/webapp/WEB-INF/web.xml
chmod a+x ./editor.sh
rp="s/SAMPLE_PROJECT/$PROJECT/g"
sed -i -- $rp pom.xml
rm pom.xml--
echo "done! You can run swagger editor as follows:"
echo "./editor.sh"
echo "then open a browser at open http://localhost:8000"
echo ""
echo "you can run your server as follows:"
echo "mvn package jetty:run"
echo ""
echo "and your swagger listing will be at http://localhost:8080/{basePath}/openapi.json"
echo ""