diff --git a/base/tool-versions b/base/tool-versions index aee7c70..fcbe8bb 100644 --- a/base/tool-versions +++ b/base/tool-versions @@ -1,27 +1,21 @@ asdf-plugin-manager 1.4.0 -golang 1.23.3 -ruby 3.3.4 +golang 1.23.4 rust 1.82.0 direnv 2.35.0 fd 10.2.0 1password-cli 2.30.3 -age 1.2.0 +age 1.2.1 bottom 0.10.2 dotenv-linter 3.3.0 editorconfig-checker 2.8.0 -github-cli 2.61.0 +github-cli 2.64.0 hadolint 2.12.0 -kubectl 1.31.2 +kubectl 1.32.0 pre-commit 4.0.1 ripgrep 14.1.1 shellcheck 0.10.0 shfmt 3.10.0 terragrunt 0.68.8 -tf-summarize 0.3.13 +tf-summarize 0.3.14 yamllint 1.35.1 -yq 4.44.3 -bats 1.11.0 -gitleaks 8.18.4 -delta 0.18.1 -eza 0.20.8 -sops 3.9.1 +yq 4.44.6 diff --git a/config/asdf/plugin-versions b/config/asdf/plugin-versions index e8338f2..3d83998 100644 --- a/config/asdf/plugin-versions +++ b/config/asdf/plugin-versions @@ -1,27 +1,20 @@ 1password-cli https://github.com/NeoHsu/asdf-1password-cli.git f5d5aab age https://github.com/threkk/asdf-age.git 396bdf6 asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git b5862c1 -bats https://github.com/timgluz/asdf-bats.git 299551f -bottom https://github.com/carbonteq/asdf-btm.git fd8a55a -delta https://github.com/andweeb/asdf-delta.git 501318b direnv https://github.com/asdf-community/asdf-direnv.git 6ff3dbe dotenv-linter https://github.com/wesleimp/asdf-dotenv-linter.git 1369f53 editorconfig-checker https://github.com/gabitchov/asdf-editorconfig-checker.git 585c1d5 -eza https://github.com/lwiechec/asdf-eza.git 11f578d fd https://gitlab.com/wt0f/asdf-fd.git 17d56e0 github-cli https://github.com/bartlomiejdanek/asdf-github-cli.git e0605b7 -gitleaks https://github.com/jmcvetta/asdf-gitleaks.git 0cc0d7e golang https://github.com/asdf-community/asdf-golang.git e2527a3 -hadolint https://github.com/devlincashman/asdf-hadolint.git 335e230 +hadolint https://github.com/devlincashman/asdf-hadolint.git c8eb88b kubectl https://github.com/asdf-community/asdf-kubectl.git 2fb3b57 pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git 26bfc42 ripgrep https://gitlab.com/wt0f/asdf-ripgrep.git e836665 -ruby https://github.com/asdf-vm/asdf-ruby.git 194fe45 rust https://github.com/code-lever/asdf-rust.git 95acf4f shellcheck https://github.com/luizm/asdf-shellcheck.git 66200ff shfmt https://github.com/luizm/asdf-shfmt.git a42c5ff -sops https://github.com/feniix/asdf-sops.git 5c7a2fb -terragrunt https://github.com/ohmer/asdf-terragrunt.git 4a6651a +terragrunt https://github.com/ohmer/asdf-terragrunt.git 29f2935 tf-summarize https://github.com/adamcrews/asdf-tf-summarize.git 880ad26 -yamllint https://github.com/ericcornelissen/asdf-yamllint.git bc2813e +yamllint https://github.com/ericcornelissen/asdf-yamllint.git e4cfb17 yq https://github.com/sudermanjr/asdf-yq.git 772992f diff --git a/config/git/config b/config/git/config index 8d6854a..c1bf05c 100644 --- a/config/git/config +++ b/config/git/config @@ -11,3 +11,5 @@ [include] path = ~/.config/git/overrides/config +[advice] + detachedHead = false diff --git a/local/bin/dfm b/local/bin/dfm index 3b412ba..918438d 100755 --- a/local/bin/dfm +++ b/local/bin/dfm @@ -169,7 +169,7 @@ section_install() ;; asdf) msg "Installing asdf..." - bash "$DOTFILES/scripts/install-asdf.sh both" \ + $0 asdf plugins-add \ && msg_yay "asdf installed!" ;; cargo) @@ -371,21 +371,111 @@ section_asdf() { USAGE_PREFIX="$SCRIPT asdf " MENU=( - "install:Install asdf" "current:Show asdf current versions" "global:Show asdf global versions" "installed:Show asdf installed versions" "local:Show asdf local versions" + "plugins-add:Add and update direnv and asdf-plugin-manager, and all other plugins" + "plugins-update:Update all asdf plugins" + "reset:Reset asdf plugins" "versions:Show asdf versions" "where:Show asdf where" "which:Show asdf which" ) case "$1" in - install) - msg "Installing asdf..." - bash "$DOTFILES/scripts/install-asdf.sh both" \ - && msg_yay "asdf installed!" + plugins-update) + APM_BIN="$(asdf where asdf-plugin-manager)/bin/asdf-plugin-manager" + + msgr run "Updating all asdf plugins" + $APM_BIN update-all + $APM_BIN export > "$ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME" + msgr run_done "Updated all plugins" + ;; + plugins-add) + X_GH_BIN="$DOTFILES/local/bin/x-gh-get-latest-version" + LATEST_APM="$($X_GH_BIN asdf-community/asdf-plugin-manager | sed 's/^v//')" + LATEST_DIRENV="$($X_GH_BIN asdf-community/asdf-direnv)" + PLUGIN_VERSIONS="$DOTFILES/config/asdf/plugin-versions" + APM_BIN="$HOME/.local/bin/asdf/shims/asdf-plugin-manager" + + msgr run "Adding and updating direnv and asdf-plugin-manager" + asdf plugin add direnv https://github.com/asdf-community/asdf-direnv.git + asdf global direnv "$LATEST_DIRENV" + asdf install direnv "$LATEST_DIRENV" + + asdf plugin add asdf-plugin-manager https://github.com/asdf-community/asdf-plugin-manager.git + asdf global asdf-plugin-manager "$LATEST_APM" + asdf install asdf-plugin-manager "$LATEST_APM" + asdf reshim + msgr run_done "direnv and asdf-plugin-manager added and updated" + + msgr run "Reset plugin-versions file to the original using git" + if git ls-files --error-unmatch "$PLUGIN_VERSIONS" > /dev/null 2>&1; then + git checkout -- "$PLUGIN_VERSIONS" + fi + msgr run_done "Reset plugin-versions file" + + msgr run "Adding all plugins with asdf-plugin-manager" + "$APM_BIN" add-all + msgr run_done "Added all plugins with asdf-plugin-manager" + + msgr run "Install all plugins" + PLUGINS=$($APM_BIN list | awk -F ' ' '{print $1}' | sort) + for P in $PLUGINS; do + msgr run "Installing $P" + asdf install "$P" latest + asdf global "$P" latest + done + + + msgr run_done "Installed all plugins" + + msgr run "Reshimming" + asdf reshim + msgr run_done "Reshimmed" + ;; + plugins-remove) + PLUGIN_VERSIONS="$DOTFILES/config/asdf/plugin-versions" + + msgr run "Remove installed plugins" + INSTALLED_ASDF_PLUGINS=$(asdf list | grep -vE "direnv|asdf-plugin-manager" | grep -v "^ ") + for P in $INSTALLED_ASDF_PLUGINS; do + asdf plugin remove "$P" + msgr nested_done "Removed $P" + done + + msgr run "Reset plugin-versions file to the original using git" + if git ls-files --error-unmatch "$PLUGIN_VERSIONS" > /dev/null 2>&1; then + git checkout -- "$PLUGIN_VERSIONS" + fi + msgr run_done "Reset plugin-versions file" + + msgr run_done "Remove plugins done!" + ;; + reset) + APM_BIN="$(asdf where asdf-plugin-manager)/bin/asdf-plugin-manager" + + msgr run "Get currently installed plugins, remove those that are not defined" + $0 asdf plugins-remove + $0 asdf plugins-add + $0 asdf fixtoolversions + asdf reshim + msgr yay "Reset asdf plugins done!" + ;; + fixtoolversions) + ASDF_TOOL_VERSIONS_FILE="$DOTFILES/base/tool-versions" + ASDF_TOOL_FILE_PLUGINS=$(awk '{print $1 " " $2}' "$ASDF_TOOL_VERSIONS_FILE") + APM_BIN="$(asdf where asdf-plugin-manager)/bin/asdf-plugin-manager" + + msgr run "Loading $ASDF_TOOL_VERSIONS_FILE and collecting installed" + ASDF_PLUGINS_DEFINED=$($APM_BIN list | awk -F ' ' '{print $1}') + + echo "$ASDF_TOOL_FILE_PLUGINS" | \ + grep -Fxv -f <(echo "$ASDF_PLUGINS_DEFINED") > tmp && \ + mv tmp "$ASDF_TOOL_VERSIONS_FILE" + + msgr run_done "Fixed $ASDF_TOOL_VERSIONS_FILE" ;; current) asdf current