Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ test_dependencies() {
test_dep "sha256sum"
test_dep "jq"
test_dep "xargs"
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() {
Expand Down Expand Up @@ -53,6 +71,7 @@ validate() {
}

test_dependencies
test_repository_structure

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