forked from swagger-api/swagger-inflector
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
53 lines (42 loc) · 1.92 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
PROJECT=$project
if [ "$PROJECT" == "" ]
then
echo "set a project name like so:"
echo ""
echo "project=my-project"
echo ""
echo "and try again"
exit
fi
# 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"
wget --quiet --no-check-certificate "https://github.com/swagger-api/swagger-inflector/raw/master/scripts/bin/swagger-editor.war" -O editor/swagger-editor.war
fi
echo "...fetching editor scripts"
wget --quiet --no-check-certificate "https://github.com/swagger-api/swagger-inflector/raw/master/scripts/editor.xml" -O editor/editor.xml
wget --quiet --no-check-certificate "https://github.com/swagger-api/swagger-inflector/raw/master/scripts/editor.sh" -O ./editor.sh
echo "...fetching sample swagger description"
wget --quiet --no-check-certificate "https://raw.githubusercontent.com/swagger-api/swagger-inflector/master/scripts/swagger.yaml" -O src/main/swagger/swagger.yaml
echo "...fetching inflector configuration"
wget --quiet --no-check-certificate "https://raw.githubusercontent.com/swagger-api/swagger-inflector/master/scripts/inflector.yaml" -O ./inflector.yaml
echo "...fetching project pom"
wget --quiet --no-check-certificate "https://raw.githubusercontent.com/swagger-api/swagger-inflector/master/scripts/pom.xml" -O ./pom.xml
echo "...fetching web.xml"
wget --quiet --no-check-certificate "https://raw.githubusercontent.com/swagger-api/swagger-inflector/master/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}/swagger.json"
echo ""