Permalink
Browse files

use gemset in rvmrc (thanks bowsersenior) - closes #231

  • Loading branch information...
1 parent bc9ecb2 commit 045a850565035a87aa0185a0142db52997a2b5e7 @ryanb committed Jan 7, 2011
Showing with 23 additions and 1 deletion.
  1. +23 −1 .rvmrc
View
24 .rvmrc
@@ -1 +1,23 @@
-rvm use 1.8.7
+#!/usr/bin/env bash
+
+# adapted from: http://rvm.beginrescueend.com/workflow/rvmrc/
+
+ruby_string="1.8.7"
+gemset_name="cancan"
+
+if rvm list strings | grep -q "${ruby_string}" ; then
+
+ # Load or create the specified environment
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
+ && -s "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}" ]] ; then
+ \. "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}"
+ else
+ rvm --create "${ruby_string}@${gemset_name}"
+ fi
+
+else
+
+ # Notify the user to install the desired interpreter before proceeding.
+ echo "${ruby_string} was not found, please run 'rvm install ${ruby_string}' and then cd back into the project directory."
+
+fi

0 comments on commit 045a850

Please sign in to comment.