Skip to content
trans edited this page Jan 7, 2013 · 7 revisions
<< Back to Installation

System Setup

In order to utilize Library, Ruby has to be made aware of it. To do this add some setup code to your shell's runtime configuration script, e.g. the .bashrc file. We recommended doing this via a secondary file. So to the .bashrc or equivalent file add to the end something like:

    if [ -f ~/.bash/ruby.sh ]; then
      . ~/.bash/ruby.sh
    fi

Then create the ~/.bash/ruby.sh script containing the following lines:

    export RUBYOPT="-rubylibs"
    export RUBYPATH="$(ruby -e 'puts Library::sync')"
    export PATH="$PATH:$RUBYPATH"

The first line ensures that Library is loaded every time Ruby is executed. If you have other entries in the RUBYOPT variable already it is usually best that the -rubylibs occur before the others.

The second line ensures that that current cached ledger is in sync with the current contents of library locations. It also returns a list of bin/ directories for all those libraries. By appending this to the system's PATH variable, the executables of the libraries handled by Library are made available on the command line.

Note that this PATH approach to executables requires that the bin files have their executable bits turned on and have the proper header (i.e. #!usr/bin/env ruby). Also keep in mind that while this approach works for most operating systems (i.e. Unix-based systems), other systems may need to use binstubs instead. At this time binstubs is not an implemented feature because current users have not yet needed it. Eventually this will be addressed for future release and volunteers are welcome to step-up and implement it at any time.

Clone this wiki locally