You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, adopting task requires developers to manually install it on their machines and keep it updated. This is not very convenient, especially when there are multiple developers working on the project and have different versions of task or when the tool needs to be installed on CI. It is also sometimes difficult to sell task instead of make because make is installed by default on most systems.
Solution
There is a tool Batect that deals with the similar issue in a quite elegant way. It uses a small script that you put to your project and this script manages the installation and running of batect executable.
Implementation
task could have a similar shell script which checks if task is installed and, if not, installs it. Developers will run task tasks via this script, e.g. ./task do-something, without manual installation of the task.
Here's an example of how the script could look like:
#!/usr/bin/env bash# I used Batect's script as an example: https://github.com/batect/batect/blob/main/wrapper/unix/src/template.sh
{
set -euo pipefail
VERSION="3.27.1"
VERSION_CACHE_DIR="$HOME/.task/cache/$VERSION"
TASK_EXE="$VERSION_CACHE_DIR/task"functionmain() {
if! haveVersionCachedLocally;then
download
fi
runApplication "$@"
}
functionhaveVersionCachedLocally() {
[ -f"$TASK_EXE" ]
}
functiondownload() {
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ${VERSION_CACHE_DIR} v${VERSION}
}
functionrunApplication() {
exec \
${TASK_EXE} \
"$@"
}
main "$@"exit$?
}
Advantages
Consistent versioning: it ensures everyone on the project uses the same version of task and eliminates the possibility of version related issues.
Improved UX: it simplifies the setup process locally and on CI, which is more convenient for developers.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi 👋
Currently, adopting
task
requires developers to manually install it on their machines and keep it updated. This is not very convenient, especially when there are multiple developers working on the project and have different versions oftask
or when the tool needs to be installed on CI. It is also sometimes difficult to selltask
instead ofmake
becausemake
is installed by default on most systems.Solution
There is a tool
Batect
that deals with the similar issue in a quite elegant way. It uses a small script that you put to your project and this script manages the installation and running ofbatect
executable.Implementation
task
could have a similar shell script which checks iftask
is installed and, if not, installs it. Developers will runtask
tasks via this script, e.g../task do-something
, without manual installation of thetask
.Here's an example of how the script could look like:
Advantages
task
and eliminates the possibility of version related issues.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions