.rvmrc
author Mahlon E. Smith <mahlon@martini.nu>
Wed, 07 Sep 2016 15:25:50 -0700
changeset 6 71578fe8e9ec
parent 0 8547a1ce445e
permissions -rw-r--r--
Fix example.

#!/usr/bin/env bash

environment_id="ruby-2.3@arborist-snmp"

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