From 2bb726171720cdecc7ddd7cd1416f82b7f33d8c4 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Sun, 19 Apr 2026 09:55:58 +0200 Subject: feat: add local Ruby gems' bin folder to $PATH --- .bash/vars.bash | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to '.bash') diff --git a/.bash/vars.bash b/.bash/vars.bash index 3bc68cd..29a3dfd 100644 --- a/.bash/vars.bash +++ b/.bash/vars.bash @@ -80,6 +80,20 @@ if command -v less >/dev/null;then export LESSANSIENDCHARS="m" export LESSANSIMIDCHARS="0123456789:;[?!\"'#%()*+ " fi + +# ----- RUBY ----- # +# Include local gems' binary path from those gems matching /usr/bin/ruby: +if [ -x '/usr/bin/ruby' ]; then + rubymajmin="$(/usr/bin/ruby -e 'print(RUBY_VERSION.gsub(%r{\.[0-9]+$}, '\'\''))')" + rubypath="${HOME}/.gem/ruby/${rubymajmin}.0/bin" + unset rubymajmin + if [ -d "$rubypath" ]; then + if ! printf '%b' "$PATH" | grep -P "(^|:)${rubypath}(:|$)" > /dev/null; then + PATH="${PATH}:$rubypath" + fi + fi +fi + # ----- MISC ----- # # nopaste export NOPASTE_SERVICES='pastebin nopaste' -- cgit v1.2.3