feat(asdf): rework installer, add python, markdownlint-cli2

This commit is contained in:
2024-08-29 13:16:20 +03:00
parent dff4b9a9c5
commit 34d547433f
5 changed files with 108 additions and 74 deletions

View File

@@ -12,8 +12,6 @@ msg "Sourcing asdf in your shell"
# Function to update asdf and plugins
update_asdf()
{
asdf update
asdf plugin add asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git
asdf install asdf-plugin-manager latest
asdf global asdf-plugin-manager "$(asdf latest asdf-plugin-manager)"
@@ -21,58 +19,89 @@ update_asdf()
asdf-plugin-manager add-all
asdf install
}
ASDF_INSTALLABLES=(
"1password-cli:github.com/NeoHsu/asdf-1password-cli.git"
"age:github.com/threkk/asdf-age.git"
"bottom:github.com/carbonteq/asdf-btm.git"
"direnv:github.com/asdf-community/asdf-direnv.git"
"dotenv-linter:github.com/wesleimp/asdf-dotenv-linter.git"
"editorconfig-checker:github.com/gabitchov/asdf-editorconfig-checker.git"
"eza:github.com/lwiechec/asdf-eza.git"
"fd:gitlab.com/wt0f/asdf-fd.git"
"github-cli:github.com/bartlomiejdanek/asdf-github-cli.git"
"golang:github.com/asdf-community/asdf-golang.git"
"hadolint:github.com/devlincashman/asdf-hadolint.git"
"kubectl:github.com/asdf-community/asdf-kubectl.git"
"lazygit:github.com/nklmilojevic/asdf-lazygit.git"
"nodejs:github.com/asdf-vm/asdf-nodejs.git"
"pipx:github.com/yozachar/asdf-pipx.git"
"pre-commit:github.com/jonathanmorley/asdf-pre-commit.git"
"ripgrep:gitlab.com/wt0f/asdf-ripgrep.git"
"rust:github.com/code-lever/asdf-rust.git"
"semgrep:github.com/brentjanderson/asdf-semgrep.git"
"shellcheck:github.com/luizm/asdf-shellcheck.git"
"shfmt:github.com/luizm/asdf-shfmt.git"
"terraform-ls:github.com/asdf-community/asdf-hashicorp.git"
"terraform-lsp:github.com/bartlomiejdanek/asdf-terraform-lsp.git"
"terragrunt:github.com/ohmer/asdf-terragrunt.git"
"tf-summarize:github.com/adamcrews/asdf-tf-summarize.git"
"vault:github.com/asdf-community/asdf-hashicorp.git"
"yamllint:github.com/ericcornelissen/asdf-yamllint.git"
"yq:github.com/sudermanjr/asdf-yq.git"
)
return 0
}
# Function to install asdf plugins
install_asdf_plugins()
{
msg "Installing asdf plugins, if not already installed"
ASDF_INSTALLABLES=(
"1password-cli:github.com/NeoHsu/asdf-1password-cli.git"
"age:github.com/threkk/asdf-age.git"
"bottom:github.com/carbonteq/asdf-btm.git"
"direnv:github.com/asdf-community/asdf-direnv.git"
"dotenv-linter:github.com/wesleimp/asdf-dotenv-linter.git"
"editorconfig-checker:github.com/gabitchov/asdf-editorconfig-checker.git"
"eza:github.com/lwiechec/asdf-eza.git"
"fd:gitlab.com/wt0f/asdf-fd.git"
"github-cli:github.com/bartlomiejdanek/asdf-github-cli.git"
"golang:github.com/asdf-community/asdf-golang.git"
"hadolint:github.com/devlincashman/asdf-hadolint.git"
"kubectl:github.com/asdf-community/asdf-kubectl.git"
"lazygit:github.com/nklmilojevic/asdf-lazygit.git"
"markdownlint-cli2:github.com/paulo-ferraz-oliveira/asdf-markdownlint-cli2.git"
"nodejs:github.com/asdf-vm/asdf-nodejs.git"
"pipx:github.com/yozachar/asdf-pipx.git"
"pre-commit:github.com/jonathanmorley/asdf-pre-commit.git"
"python:github.com/asdf-community/asdf-python.git"
"ripgrep:gitlab.com/wt0f/asdf-ripgrep.git"
"rust:github.com/code-lever/asdf-rust.git"
"semgrep:github.com/brentjanderson/asdf-semgrep.git"
"shellcheck:github.com/luizm/asdf-shellcheck.git"
"shfmt:github.com/luizm/asdf-shfmt.git"
"terragrunt:github.com/ohmer/asdf-terragrunt.git"
"tf-summarize:github.com/adamcrews/asdf-tf-summarize.git"
"vault:github.com/asdf-community/asdf-hashicorp.git"
"yamllint:github.com/ericcornelissen/asdf-yamllint.git"
"yq:github.com/sudermanjr/asdf-yq.git"
)
msg "Installing asdf plugins"
for item in "${ASDF_INSTALLABLES[@]}"; do
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
URL=$(echo "${item}" | awk -F ":" '{print $2}')
asdf plugin add "${CMD}" "https://${URL}"
asdf install "${CMD}" latest
asdf global "${CMD}" "$(asdf latest "${CMD}")"
done
msg "Exporting asdf plugin versions"
asdf-plugin-manager export > "${XDG_CONFIG_HOME}/asdf/plugin-versions"
return 0
}
reshim()
{
msg "Reshim asdf"
asdf reshim
return 0
}
# create usage function
usage()
{
echo "Usage: $0 [install|add_plugins]"
exit 1
}
main()
{
update_asdf
install_asdf_plugins
msg "Reshim asdf"
asdf reshim
case $1 in
"install")
update_asdf
reshim
;;
"add_plugins")
install_asdf_plugins
reshim
;;
*)
usage
;;
esac
}
main "$@"