From 20d5f97f3e14545a120c1ade2c0404943fec8e41 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 30 May 2011 09:46:22 -0500 Subject: [PATCH 1/2] Load RVM and auto-completion is available No reason not to turn on RVM if it's present and the autocompletion is a huge benefit. --- plugins/available/rvm.plugin.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/available/rvm.plugin.bash b/plugins/available/rvm.plugin.bash index d3c81ed4..97f02146 100644 --- a/plugins/available/rvm.plugin.bash +++ b/plugins/available/rvm.plugin.bash @@ -1,4 +1,14 @@ #!/bin/bash + +# Load RVM, if you are using it +[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm + +# Load the auto-completion script if RVM was loaded. +if [ "$rvm_path" ] +then + [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion +fi + switch () { rvm $1 local v=$(rvm_version) From b740d7f0f731e9029720d012c289dd00056120f1 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Mon, 30 May 2011 09:52:30 -0500 Subject: [PATCH 2/2] Make sure that RVM is loaded before defining extras --- plugins/available/rvm.plugin.bash | 37 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/plugins/available/rvm.plugin.bash b/plugins/available/rvm.plugin.bash index 97f02146..e158a800 100644 --- a/plugins/available/rvm.plugin.bash +++ b/plugins/available/rvm.plugin.bash @@ -3,24 +3,27 @@ # Load RVM, if you are using it [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm -# Load the auto-completion script if RVM was loaded. +# Check to make sure that RVM is actually loaded before adding +# the customizations to it. if [ "$rvm_path" ] then + # Load the auto-completion script if RVM was loaded. [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion + + switch () { + rvm $1 + local v=$(rvm_version) + rvm wrapper $1 textmate + echo "Switch to Ruby version: "$v + } + + rvm_default () { + rvm --default $1 + rvm wrapper $1 textmate + } + + function rvm_version () { + ruby --version + } + fi - -switch () { - rvm $1 - local v=$(rvm_version) - rvm wrapper $1 textmate - echo "Switch to Ruby version: "$v -} - -rvm_default () { - rvm --default $1 - rvm wrapper $1 textmate -} - -function rvm_version () { - ruby --version -} \ No newline at end of file