mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-04 17:00:51 +00:00
chore(scripts): tweak install-asdf, add update
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# It also updates asdf and the plugins, and then reshim asdf.
|
# It also updates asdf and the plugins, and then reshim asdf.
|
||||||
#
|
#
|
||||||
# Usage: ./install-asdf.sh [both|install|add_plugins]
|
# Usage: ./install-asdf.sh [both|install|update|add_plugins]
|
||||||
# Author: Ismo Vuorinen <https://github.com/ivuorinen>
|
# Author: Ismo Vuorinen <https://github.com/ivuorinen>
|
||||||
# License: MIT
|
# License: MIT
|
||||||
#
|
#
|
||||||
@@ -13,9 +13,40 @@ source "${DOTFILES}/config/shared.sh"
|
|||||||
export ASDF_DIR="${XDG_BIN_HOME}/asdf"
|
export ASDF_DIR="${XDG_BIN_HOME}/asdf"
|
||||||
export PATH="${ASDF_DIR}/bin:$PATH"
|
export PATH="${ASDF_DIR}/bin:$PATH"
|
||||||
|
|
||||||
|
# If ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME is not set, set it
|
||||||
|
if [ -z "${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME}" ]; then
|
||||||
|
export ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME="${XDG_CONFIG_HOME}/asdf/plugin-versions"
|
||||||
|
fi
|
||||||
|
|
||||||
msg "Sourcing asdf in your shell"
|
msg "Sourcing asdf in your shell"
|
||||||
. "$ASDF_DIR/asdf.sh"
|
. "$ASDF_DIR/asdf.sh"
|
||||||
|
|
||||||
|
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"
|
||||||
|
"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"
|
||||||
|
"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"
|
||||||
|
"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"
|
||||||
|
"yamllint:github.com/ericcornelissen/asdf-yamllint.git"
|
||||||
|
"yq:github.com/sudermanjr/asdf-yq.git"
|
||||||
|
)
|
||||||
|
|
||||||
# Function to update asdf and plugins
|
# Function to update asdf and plugins
|
||||||
update_asdf()
|
update_asdf()
|
||||||
{
|
{
|
||||||
@@ -24,41 +55,24 @@ update_asdf()
|
|||||||
asdf global asdf-plugin-manager "$(asdf latest asdf-plugin-manager)"
|
asdf global asdf-plugin-manager "$(asdf latest asdf-plugin-manager)"
|
||||||
asdf-plugin-manager version
|
asdf-plugin-manager version
|
||||||
asdf-plugin-manager add-all
|
asdf-plugin-manager add-all
|
||||||
|
asdf-plugin-manager update-all
|
||||||
|
asdf-plugin-manager export > "${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME}"
|
||||||
|
|
||||||
asdf install
|
asdf install
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_asdf_commands()
|
||||||
|
{
|
||||||
|
msg "Updating asdf commands using asdf-plugin-manager"
|
||||||
|
asdf-plugin-manager update-all
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Function to install asdf plugins
|
# Function to install asdf plugins
|
||||||
install_asdf_plugins()
|
install_asdf_plugins()
|
||||||
{
|
{
|
||||||
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"
|
|
||||||
"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"
|
|
||||||
"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"
|
|
||||||
"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"
|
|
||||||
"yamllint:github.com/ericcornelissen/asdf-yamllint.git"
|
|
||||||
"yq:github.com/sudermanjr/asdf-yq.git"
|
|
||||||
)
|
|
||||||
|
|
||||||
msg "Installing asdf plugins"
|
msg "Installing asdf plugins"
|
||||||
for item in "${ASDF_INSTALLABLES[@]}"; do
|
for item in "${ASDF_INSTALLABLES[@]}"; do
|
||||||
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
||||||
@@ -70,7 +84,7 @@ install_asdf_plugins()
|
|||||||
done
|
done
|
||||||
|
|
||||||
msg "Exporting asdf plugin versions"
|
msg "Exporting asdf plugin versions"
|
||||||
asdf-plugin-manager export > "${XDG_CONFIG_HOME}/asdf/plugin-versions"
|
asdf-plugin-manager export > "${ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME}"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -85,7 +99,7 @@ reshim()
|
|||||||
# create usage function
|
# create usage function
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $0 [both|install|add_plugins]"
|
echo "Usage: $0 [both|install|add_plugins|update]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,6 +111,10 @@ main()
|
|||||||
update_asdf
|
update_asdf
|
||||||
reshim
|
reshim
|
||||||
;;
|
;;
|
||||||
|
"update")
|
||||||
|
update_asdf_commands
|
||||||
|
reshim
|
||||||
|
;;
|
||||||
"install")
|
"install")
|
||||||
update_asdf
|
update_asdf
|
||||||
reshim
|
reshim
|
||||||
|
|||||||
Reference in New Issue
Block a user