You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/packaging_cli-doc/runme.sh

39 lines
1.0 KiB
Bash

#!/usr/bin/env bash
set -eux
source virtualenv.sh
mkdir -p "${JUNIT_OUTPUT_DIR}" # ensure paths relative to this path work
cli_doc="${JUNIT_OUTPUT_DIR}/../../../packaging/cli-doc"
build="${cli_doc}/build.py"
template="template.j2"
# Test `rst` command
pip install jinja2
rst_dir="${OUTPUT_DIR}/rst"
python.py "${build}" rst --output-dir "${rst_dir}" && ./verify.py "${rst_dir}"
python.py "${build}" rst --output-dir "${rst_dir}" --template "${template}" && ./verify.py "${rst_dir}"
# Test `man` command (and the argcomplete code path)
pip install docutils argcomplete
man_dir="${OUTPUT_DIR}/man"
python.py "${build}" man --output-dir "${man_dir}" && ./verify.py "${man_dir}"
python.py "${build}" man --output-dir "${man_dir}" --template "${template}" && ./verify.py "${man_dir}"
# Test `json` command
python.py "${build}" json --output-file docs.json && ls -l docs.json
# Ensure complete coverage of the main conditional
echo "import sys; sys.path.insert(0, '${cli_doc}'); import build" > cover.py
python.py cover.py