Is there a way to automatically append to $: variable in ruby to account for additional site_ruby locations?
Ruby is installed in /usr/local/ and using gem_install will properly install the new ruby files in to /usr/local/lib/ruby/site_ruby.
However there are some RPMs for ruby bindings to tools like shadow which we'd like to install and they install to /usr/lib/ruby/site_ruby (no local). Is there a standard way to tell ruby that this directory should also be included by default?
I know scripts could dynamically update $: or they could be called with -I but it seems like this is something that should be handled in the install.
Has anyone else found a clean way around this kind of problem?
thanks, chuck
Set RUBYLIB in /etc/profile to include the paths you want.
Some dodgy example code:
You could alias this script into your path and just call
Not very automatic on it's own though...
Perhaps you could create a file called /etc/rubypaths, and have the script run from cron, with a little modification? So instead of relying on ARGV, you do the following:
But maybe what you want is for the OS to somehow "know" there is another site_ruby folder on the filesystem, and you want it to be added to $RUBYLIB. Not sure if that's do-able without you actual telling the OS your intention through something like a file in /etc.