mirror of https://github.com/zulip/zulip.git
test-documentation: Factor out the terminal goo for coloring messages.
This commit is contained in:
parent
f1f5b25969
commit
618beb7110
|
@ -1,6 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
color_message () {
|
||||||
|
local color_code="$1" message="$2"
|
||||||
|
echo -e "\e[${color_code}m${message}\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
|
@ -22,22 +26,16 @@ rm -rf _build
|
||||||
# The crawler would take a very long time to finish and TravisCI would fail as a result.
|
# The crawler would take a very long time to finish and TravisCI would fail as a result.
|
||||||
sphinx-build -j8 -b html -d _build/doctrees -D html_theme_options.collapse_navigation=True . _build/html
|
sphinx-build -j8 -b html -d _build/doctrees -D html_theme_options.collapse_navigation=True . _build/html
|
||||||
|
|
||||||
echo -en "\033[0;94m"
|
color_message 94 "Testing links in documentation..."
|
||||||
echo "Testing links in documentation..."
|
|
||||||
echo -en "\033[0m"
|
|
||||||
|
|
||||||
cd ../tools/documentation_crawler
|
cd ../tools/documentation_crawler
|
||||||
set +e
|
set +e
|
||||||
scrapy crawl_with_status documentation_crawler $loglevel
|
scrapy crawl_with_status documentation_crawler $loglevel
|
||||||
result=$?
|
result=$?
|
||||||
if [ "$result" = 1 ]; then
|
if [ "$result" = 1 ]; then
|
||||||
echo -en "\033[0;91m"
|
color_message 91 "Failed!"
|
||||||
echo "Failed!"
|
|
||||||
echo -en "\033[0m"
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo -en "\033[0;92m"
|
color_message 92 "Passed!"
|
||||||
echo "Passed!"
|
|
||||||
echo -en "\033[0m"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue