Skip to content

Instantly share code, notes, and snippets.

View Sutto's full-sized avatar

Darcy Laycock Sutto

View GitHub Profile
#!/usr/bin/env sh
source ~/.rvm/scripts/rvm
! command -v ruby >/dev/null 2>&1 || command -v ruby | grep -v rvm >/dev/null
echo "Result = $?"
echo "<pre>"
echo "rvm_path = '$rvm_path'"
echo "$rvm_environments_path"
echo "---"
rvm alias list
echo "--"
#!/usr/bin/env bash -e
source "$rvm_scripts_path/rvm" || true
rvm install ruby-1.8.7-p299 -C '--enable-shared,--with-readline-dir='"$rvm_path"'/usr'
rvm install rbx-1.0.1-20100603
module SimpleSortable
def is_sortable(field = :position, options = {})
cattr_accessor :sortable_field, :sortable_condition_field
self.sortable_field = field.to_sym
if options[:if_field]
self.sortable_condition_field = options[:if_field]
scope :sortable_items, where(sortable_condition_field => true)
else
scope :sortable_items, unscoped
#!/usr/bin/env bash
[[ -f /etc/rvmrc ]] && source /etc/rvmrc
[[ -f "$HOME/.rvmrc" ]] && source "$HOME/.rvmrc"
rvm_path="${rvm_path:-$HOME/.rvm}"
export rvm_path
mkdir -p "$rvm_path/src/"
#!/usr/bin/env bash
[[ -f /etc/rvmrc ]] && source /etc/rvmrc
[[ -f "$HOME/.rvmrc" ]] && source "$HOME/.rvmrc"
rvm_path="${rvm_path:-"$HOME/.rvm"}"
mkdir -p "$rvm_path/src/"
builtin cd "$rvm_path/src"

An introduction to rvm_sandboxed

So, under the hook, rvm uses a variety of environment variables to tell it where to locate things. Out of the box, these variables are current:

  • rvm_path - the directory in which rvm is installed (e.g. typically ~/.rvm)
  • rvm_prefix - basically, ${rvm_prefix}rvm is used to build the default rvm_path. It tells rvm how to build the default rvm_path, rvm_bin_path and rvm_man_path. This also relies on the rvm_sandboxed argument
  • rvm_sandboxed - tells rvm how to behave when working with rvm_prefix. See "How does rvm_sandboxed work?" below for more information.
#!/usr/bin/env bash
__rvm_system_wide_permissions() {
[[ -z "$1" ]] && return 1
chown -R root:"$rvm_group_name" "$1"
chmod -R g+w "$1"
[[ -d "$1" ]] && find "$1" -type d -exec chmod g+s '{}' +
}
# Require root to install it.
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
#!/bin/bash
echo "Cleaning up packages"
apt-get --purge remove
echo "Removing ssh"
apt-get --purge -y remove openssh-server
echo "Cleaning up RVM"
rvm cleanup all
# Substitute rvm in the first line for whatever group it is installed at.
if groups | grep -q rvm ; then
[[ -s "/usr/local/lib/rvm" ]] && source "/usr/local/lib/rvm"
fi