Skip to content

Commit

Permalink
chore: improve tooling for using task
Browse files Browse the repository at this point in the history
For documentation and other player we want to ensure the right version
of task is used, it also simplifies the usage of it since it abstracts
the location of the binary

Signed-off-by: Santiago Jimenez Giraldo <[email protected]>
  • Loading branch information
sago2k8 committed Jan 30, 2024
1 parent 57a927c commit a9070e8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .taskversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v3.34.1
24 changes: 24 additions & 0 deletions taskw
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -eu

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";

test -f "${SCRIPT_DIR}/.taskversion"

VERSION=$(cat "${SCRIPT_DIR}/.taskversion")
TASK_DIR="${SCRIPT_DIR}/build/bin"
TASK="${TASK_DIR}/task"

mkdir -p "$TASK_DIR"

if [[ ! -x $TASK ]] || [[ $($TASK --version | awk '{print $3}') != "${VERSION}" ]]; then
echo "--- updating task to ${VERSION}"
sh -c "$(curl --retry 5 --retry-delay 0 --retry-max-time 60 --location https://raw.githubusercontent.com/go-task/task/${VERSION}/docs/static/install.sh)" -- -d -b "${TASK_DIR}" "${VERSION}"
fi

if ! command -v realpath &>/dev/null; then
echo "--- realpath command not found. Please install 'coreutils' package for your OS to continue. Exiting"
exit 1
fi

$TASK -d "$SCRIPT_DIR" "$@"

0 comments on commit a9070e8

Please sign in to comment.