forked from hackclub/OnBoard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject_check.sh
executable file
·43 lines (36 loc) · 1.01 KB
/
project_check.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
41
42
43
#!/usr/bin/env bash
# This script is used to check the formatting of all the projects in the repo.
base_dir="./projects/"
has_errors=0
for project_dir in "$base_dir"*/; do
errors=""
# Check if 'cart.png' exists
if [ ! -f "$project_dir/cart."* ]; then
errors+="\n missing cart.png"
fi
# Check if 'README.md' exists
if [ ! -f "$project_dir/README.md" ]; then
errors+="\n missing README.md"
fi
# Check if '/src' directory is non-empty
if [ ! -d "$project_dir/src" ] || [ -z "$(ls -A "$project_dir/src")" ]; then
errors+="\n empty or missing /src directory"
fi
# Check if 'gerber.zip' exists
if [ ! -f "$project_dir/gerber.zip" ]; then
errors+="\n missing gerber.zip"
fi
# Check if 'schematic.pdf' exists
if [ ! -f "$project_dir/schematic."* ]; then
errors+="\n missing schematic.pdf"
fi
if [ ! -z "$errors" ]; then
has_errors=1
printf "Project $project_dir has errors:"
printf "$errors"
echo ""
fi
done
if [ $has_errors -eq 1 ]; then
exit 1
fi