Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 49 additions & 27 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,46 +95,68 @@ echo "🧹 Cleaning documentation folder"
rm -rf ${DOCS_FOLDER}/*
'''

[tasks.check-prerequisites]
description = "Check prerequisites"
[tasks.check-npx]
description = "Check npx is installed"
script = '''
echo "🔍 Checking prerequisites"
if ! command -v npx >/dev/null 2>&1; then
echo "❌ npx could not be found"
echo " Consider installing npx with: npm install -g npx"
exit 1
fi
'''

echo "❔ Checking \`npx\` installed..."
if ! which npx >/dev/null;
then
echo "\n❌ npx could not be found"
echo " Consider installing npx.\n"
echo "> \`npm install -g npx\`\n\n"
[tasks.check-awk]
description = "Check awk is installed"
script = '''
if ! command -v awk >/dev/null 2>&1; then
echo "❌ awk could not be found"
echo " Consider installing awk (usually pre-installed on Unix systems)"
exit 1
fi
echo "✅ \`npx\` installed"
'''

echo "❔ Checking \`awk\` installed..."
if ! which awk >/dev/null;
then
echo "\n❌ awk could not be found"
echo " Consider installing awk."
[tasks.check-perl]
description = "Check perl is installed"
script = '''
if ! command -v perl >/dev/null 2>&1; then
echo "❌ perl could not be found"
echo " Consider installing perl (usually pre-installed on Unix systems)"
exit 1
fi
echo "✅ \`perl\` installed"
'''

echo "❔ Checking \`perl\` installed..."
if ! which perl >/dev/null;
then
echo "\n❌ perl could not be found"
echo " Consider installing perl."
[tasks.check-jq]
description = "Check jq is installed (version 1.7 or higher, but below 2.0)"
script = '''
if ! command -v jq >/dev/null 2>&1; then
echo "❌ jq could not be found"
echo " Consider installing jq: brew install jq (macOS) or apt-get install jq (Linux)"
exit 1
fi
echo "✅ \`perl\` installed"

echo "❔ Checking \`jq\` installation..."
if [[ $(jq --version) != jq-1\.7* ]]
then
echo "\n❌ Require jq version 1.7"
jq_version=$(jq --version 2>/dev/null | sed -E 's/^jq-([0-9]+)\.([0-9]+).*/\1.\2/')
if ! printf '%s' "$jq_version" | grep -Eq '^[0-9]+\.[0-9]+$'; then
echo "❌ Could not determine jq version (got: '$jq_version')"
exit 1
fi
jq_major=${jq_version%%.*}
jq_minor=${jq_version#*.}

if [ "$jq_major" -lt 1 ] || ([ "$jq_major" -eq 1 ] && [ "$jq_minor" -lt 7 ]); then
echo "❌ jq version $jq_version is too old (require >= 1.7)"
exit 1
fi
echo "✅ \`jq\` installed"

if [ "$jq_major" -ge 2 ]; then
echo "⚠️ Warning: jq version $jq_version is untested (expected >= 1.7 and < 2.0)"
fi
'''

[tasks.check-prerequisites]
dependencies = ["check-npx", "check-awk", "check-perl", "check-jq"]
description = "Check all the prerequisites are installed"
script = '''
echo "✅ All prerequisites are satisfied"
'''

[tasks.docs-generate]
Expand Down