forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetrics_doc.sh
executable file
·33 lines (27 loc) · 1 KB
/
metrics_doc.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
#!/bin/bash -e
# Copyright IBM Corp All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
fabric_dir="$(cd "$(dirname "$0")/.." && pwd)"
metrics_template="${fabric_dir}/docs/source/metrics_reference.rst.tmpl"
metrics_doc="${fabric_dir}/docs/source/metrics_reference.rst"
gendoc_command="go run github.com/hyperledger/fabric/common/metrics/cmd/gendoc -template ${metrics_template}"
case "$1" in
# check if the metrics documentation is up to date with the metrics
# options in the tree
"check")
if [ -n "$(diff -u <(cd ${fabric_dir} && ${gendoc_command}) ${metrics_doc})" ]; then
echo "The Fabric metrics reference documentation is out of date."
echo "Please run '$0 generate' to update the documentation."
exit 1
fi
;;
# generate the metrics documentation
"generate")
(cd "${fabric_dir}" && ${gendoc_command} > ${metrics_doc})
;;
*)
echo "Please specify check or generate"
exit 1
;;
esac