Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add scripts/functions/developer, from https://gist.github.com/984bd56424b #268

Merged
merged 3 commits into from

2 participants

@CraigCottingham

Add scripts/functions/developer, from https://gist.github.com/984bd56424be200532d0

Needs documentation, but I'm not sure where that should go.

Signed-off-by: Craig S. Cottingham craig.cottingham@gmail.com

@wayneeseguin wayneeseguin merged commit b478c5c into rvm:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 13, 2011
  1. @CraigCottingham

    Add scripts/functions/developer, from https://gist.github.com/984bd56…

    CraigCottingham authored
    …424be200532d0
    
    Signed-off-by: Craig S. Cottingham <craig.cottingham@gmail.com>
  2. @CraigCottingham
  3. @CraigCottingham
This page is out of date. Refresh to see the latest.
Showing with 40 additions and 0 deletions.
  1. +40 −0 scripts/functions/developer
View
40 scripts/functions/developer
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+#
+# Switch between RVM installs.
+# Given a topic context name like "testing", looks for a directory named ".rvm.testing"
+# (installing a new copy of RVM in it if it doesn't already exist), then symlinks
+# .rvm to it.
+#
+# rvmselect testing
+rvmselect()
+{
+ if [[ -z "${1:-}" ]]
+ then
+ echo "No topic context name specified (example: work )"
+ return 0
+ fi
+
+ local name=$1
+
+ true ${rvm_path:=$HOME/.rvm}
+
+ if [[ ! -L "$rvm_path" && -d "$rvm_path" ]]
+ then
+ printf "ERROR: $rvm_path is a directory, rename it to .<somename> first."
+ fi
+
+ if [[ ! -d "${rvm_path}.${name}" ]]
+ then
+ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
+ mv "${rvm_path}" "${rvm_path}.${name}"
+ fi
+
+ rm -f "${rvm_path}"
+
+ ln -fs "${rvm_path}.${name}" "${rvm_path}"
+
+ ls -al "$(basename "${rvm_path}")" | grep "$rvm_path" | awk '/rvm/{print "=> "$NF}'
+
+ return $?
+}
Something went wrong with that request. Please try again.