From cbddfab4e1d094217ca3abf20238455c7930b099 Mon Sep 17 00:00:00 2001 From: Sebastian 'gonX' Jensen Date: Sat, 24 May 2025 13:58:20 +0200 Subject: [PATCH 1/2] validate.sh: Add 'find' to deps --- validate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/validate.sh b/validate.sh index abe431c..5a4337c 100755 --- a/validate.sh +++ b/validate.sh @@ -25,6 +25,7 @@ test_dependencies() { test_dep "sha256sum" test_dep "jq" test_dep "xargs" + test_dep "find" } check_sha256() { From 4e3122fe573636f30110f40c5c01f42a148394ca Mon Sep 17 00:00:00 2001 From: Sebastian 'gonX' Jensen Date: Sat, 24 May 2025 13:58:47 +0200 Subject: [PATCH 2/2] validate.sh: Add test for validating plugin repository structure --- validate.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/validate.sh b/validate.sh index 5a4337c..651b17f 100755 --- a/validate.sh +++ b/validate.sh @@ -28,6 +28,23 @@ test_dependencies() { test_dep "find" } +test_repository_structure() { + cd "${ROOTDIR}" + if [ ! -d "Repository" ]; then + print_clr ${ERROR} " Repository is missing expected 'Repository' folder" + exit 104 + fi + while read LINE; do + if ! [[ "$LINE" =~ ^Repository/[0-9]([.][0-9]){3}(/[^/]+){2}/[^/]+json$ ]]; then + error=$? + print_clr ${ERROR} " FAIL: Invalid path ${LINE}" + fi + done < <(find Repository/ -iname '*.json' -type f) + + [ ! -z "$error" ] && exit $error + print_clr ${SUCCESS} " SUCCESS: Repository directory structure" +} + check_sha256() { [ "$#" -ne 2 ] && exit 103; @@ -54,6 +71,7 @@ validate() { } test_dependencies +test_repository_structure for file in ${ROOTDIR}/**; do [ "${file: -5}" == ".json" ] && validate "${file}"