-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.sh
executable file
·46 lines (35 loc) · 1.22 KB
/
build.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
#!/bin/bash
if [[ $# -lt 1 ]]; then
echo " Usage is:
$0 <version> [clean] [api]
Where:
'version' is CrafterCMS version, like 4.0.3
'clean' is used to clean prior to build the docs
'api' is used to generate the OAS API docs"
exit 1
fi
VERSION=$1
STUDIO=https://raw.githubusercontent.com/craftercms/studio/v$VERSION/src/main/api/2/studio-api-2.yaml
ENGINE=https://raw.githubusercontent.com/craftercms/engine/v$VERSION/src/main/api/1/engine-api.yaml
DEPLOYER=https://raw.githubusercontent.com/craftercms/deployer/v$VERSION/src/main/api/deployer-api.yaml
# Clean if required
if [ "$2" = "clean" ] || [ "$3" = "clean" ]; then
make clean
fi
# Build the basic structure
#make html
if [ "$3" = "api" ] || [ "$2" = "api" ]; then
# Pull down the spec
#curl -s $STUDIO > /tmp/studio.json
#curl -s $ENGINE > /tmp/engine.json
curl -s $DEPLOYER > /tmp/deployer.json
# Build the OAS spec
mkdir -p source/_static/api
#redoc-cli build -o source/_static/api/studio.html /tmp/studio.json
#redoc-cli build -o build/html/api/engine.html /tmp/engine.json
redoc-cli build -o build/html/api/deployer.html /tmp/deployer.json
# Remove temporary files
#rm /tmp/studio.json
#rm /tmp/engine.json
rm /tmp/deployer.json
fi