Skip to content

Instantly share code, notes, and snippets.

@wayneeseguin
Created May 10, 2011 19:21
Show Gist options
  • Select an option

  • Save wayneeseguin/965181 to your computer and use it in GitHub Desktop.

Select an option

Save wayneeseguin/965181 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
case "$(hostname)" in
*-util*|*-p0*)
environment_id="rbx-head@projecta"
;;
*-etl*)
environment_id="jruby-1.6.2@projecta"
;;
*) # Development, QA, etc...
environment_id="ruby-1.9.2-p180@projecta"
;;
esac
#
# First we attempt to load the desired environment directly from the environment
# file, this is very fast and efficicent compared to running through the entire
# CLI and selector. If you want feedback on which environment was used then
# insert the word 'use' after --create as this triggers verbose mode.
#
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
else
# If the environment file has not yet been created, use the RVM CLI to select.
rvm --create "$environment_id"
fi
#
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
# it be automatically loaded, uncomment the following and adjust the filename if
# necessary.
#
if [[ -s ".gems" ]]
then
rvm gemset import .gems | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
fi
if [[ -s Gemfile ]]
then
if ! command -v bundle ; then gem install bundler --no-rdoc --no-ri ; fi
bundle
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment