forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_plugins.sh
executable file
·40 lines (30 loc) · 1010 Bytes
/
check_plugins.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
@INCLUDE_COMMON@
echo
echo ELEKTRA PLUGIN SOURCE CHECK TEST SUITE
echo
check_version
check_wrong_export() {
WC=$(grep -r "ELEKTRA_PLUGIN_$1" "$2" | wc -l)
[ $WC -le 1 ]
succeed_if "It is likely that you are resetting a function pointer $WC times in your export, please use the word ELEKTRA_PLUGIN_$1 only once in your plugin $2"
}
PLUGINS_DIR="@CMAKE_SOURCE_DIR@/src/plugins"
for PLUGIN in $(ls "$PLUGINS_DIR"); do
PLUGIN_DIR="$PLUGINS_DIR/$PLUGIN"
if [ ! -d "$PLUGIN_DIR" ]; then
continue
fi
echo "Do in-source check for plugin $PLUGIN"
README="$PLUGINS_DIR/README.md"
WC=$(grep "^- \[$PLUGIN\]($PLUGIN/)" "$README" | wc -l)
[ $WC -eq 1 ]
succeed_if "Your plugin $PLUGIN does not have an entry ^- [$PLUGIN]($PLUGIN/) in $README"
if [ $PLUGIN != doc ]; then
check_wrong_export GET "$PLUGIN_DIR"
check_wrong_export SET "$PLUGIN_DIR"
check_wrong_export OPEN "$PLUGIN_DIR"
check_wrong_export CLOSE "$PLUGIN_DIR"
check_wrong_export ERROR "$PLUGIN_DIR"
fi
done
end_script plugins