forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw-all-plugins
executable file
·58 lines (52 loc) · 1.65 KB
/
draw-all-plugins
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
#!/bin/sh
SCRIPTS_DIR=$(dirname "$0")
. "${SCRIPTS_DIR}/include-common"
#set -x
OUTPUT="$SOURCE/doc/images/plugins.dot"
echo "strict digraph G {" > "$OUTPUT"
#echo " ratio = 1.4;" >> $OUTPUT
#echo " fontsize = 20;" >> $OUTPUT
#echo " ratio = \"compress\";" >> $OUTPUT
#echo " size = \"140,100\";" >> $OUTPUT
## echo " orientation = \"portrait\";" >> $OUTPUT
echo " splines = true;" >> "$OUTPUT"
echo
#echo " plugin [shape=Mdiamond];" >> $OUTPUT
for i in $(ls "$SOURCE/src/plugins"); do
if [ -d "$SOURCE/src/plugins/$i" ]; then
r="$SOURCE/src/plugins/$i/README.md"
p=$(grep "^- infos/provides" "$r" | cut -f 2 -d =)
if [ "$p" ]; then
p=$(echo "$p" | tr '/' ' ')
for x in $(echo "$p"); do
echo " $x [shape=Mdiamond];" >> "$OUTPUT"
echo " $i -> $x;" >> "$OUTPUT" # [label=\"provides\"];"
#echo " $x -> plugin;" >> $OUTPUT # [label=\"is a\"];"
done
else
echo " $i [shape=Mdiamond];" >> "$OUTPUT" # [label=\"is a\"];"
#echo " $i -> plugin;" >> $OUTPUT # [label=\"is a\"];"
fi
fi
done
echo "}" >> "$OUTPUT"
echo >> "$OUTPUT"
unflatten -o "${OUTPUT}.flatten" "$OUTPUT"
rm -f "$SOURCE/doc/images/plugins.pdf"
fdp -Tps "${OUTPUT}.flatten" -o "$SOURCE/doc/images/plugins.ps" &&
gs -dDEVICEWIDTHPOINTS=1454 \
-dDEVICEHEIGHTPOINTS=1012 \
-dPDFFitPage \
-sPAPERSIZE=a4 \
-dFIXEDMEDIA \
-dSAFER \
-sOutputFile="$SOURCE/doc/images/plugins.pdf" \
-sDEVICE=pdfwrite \
-dSubsetFonts=true \
-dEmbedAllFonts=true \
-sPAPERSIZE=a4 \
-dBATCH \
-dNOPAUSE \
-f "$SOURCE/doc/images/plugins.ps"
#fdp -Tpdf ${OUTPUT}.flatten -o $SOURCE/doc/images/plugins.pdf # bad fonts
fdp -Tpng "${OUTPUT}.flatten" -o "$SOURCE/doc/images/plugins.png"