git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormail_redacted_for_web 2026-04-19 09:55:58 +0200
committermail_redacted_for_web 2026-04-19 09:55:58 +0200
commit2bb726171720cdecc7ddd7cd1416f82b7f33d8c4 (patch)
tree00ca8c025623e61b34fe0c3f96fe89a5fa48e6a7
parenta4e23cdaff9bfd127e96f6b0f39bc6577cc7c7d4 (diff)
downloaddotfiles-2bb726171720cdecc7ddd7cd1416f82b7f33d8c4.tar.bz2
feat: add local Ruby gems' bin folder to $PATH
-rw-r--r--.bash/vars.bash14
1 files changed, 14 insertions, 0 deletions
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'