From 7a9adeab02d521085a79bb3ceaa379b2485efa8b Mon Sep 17 00:00:00 2001 From: Thiago Mendonca Date: Sun, 15 May 2022 15:43:24 +0200 Subject: [PATCH] feat(symlinks, configure): update direnv configuration --- configure/asdf-plugins.sh | 21 ++++++++++++++++++++- configure/direnvrc | 2 -- symlinks/.zshrc | 4 +++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/configure/asdf-plugins.sh b/configure/asdf-plugins.sh index c2ae444..74f4829 100755 --- a/configure/asdf-plugins.sh +++ b/configure/asdf-plugins.sh @@ -16,7 +16,7 @@ plugins=( java:adoptopenjdk-14.0.2+12:true yarn:1.22.15:true ruby:2.7.1:true - direnv:2.28.0:true + direnv:2.31.0:true ) # --------------------------------------------- @@ -39,6 +39,22 @@ preInstall() { esac } +postInstall() { + + case $1 in + direnv) + info "Executing post-install step for $1" + + # Configure direnv + asdf direnv setup --shell zsh --version "$2" + + success "Post-install step for $1 completed" + ;; + *) + ;; + esac +} + install() { info "Installing ASDF Plugins" @@ -75,6 +91,9 @@ install() { success "Version $PLUGIN_VERSION set as global for $PLUGIN_NAME" fi + # Post install step + postInstall "$PLUGIN_NAME" "$PLUGIN_VERSION" + success "ASDF Plugin $PLUGIN_NAME version $PLUGIN_VERSION installed." done } diff --git a/configure/direnvrc b/configure/direnvrc index 1c67d36..82baf29 100755 --- a/configure/direnvrc +++ b/configure/direnvrc @@ -1,8 +1,6 @@ #!/usr/bin/env bash # File: ~/.config/direnv/direnvrc -#shellcheck source=/dev/null -source "$(asdf direnv hook asdf)" # Uncomment the following line to make direnv silent by default. export DIRENV_LOG_FORMAT="" \ No newline at end of file diff --git a/symlinks/.zshrc b/symlinks/.zshrc index c991d24..98f86ec 100644 --- a/symlinks/.zshrc +++ b/symlinks/.zshrc @@ -142,8 +142,10 @@ direnv() { asdf exec direnv "$@"; } eval "$(mcfly init zsh)" +source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc" + # Maybe this shoudl be necessary if it does not auto load in IDEs, for example #asdf exec direnv reload # PERF: Uncoment these line and first one to get a performance report of terminal init -#zprof \ No newline at end of file +#zprof