-
Notifications
You must be signed in to change notification settings - Fork 4
/
status.sh
executable file
·75 lines (63 loc) · 1.53 KB
/
status.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
ok() {
echo "📗 $@"
}
warn() {
echo "📙 $@"
}
error() {
echo "📕 $@"
}
dirstatus() {
dir="$1"
if [ ! -d "$dir" ]; then
error "Not a directory: $dir"
return
fi
id=${dir%/}
echo "📘 $dir"
if [ -f "$id/README.md" ]; then
ok "$id/README.md"
else
warn "Missing $id/README.md"
fi
if [ -f "$id/Makefile" ]; then
BARTOC=`grep --color=never -Po '(?<=BARTOC=)(.+)' "$id/Makefile"`
if [ -z "$BARTOC" ]; then
error "No BARTOC"
else
ok $BARTOC
curl --silent "https://bartoc.org/api/data?uri=$BARTOC" | jq -c '.[]|.identifier?'
fi
else
error "Missing $id/Makefile"
fi
CONCEPTS="$dir$id-concepts.ndjson"
if [ -f "$CONCEPTS" ]; then
ok `wc -l "$CONCEPTS"`
if [ ! -z "$JSKOS_METRICS" ]; then
METRICS="$dir/$id-metrics.ndjson"
$JSKOS_METRICS concepts "$CONCEPTS" > "$METRICS" && ok "$METRICS"
fi
else
IGNORED=$(git check-ignore $CONCEPTS)
if [ -z "$IGNORED" ]; then
warn "Missing $CONCEPTS"
else
ok "$CONCEPTS is not stored in jskos-data"
fi
fi
# TODO: move to another repository?
ls $dir$id-mappings.ndjson $dir$id-concordance.json 2> /dev/null
echo
}
if [ $# -eq 0 ]; then
for dir in */; do
[ "$dir" == "node_modules/" ] && continue
dirstatus "$dir"
done
else
for arg in "$@"; do
dirstatus "$arg"
done
fi