forked from build-trust/ockam
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_documentation.sh
More file actions
executable file
·77 lines (60 loc) · 2.3 KB
/
Copy pathcheck_documentation.sh
File metadata and controls
executable file
·77 lines (60 loc) · 2.3 KB
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
76
77
#!/usr/bin/env bash
if [ -z "$OCKAM_HOME" ]; then
echo "Please set OCKAM_HOME to the repo root"
exit 1
fi
# Getting Started Guide
export GUIDE_DOCS="$OCKAM_HOME/documentation/guides/rust"
export GUIDE_EXAMPLES="$OCKAM_HOME/examples/rust/get_started/examples"
# Hello Ockam ReadMe
export HELLO_DOC="$OCKAM_HOME/README.md"
export HELLO_EXAMPLE="$OCKAM_HOME/examples/rust/get_started/examples"
# Kafka
export KAFKA_DOCS="$OCKAM_HOME/documentation/use-cases/end-to-end-encryption-through-kafka"
export KAFKA_EXAMPLES="$OCKAM_HOME/examples/rust/ockam_kafka/examples"
# E2E
export E2E_DOCS="$OCKAM_HOME/documentation/use-cases/end-to-end-encryption-with-rust"
export E2E_EXAMPLES="$OCKAM_HOME/examples/rust/get_started/examples" # TODO
# documentation/use-cases/secure-remote-access-tunnels
export INLET_DOCS="$OCKAM_HOME/documentation/use-cases/secure-remote-access-tunnels"
export INLET_EXAMPLES="$OCKAM_HOME/examples/rust/tcp_inlet_and_outlet/examples"
# documentation/use-cases/end-to-end-encrypt-all-application-layer-communication
export E2EAALC_DOCS="$OCKAM_HOME/documentation/use-cases/end-to-end-encrypt-all-application-layer-communication"
export E2EAALC_EXAMPLES="$OCKAM_HOME/examples/rust/tcp_inlet_and_outlet/examples"
# documentation/use-cases/run-ockam-on-riscv
# This documentation is not using compiled code, it could drift from the current Ockam API.
# Tools home
export TOOLS_DIR="$OCKAM_HOME/tools/docs"
# Install example_blocks binary, if needed
if [ -z "$(which example_blocks)" ]; then
echo "Building example_blocks utility"
pushd "$TOOLS_DIR/example_blocks" &>/dev/null || exit
cargo -q install --path .
popd &>/dev/null || exit
fi
ERR=0
function check_directory {
doc_dir=$1
dir=$2
for page in $(find "$doc_dir" -name README.md); do
check_readme "$page" "$dir"
done
}
function check_readme {
page=$1
export EXAMPLES_DIR=$2
if ! "$TOOLS_DIR"/verify_md.sh "$page"; then
echo "$page has outdated examples differing from $EXAMPLES_DIR"
ERR=1
fi
}
check_directory "$GUIDE_DOCS" "$GUIDE_EXAMPLES"
check_directory "$KAFKA_DOCS" "$KAFKA_EXAMPLES"
check_directory "$E2E_DOCS" "$E2E_EXAMPLES"
check_directory "$INLET_DOCS" "$INLET_EXAMPLES"
check_directory "$E2EAALC_DOCS" "$E2EAALC_EXAMPLES"
check_readme "$HELLO_DOC" "$HELLO_EXAMPLE"
if [[ $ERR -eq 0 ]]; then
echo "All okay"
fi
exit $ERR