.bash_profile: Add ~/.gem/*/bin to the PATH (if they exist)
authorW. Trevor King <wking@tremily.us>
Thu, 20 Mar 2014 00:17:09 +0000 (17:17 -0700)
committerW. Trevor King <wking@tremily.us>
Thu, 20 Mar 2014 00:21:10 +0000 (17:21 -0700)
This allows you to automatically run Ruby gems without tweaking your
PATH.

src/.bash_profile

index a60b37daae7da89c8c1f329c7c1e475a9697226f..2fa9feeaa3dfa709f2b9e8e7383943fd10438aa0 100644 (file)
@@ -3,6 +3,13 @@
 # include system binaries
 PATH="${PATH}":/usr/sbin:/sbin
 
+# set PATH so it includes ruby gems, if they exist
+for GEM_BIN in ~/.gem/ruby/*/bin; do
+       if [ -d "${GEM_BIN}" ]; then
+               PATH="${GEM_BIN}":"${PATH}"
+       fi
+done
+
 # set PATH so it includes user's local bin if it exists
 if [ -d "${HOME}"/.local/bin ]; then
        PATH="${HOME}"/.local/bin:"${PATH}"