docs/tutorial/prepare_test_file.sh
author Boris Feld <boris.feld@octobus.net>
Wed, 18 Dec 2019 14:10:49 +0100
changeset 5227 b24de4b465ea
permissions -rwxr-xr-x
ci: Add CI job for building the documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5227
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     1
#!/bin/bash
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     2
set -euo pipefail
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     3
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     4
# Dependencies for the testfile
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     5
python -m pip install hg-docgraph
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     6
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     7
mkdir -p graphs output
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     8
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     9
CMD_NOT_FOUND=0
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    10
check_command() {
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    11
    cmd=$1
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    12
    if ! which "$cmd" >/dev/null 2>&1; then
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    13
        echo "Error: command '$cmd' not found in \$PATH"
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    14
        echo "Please install '$cmd'"
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    15
        CMD_NOT_FOUND=1
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    16
    else
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    17
        echo "$cmd command was found"
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    18
    fi
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    19
}
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    20
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    21
check_command aha
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    22
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    23
if [ "$CMD_NOT_FOUND" -ne "0" ]; then
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    24
    exit 1
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    25
fi
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    26
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    27
# Prepare directory for repositories generated by the training.t file
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    28
mkdir -p base-repos
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    29
b24de4b465ea ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    30
rm -Rf base-repos/*