.rvmrc
author Mahlon E. Smith <mahlon@martini.nu>
Mon, 12 May 2014 16:34:12 -0700
changeset 3 62196065e9ea
parent 0 aef8f9f4a788
permissions -rw-r--r--
Use full class paths with configurability, so additional subclassing (via pluggability, or manual) works as expected.

#!/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

environment_id="2.0.0@symphony-ssh"

if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
	&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]; then
	echo "Using ${environment_id}"
	. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"

	if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]; then
		. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
	fi
else
	# If the environment file has not yet been created, use the RVM CLI to select.
	if ! rvm --create use  "$environment_id"
		then
		echo "Failed to create RVM environment '${environment_id}'."
		exit 1
	fi
fi

filename=".rvm.gems"
if [[ -s "$filename" ]]; then
	rvm gemset import "$filename"
fi