From b452239b3a8a26b989f4abfc21a8bc4f69938c5e Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Tue, 24 Jan 2023 16:55:50 +0000 Subject: [PATCH] Update file run_onchange_after_15-install-asdf-packages.tmpl --- ...un_onchange_after_15-install-asdf-packages.tmpl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl index b2b0e1c2..b2cebf56 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl @@ -13,10 +13,16 @@ if [ -f "$ASDF_DIR/asdf.sh" ] && [ -f ~/.tool-versions ]; then logg info 'Installing ASDF plugin `'"$(echo "$TOOL" | sed 's/ .*//')"'`' asdf plugin add "$(echo "$TOOL" | sed 's/ .*//')" done - logg info 'Installing ASDF dependencies derived from `~/.tool-versions` via `asdf install`' - asdf install || EXIT_CODE=$? - if [ -n "$EXIT_CODE" ]; then - logg error 'Error installing the ASDF plugins specified in `~/.tool-versions`' + # Only proceed with installation if either DEBUG_MODE is enabled or ~/.cache/megabyte-labs/asdf-install is missing + # Added to save time between tests + if [ "$DEBUG_MODE" == 'true' ] || [ ! -f "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/asdf-install" ]; then + logg info 'Installing ASDF dependencies derived from `~/.tool-versions` via `asdf install`' + asdf install || EXIT_CODE=$? + if [ -n "$EXIT_CODE" ]; then + logg error 'Error installing the ASDF plugins specified in `~/.tool-versions`' + fi + mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs" + touch "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/asdf-install" fi else logg warn 'The `$ASDF_DIR/asdf.sh` or `~/.tool-versions` file is not present'