improvement(asdf_install): don't break when a plugin is already installed.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
James Harton 2023-07-20 08:37:34 +12:00
parent 018acf2769
commit 41568b0149
Signed by: james
GPG key ID: 90E82DAA13F624F4

View file

@ -3,6 +3,19 @@
set -e
source ~/.asdf/asdf.sh
cat .tool-versions | cut -d \ -f 1 | xargs -n 1 asdf plugin add
REQUIRED_PLUGINS=$(cat .tool-versions | cut -d \ -f 1)
INSTALLED_PLUGINS=$(asdf plugin list)
for PLUGIN in $REQUIRED_PLUGINS; do
if [[ $INSTALLED_PLUGINS =~ (^|[^[:alpha:]])$PLUGIN([^[:alpha:]]|$) ]]; then
echo "ASDF plugin $PLUGIN already installed"
else
echo "Installing $PLUGIN ASDF plugin..."
asdf plugin add $PLUGIN
echo " ...done"
fi
done
echo "Running ASDF install..."
asdf install
cat .tool-versions | xargs -n 2 asdf global
echo " ...done"