File: check-markdown-docs.sh

package info (click to toggle)
mlpack 4.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 31,272 kB
  • sloc: cpp: 226,039; python: 1,934; sh: 1,198; lisp: 414; makefile: 85
file content (53 lines) | stat: -rwxr-xr-x 1,493 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash
#
# This script checks to ensure that generated Markdown documentation is the same
# as what's committed to the repository.  After configuring mlpack with
# -DBUILD_MARKDOWN_BINDINGS=ON, use this simple script to detect changes in the
# documentation that should be committed.
#
# The only argument of the script is to the build directory.
if [ "$#" -ne 1 ];
then
  echo "Usage: $0 build/";
  echo "  (replace build/ with your build directory, where you already"
  echo "   ran 'make markdown')";
  exit 1;
fi

build_dir="$1";

# Check that Markdown documentation has been built.
if [[ ! -d "$build_dir/doc/" ]];
then
  echo "$build_dir/doc/ does not exist!";
  echo "Did you run 'make markdown' in your build directory ($build_dir)?";
  exit 1;
fi

# Now check every file in the main repository bindings.
for f in doc/user/bindings/*;
do
  echo "Checking $f...";
  f_base=`basename $f`;

  if [[ ! -f "$build_dir/doc/$f_base" ]];
  then
    echo "$build_dir/doc/$f_base does not exist!";
    echo "Did you run 'make markdown' in your build directory ($build_dir)?";
    echo "Or does the file need to be removed from the repository?";
    exit 1;
  fi

  diff -Nau $f "$build_dir/doc/$f_base";

  if [ "$?" -ne 0 ];
  then
    echo "";
    echo "";
    echo "Files $f and $build_dir/doc/$f_base differ!  (See above.)";
    echo "";
    echo "If the sidebar differs, be sure to check if updates are needed in ";
    echo "quickstart/*.sidebar.html!";
    exit 1;
  fi
done