You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/09/23 03:23:42 UTC

svn commit: r1388938 - /buildr/trunk/.rvmrc

Author: donaldp
Date: Sun Sep 23 01:23:42 2012
New Revision: 1388938

URL: http://svn.apache.org/viewvc?rev=1388938&view=rev
Log:
Improve the .rvmrc by;
 * allowing it to auto-install the appropriate ruby it it fails to find one
 * Guessing the gemset name based on the JOB_NAME environment variables (useful in buildr) but defaulting to the dir name
 * Cleaning up the gems to remove older versions

Modified:
    buildr/trunk/.rvmrc

Modified: buildr/trunk/.rvmrc
URL: http://svn.apache.org/viewvc/buildr/trunk/.rvmrc?rev=1388938&r1=1388937&r2=1388938&view=diff
==============================================================================
--- buildr/trunk/.rvmrc (original)
+++ buildr/trunk/.rvmrc Sun Sep 23 01:23:42 2012
@@ -12,22 +12,26 @@ cat <<EOF
 EOF
 
 ruby_string="${BUILDR_RUBY_VERSION:-ruby-1.9.2-p320}"
-bundler_gem_home="vendor/bundle" 
+project_dir=`pwd`
+export project_name=${JOB_NAME-`basename "$project_dir"`}
 
-if rvm list strings | grep -q "${ruby_string}" ; then 
-  rvm use --create "${ruby_string}@buildr" 
+detected_version=`rvm list strings | grep ${ruby_string}`
+if [ "X" == "X${detected_version}" ] ; then
+  echo "${ruby_string} was not found, running 'rvm install ${ruby_string}'..."
+  rvm install ${ruby_string}
+fi
 
-  gem list | grep 'bundler' &> /dev/null 
-  if [ $? -gt 0 ]; then 
-    echo "Installing bundler..." 
-    gem install bundler 
-  fi
+rvm use --create "${ruby_string}@${project_name}"
 
-  rm Gemfile.lock
-  bundle install
+export JRUBY_OPTS="-J-XX:MaxPermSize=128m -J-Xmx1024M"
+export JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=256m"
 
-  export JRUBY_OPTS="-J-XX:MaxPermSize=128m -J-Xmx1024M"
-  export JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=256m"
-else 
-  echo "${ruby_string} was not found, please run 'rvm install ${ruby_string}' and then cd back into the project directory." 
+if [ -f Gemfile ]; then
+  gem list | grep 'bundler' &> /dev/null
+  if [ $? -gt 0 ]; then
+    echo "Installing bundler..."
+    gem install bundler
+  fi
+  bundle install --binstubs
+  gem cleanup -q
 fi