From 0514c38e54aacf50a8e0c603f8890879f22b4976 Mon Sep 17 00:00:00 2001 From: cytopia Date: Wed, 25 Jul 2018 08:56:45 +0200 Subject: [PATCH] Validate raw links --- .travis.yml | 1 + docs/Makefile | 2 ++ docs/_includes/links/docker-images.rst | 12 +++++------ docs/_includes/links/examples.rst | 2 +- docs/_includes/links/ssl.rst | 2 +- docs/_includes/links/tools.rst | 12 +++++++++++ docs/features.rst | 10 +++++----- docs/linkcheck.sh | 20 +++++++++++++++++++ .../customize-specific-virtual-host.rst | 8 +++++--- docs/vhost-gen/example-add-subdomains.rst | 6 ++++-- 10 files changed, 57 insertions(+), 18 deletions(-) create mode 100755 docs/linkcheck.sh diff --git a/.travis.yml b/.travis.yml index 0375727b..f279fdcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -187,6 +187,7 @@ script: cd docs/; make build; make linkcheck; + make linkcheck2; else .tests/test_single.sh . "${S1}" "${V1}" "${S2}" "${V2}"; fi diff --git a/docs/Makefile b/docs/Makefile index 87a765bf..e448550a 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -48,6 +48,8 @@ help: # warning and sphinx-build exits with exit status 1. +linkcheck2: + ./linkcheck.sh build: sphinx-build -a -E -n -j auto -q -W . _build/html diff --git a/docs/_includes/links/docker-images.rst b/docs/_includes/links/docker-images.rst index ff883a2a..f71e2ac1 100644 --- a/docs/_includes/links/docker-images.rst +++ b/docs/_includes/links/docker-images.rst @@ -1,35 +1,35 @@ .. |ext_lnk_docker_image_cockroach| raw:: html - + Cockroachc DB .. |ext_lnk_docker_image_grafana| raw:: html - + Grafana .. |ext_lnk_docker_image_postgres| raw:: html - + PostgreSQL .. |ext_lnk_docker_image_redis| raw:: html - + Redis .. |ext_lnk_docker_image_memcached| raw:: html - + Memcached .. |ext_lnk_docker_image_mongodb| raw:: html - + MongoDB diff --git a/docs/_includes/links/examples.rst b/docs/_includes/links/examples.rst index bd11c090..2d42e5c0 100644 --- a/docs/_includes/links/examples.rst +++ b/docs/_includes/links/examples.rst @@ -78,6 +78,6 @@ .. |ext_lnk_example_zend_documentation| raw:: html - + Official Zend Documentation diff --git a/docs/_includes/links/ssl.rst b/docs/_includes/links/ssl.rst index ff39531d..8f27dc05 100644 --- a/docs/_includes/links/ssl.rst +++ b/docs/_includes/links/ssl.rst @@ -6,6 +6,6 @@ .. |ext_lnk_ssl_blog_chrome_dev_hsts| raw:: html - + Chrome & Firefox now force .dev domains to HTTPS via preloaded HSTS diff --git a/docs/_includes/links/tools.rst b/docs/_includes/links/tools.rst index 2d9453df..d03532f1 100644 --- a/docs/_includes/links/tools.rst +++ b/docs/_includes/links/tools.rst @@ -218,3 +218,15 @@ vhost-gen + +.. |ext_lnk_project_watcherd| raw:: html + + + watcherd + + +.. |ext_lnk_project_watcherp| raw:: html + + + watcherp + diff --git a/docs/features.rst b/docs/features.rst index c1f5bc3b..b3b49cc7 100644 --- a/docs/features.rst +++ b/docs/features.rst @@ -1,3 +1,5 @@ +.. include:: /_includes/all.rst + .. _features: ******** @@ -92,7 +94,7 @@ each Apache..., each Nginx... you get the idea. Project specific configuration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Even down to projects, the Devilbox allows for full customization when it comes to virtual host -settings via `vhost-gen `_. +settings via |ext_lnk_project_vhost_gen|. Intranet @@ -105,10 +107,8 @@ port exposures, hostnames and any errors including how they can be resolved. Third-party tools ^^^^^^^^^^^^^^^^^ -Mandatory web projects are also shipped: -`phpMyAdmin `_, -`Adminer `_ and -`OpcacheGui `_ as well as a web GUI to view all sent emails. +Mandatory web projects are also shipped: |ext_lnk_tool_phpmyadmin|, |ext_lnk_tool_adminer| and +|ext_lnk_tool_opcachegui| as well as a web GUI to view all sent emails. Dockerized diff --git a/docs/linkcheck.sh b/docs/linkcheck.sh new file mode 100755 index 00000000..2f5c00f0 --- /dev/null +++ b/docs/linkcheck.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + + +RETURN=0 + +for url in $(find _includes/ -name \*.rst -exec grep -Eo 'http(s)?://[-?:,._a/#-Z0-9]+' {} \; | sort -u ); do + + header="$( curl -I "${url}" 2>/dev/null )" + line="$( echo "${header}" | grep -E '^HTTP/(1|2)' )" + stat="$( echo "${line}" | awk '{print $2}' )" + + if [ "${stat}" != "200" ]; then + printf "\e[0;31m[ERR]\e[0m %s %s\n" "${url}" "${line}" + RETURN=1 + else + printf "\e[0;32m[OK]\e[0m %s\n" "${url}" + fi +done + +exit ${RETURN} diff --git a/docs/vhost-gen/customize-specific-virtual-host.rst b/docs/vhost-gen/customize-specific-virtual-host.rst index e8976514..b18792e7 100644 --- a/docs/vhost-gen/customize-specific-virtual-host.rst +++ b/docs/vhost-gen/customize-specific-virtual-host.rst @@ -1,3 +1,5 @@ +.. include:: /_includes/all.rst + .. _customize_specific_virtual_host: ******************************* @@ -26,9 +28,9 @@ listening ports. If you intend to use ``vhost-gen`` for your own projects, have a look at its project page and its sister projects: - * `vhost-gen `_ - * `watcherd `_ - * `watcherp `_ + * |ext_lnk_project_vhost_gen| + * |ext_lnk_project_watcherd| + * |ext_lnk_project_watcherp| Where do I find templates diff --git a/docs/vhost-gen/example-add-subdomains.rst b/docs/vhost-gen/example-add-subdomains.rst index a573e687..8a2b352c 100644 --- a/docs/vhost-gen/example-add-subdomains.rst +++ b/docs/vhost-gen/example-add-subdomains.rst @@ -1,3 +1,5 @@ +.. include:: /_includes/all.rst + .. _example_add_sub_domains: ************************ @@ -53,8 +55,8 @@ When you want to have multiple domains and/or sub domains for one project (such case of Wordpress multi-sites), you will need to customize your virtual host config for this project and make the web server allow to serve your files by different server names. -Each web server virtual host is auto-generated by a tool called -`vhost-gen `_. ``vhost-gen`` allows you to overwrite its +Each web server virtual host is auto-generated by a tool called |ext_lnk_project_vhost_gen|. +``vhost-gen`` allows you to overwrite its default generation process via templates. Those templates can be added to each project, giving you the option to customize the virtual host of this specific project.