mpapis, rys, ddd on IRC in
#rvm on irc.freenode.net
RVM supports several hooks.
Each hook is a file in ~/.rvm/hooks/[hook name] in which you can place any sequence of bash scripting commands. Each hook file when run will have available to it the entire RVM environment. Some useful RVM environmental variables are:
For `after_use`, `after_cd` and `after_install` hooks, multiple hook files are processed. RVM provides the main hook file for each of these, which loads other files within the hooks directory that are prefixed with `[hook name]_`. Each prefixed hook file which has it's executable flag set will be loaded in alphabetical order.
Other hooks may follow this convention in the future, if necessary. When RVM is updated, any existing hook file that needs to be replaced with one of these wrappers will be renamed to `[hook name]_custom`.
As an example say we want to print out the ruby string every time we switch rubies.
$ cat > ~/.rvm/hooks/after_use_show_ruby <<EOF > echo "Now using \$rvm_ruby_string" > EOF $ chmod +x ~/.rvm/hooks/after_use_show_ruby
Will produce the following.
$ rvm 1.9.1 Now using ruby-1.9.1-p243 $ rvm 1.8.7 Now using ruby-1.8.7-p174