1
0
chezmoi/home/.chezmoiscripts/run_onchange_after_11-install-asdf-plugins.sh.tmpl

45 lines
933 B
Cheetah
Raw Normal View History

2024-03-01 13:25:34 +00:00
#!/usr/bin/env bash
# Load asdf
. "$HOME/.asdf/asdf.sh"
# Logging function
log() {
printf "$(tput setaf 4)$(tput bold)>>>>> %s <<<<<$(tput sgr0)\n" "$1"
}
inf() {
2024-03-01 18:02:10 +00:00
printf " $(tput sgr 0 1)$(tput setaf 2)%s$(tput sgr0)\n" "$1"
2024-03-01 13:25:34 +00:00
}
# Plugins to install
declare -A plugins
plugins=(
['golang']='https://github.com/asdf-community/asdf-golang.git'
2024-03-01 16:39:47 +00:00
['nodejs']='https://github.com/asdf-vm/asdf-nodejs.git'
['ruby']='https://github.com/asdf-vm/asdf-ruby.git'
2024-03-01 13:25:34 +00:00
)
### Install ASDF plugins ###
log "Begin ASDF plugins installation"
2024-03-01 14:14:47 +00:00
inf "installing direnv with system version..."
# no need to run asdf direnv setup --shell zsh --version latest
# as it is managed by zim module
asdf plugin-add direnv
2024-03-01 13:25:34 +00:00
for plugin in ${!plugins[@]}; do
inf "installing ${plugin}..."
asdf plugin add ${plugin} ${plugins[$plugin]}
2024-03-01 14:44:49 +00:00
asdf install ${plugin} latest
2024-03-01 14:14:47 +00:00
asdf global ${plugin} latest
2024-03-01 13:25:34 +00:00
done
log "Finish ASDF plugins installation"