Skip to content
Snippets Groups Projects

WIP: Resolve "Add asciidoctor syntax check to CI tests"

Closed Jon Azpiazu requested to merge 17-add-asciidoctor-syntax-check-to-ci-tests into master
1 unresolved thread

Files

#!/bin/bash
if ! [ -x "$(command -v asciidoctor)" ]; then
echo "Error: asciidoctor is not installed"
exit 1
fi
if [ -z "$1" ] ; then
echo "Error: No argument supplied - path needed"
exit 1
fi
for foo in $(find "$1" -name '*.adoc') ; do asciidoctor $foo 2>&1 | tee -a output.log ; done
adoc_errors=0 ; adoc_warnings=0
adoc_errors=$(grep -c "ERROR" output.log)
adoc_warnings=$(grep -c "WARNING" output.log)
echo "AsciiDoc format Found ${adoc_errors} errors and ${adoc_warnings} warnings"
if [ "${adoc_errors}" -eq 0 ]; then exit 0; else exit 1; fi
Loading