Skip to content

Commit 4e3122f

Browse files
committed
validate.sh: Add test for validating plugin repository structure
1 parent cbddfab commit 4e3122f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

validate.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ test_dependencies() {
2828
test_dep "find"
2929
}
3030

31+
test_repository_structure() {
32+
cd "${ROOTDIR}"
33+
if [ ! -d "Repository" ]; then
34+
print_clr ${ERROR} " Repository is missing expected 'Repository' folder"
35+
exit 104
36+
fi
37+
while read LINE; do
38+
if ! [[ "$LINE" =~ ^Repository/[0-9]([.][0-9]){3}(/[^/]+){2}/[^/]+json$ ]]; then
39+
error=$?
40+
print_clr ${ERROR} " FAIL: Invalid path ${LINE}"
41+
fi
42+
done < <(find Repository/ -iname '*.json' -type f)
43+
44+
[ ! -z "$error" ] && exit $error
45+
print_clr ${SUCCESS} " SUCCESS: Repository directory structure"
46+
}
47+
3148
check_sha256() {
3249
[ "$#" -ne 2 ] && exit 103;
3350

@@ -54,6 +71,7 @@ validate() {
5471
}
5572

5673
test_dependencies
74+
test_repository_structure
5775

5876
for file in ${ROOTDIR}/**; do
5977
[ "${file: -5}" == ".json" ] && validate "${file}"

0 commit comments

Comments
 (0)