.rvmrc
author Mahlon E. Smith <mahlon@martini.nu>
Wed, 30 Aug 2017 13:18:26 -0700
changeset 1 69f2ba4d4d93
parent 0 d99e1dffbc72
permissions -rw-r--r--
Use the new #node_properties method.

#!/usr/bin/env bash

environment_id="ruby-2.3@arborist-fping"

if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
  && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
then
  \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
  for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
  do
    if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
    then \. "${__hook}" || true
    fi
  done
  unset __hook
  if (( ${rvm_use_flag:=1} >= 2 )) # display only when forced
  then
    if [[ $- == *i* ]] # check for interactive shells
    then printf "%b" "Using: $(tput setaf 2 2>/dev/null)$GEM_HOME$(tput sgr0 2>/dev/null)\n" # show the user the ruby and gemset they are using in green
    else printf "%b" "Using: $GEM_HOME\n" # don't use colors in non-interactive shells
    fi
  fi
else
  # If the environment file has not yet been created, use the RVM CLI to select.
  rvm --create  "$environment_id" || {
    echo "Failed to create RVM environment '${environment_id}'."
    return 1
  }
fi