forked from mingrammer/diagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autogen.sh
executable file
·81 lines (70 loc) · 1.82 KB
/
autogen.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
app_root_dir="diagrams"
# NOTE: azure icon set is not latest version
providers=(
"onprem"
"aws"
"azure"
"digitalocean"
"gcp"
"ibm"
"firebase"
"k8s"
"alibabacloud"
"oci"
"programming"
"saas"
"elastic"
"generic"
"openstack"
"outscale"
)
if ! [ -x "$(command -v round)" ]; then
echo 'round is not installed'
exit 1
fi
if ! [ -x "$(command -v inkscape)" ]; then
echo 'inkscape is not installed'
exit 1
fi
if ! [ -x "$(command -v convert)" ]; then
echo 'image magick is not installed'
exit 1
fi
if ! [ -x "$(command -v black)" ]; then
echo 'black is not installed'
exit 1
fi
# preprocess the resources
for pvd in "${providers[@]}"; do
# convert the svg to png for azure provider
if [ "$pvd" = "onprem" ] || [ "$pvd" = "azure" ]; then
echo "converting the svg to png using inkscape for provider '$pvd'"
python -m scripts.resource svg2png "$pvd"
fi
if [ "$pvd" == "oci" ] || [ "$pvd" = "ibm" ]; then
echo "converting the svg to png using image magick for provider '$pvd'"
python -m scripts.resource svg2png2 "$pvd"
fi
echo "cleaning the resource names for provider '$pvd'"
python -m scripts.resource clean "$pvd"
# round the all png images for aws provider
if [ "$pvd" = "aws" ]; then
echo "rounding the resources for provider '$pvd'"
python -m scripts.resource round "$pvd"
fi
done
# generate the module classes and docs
for pvd in "${providers[@]}"; do
echo "generating the modules & docs for provider '$pvd'"
python -m scripts.generate "$pvd"
done
# Generate doc for custom module
echo "generating the docs for custom"
python -m scripts.generate "custom"
# copy icons across to website
echo "copying icons to website static folder"
cp -r resources website/static/img/
# run black
echo "linting the all the diagram modules"
black "$app_root_dir"/**/*.py