From 894706ab094489e3e8989be16188a9f17c056f59 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sat, 31 Dec 2022 05:26:19 +0100 Subject: [PATCH] Docs: Show available tools per version in README.md --- .tests/Makefile | 14 +++++++++++++- .tests/scripts/get-tools.sh | 25 +++++++++++++++++++++++++ README.md | 1 - 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100755 .tests/scripts/get-tools.sh diff --git a/.tests/Makefile b/.tests/Makefile index 16d8e66e..98425be4 100644 --- a/.tests/Makefile +++ b/.tests/Makefile @@ -6,12 +6,24 @@ endif # ------------------------------------------------------------------------------------------------- # Misc Targets # ------------------------------------------------------------------------------------------------- -update-readme: +.PHONY: update-readme +update-readme: _update-readme-modules +update-readme: _update-readme-tools + +.PHONY: _update-readme-modules +_update-readme-modules: cat "../README.md" \ | perl -0 -pe "s#.*#\n$$(./scripts/get-modules.sh)\n#s" \ > "../README.md.tmp" yes | mv -f "../README.md.tmp" "../README.md" +.PHONY: _update-readme-tools +_update-readme-tools: + cat "../README.md" \ + | perl -0 -pe "s#.*#\n$$(./scripts/get-tools.sh)\n#s" \ + > "../README.md.tmp" + yes | mv -f "../README.md.tmp" "../README.md" + # ------------------------------------------------------------------------------------------------- # Linting Targets diff --git a/.tests/scripts/get-tools.sh b/.tests/scripts/get-tools.sh new file mode 100755 index 00000000..3c53bf41 --- /dev/null +++ b/.tests/scripts/get-tools.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# NOTE: Parsing curl to tac to circumnvent "failed writing body" +# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body + +set -e +set -u +set -o pipefail + +SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )" +DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )" +# shellcheck disable=SC1090 +. "${SCRIPT_PATH}/.lib.sh" + +RETRIES=10 + + +# ------------------------------------------------------------------------------------------------- +# FUNCTIONS +# ------------------------------------------------------------------------------------------------- + +PHP_TAG="$( grep 'devilbox/php' "${DVLBOX_PATH}/docker-compose.yml" | sed 's/^.*-work-//g' )" +PHP_TOOLS="$( run "curl -sS 'https://raw.githubusercontent.com/devilbox/docker-php-fpm/${PHP_TAG}/doc/available-tools.md'" "${RETRIES}" )"; + +echo "${PHP_TOOLS}" | grep -A 1000000 'TOOLS_WORK_START' diff --git a/README.md b/README.md index 7d354f25..e482f2bb 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,6 @@ The Devilbox runs on all major operating systems and its only requirement is -
Be up and running in 2 minutes.
🚀 Install and Run: Linux