mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 02:24:11 -06:00
refactor: simplify homebrew shellenv init without brittle caching
This commit is contained in:
@@ -45,20 +45,9 @@ else if test -f $HOME/.cargo/env
|
|||||||
set -a paths_to_add $CARGO_HOME/bin
|
set -a paths_to_add $CARGO_HOME/bin
|
||||||
end
|
end
|
||||||
|
|
||||||
# Homebrew (cached for performance - reduces startup time by ~14ms)
|
# Homebrew
|
||||||
if test -f /home/linuxbrew/.linuxbrew/bin/brew
|
if test -f /home/linuxbrew/.linuxbrew/bin/brew
|
||||||
set -l brew_cache "$HOME/.cache/brew_env.fish"
|
/home/linuxbrew/.linuxbrew/bin/brew shellenv fish | source
|
||||||
set -l brew_bin "/home/linuxbrew/.linuxbrew/bin/brew"
|
|
||||||
|
|
||||||
# Regenerate cache if: doesn't exist, >7 days old, or brew binary is newer
|
|
||||||
if not test -f "$brew_cache"; \
|
|
||||||
or test (math (date +%s) - (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)) -gt 604800; \
|
|
||||||
or test (stat -c %Y "$brew_bin" 2>/dev/null || echo 0) -gt (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)
|
|
||||||
mkdir -p (dirname "$brew_cache")
|
|
||||||
$brew_bin shellenv > "$brew_cache" 2>/dev/null
|
|
||||||
end
|
|
||||||
|
|
||||||
test -f "$brew_cache" && source "$brew_cache"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
set -gx PYENV_ROOT $HOME/.pyenv
|
set -gx PYENV_ROOT $HOME/.pyenv
|
||||||
|
|||||||
@@ -39,20 +39,9 @@ export HISHTORY_SERVER="https://hsh.{{ dopplerProjectJson.PRIVATE_DOMAIN }}"
|
|||||||
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
|
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
|
||||||
|
|
||||||
## Package Managers
|
## Package Managers
|
||||||
# Homebrew (cached for performance - reduces startup time by ~14ms)
|
# Homebrew
|
||||||
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
|
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
|
||||||
BREW_CACHE="$HOME/.cache/brew_env.sh"
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||||
BREW_BIN="/home/linuxbrew/.linuxbrew/bin/brew"
|
|
||||||
|
|
||||||
# Regenerate cache if: doesn't exist, >7 days old, or brew binary is newer
|
|
||||||
if [ ! -f "$BREW_CACHE" ] || \
|
|
||||||
[ $(( $(date +%s) - $(stat -c %Y "$BREW_CACHE" 2>/dev/null || echo 0) )) -gt 604800 ] || \
|
|
||||||
[ "$BREW_BIN" -nt "$BREW_CACHE" ]; then
|
|
||||||
mkdir -p "$(dirname "$BREW_CACHE")"
|
|
||||||
"$BREW_BIN" shellenv > "$BREW_CACHE" 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -f "$BREW_CACHE" ] && . "$BREW_CACHE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## JavaScript Ecosystem
|
## JavaScript Ecosystem
|
||||||
|
|||||||
Reference in New Issue
Block a user