scripts/utility in rvm-0.1.13 vs scripts/utility in rvm-0.1.14
- old
+ new
@@ -51,12 +51,14 @@
rake: "$(which rake 2>/dev/null)"
environment:
GEM_HOME: "$GEM_HOME"
GEM_PATH: "$GEM_PATH"
+ BUNDLE_PATH: "$BUNDLE_PATH"
MY_RUBY_HOME: "$MY_RUBY_HOME"
IRBRC: "$IRBRC"
+
Info
if [[ ! -z "$MAGLEV_HOME" ]] ; then echo -e " MAGLEV_HOME: \"$MAGLEV_HOME\"" ; fi
unset full_version
}
@@ -156,10 +158,20 @@
# Unset ruby-specific variables
__rvm_unset_ruby_variables() {
unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_string rvm_ruby_string rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path
}
+__rvm_set_rvmrc() {
+ if [[ "$HOME" != "$(pwd)" ]] ; then
+ if [[ -s .rvmrc ]] ; then
+ mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S)
+ fi
+ echo "rvm use $(basename $rvm_ruby_gem_home)" > .rvmrc
+ else
+ echo -e "Not setting a project specific rvmrc file, currently in the HOME directory."
+ fi
+}
__rvm_load_rvmrc() {
if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
}
@@ -175,18 +187,21 @@
}
# Write the bin/ wrapper script for currently selected ruby.
# TODO: Adjust binscript to be able to handle all rubies not just the standard interpreteres.
__rvm_bin_script() {
+
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
+
ruby_wrapper=$(cat <<RubyWrapper
-#!/bin/bash
+#!/usr/bin/env bash
-GEM_HOME=$rvm_ruby_gem_home ; export GEM_HOME
-GEM_PATH=$rvm_ruby_gem_path ; export GEM_PATH
-MY_RUBY_HOME=$rvm_ruby_home ; export MY_RUBY_HOME
-PATH=$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_bin_path:\$PATH ; export PATH
+export GEM_HOME="$rvm_ruby_gem_home"
+export GEM_PATH="$rvm_ruby_gem_path"
+export BUNDLE_PATH="$rvm_ruby_gem_home"
+export MY_RUBY_HOME="$rvm_ruby_home"
+export PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_bin_path:\$PATH"
exec "$rvm_ruby_binary" "\$@"
RubyWrapper
)
rm -f $rvm_bin_path/$rvm_ruby_package_name
@@ -196,11 +211,11 @@
}
# Load default ruby, if default is not set load system ruby.
__rvm_load_defaults() {
if [[ ! -s "$rvm_config_path/system" ]] ; then
- for variable in RUBY_VERSION GEM_HOME GEM_PATH MY_RUBY_HOME ; do
+ for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME ; do
eval value=\$${variable}
if [[ -z "$value" ]] ; then
echo "unset ${variable}" >> $rvm_config_path/system
else
eval "export $variable"
@@ -239,11 +254,11 @@
# rvm will refresh the stored information the next time it is called after reset.
__rvm_reset() {
PATH="$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)"
PATH="$rvm_bin_path:$PATH" ; export PATH
- for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do unset $variable ; done
+ for variable in RUBY_VERSION GEM_HOME BUNDLE_PATH MY_RUBY_HOME ; do unset $variable ; done
for flag in default passenger editor ; do rm -f "$rvm_bin_path"/${flag}_* ; done
for file in system default ; do
if [[ -f "$rvm_path/$file" ]] ; then rm -f $rvm_path/$file ; fi
@@ -746,31 +761,39 @@
if [[ ! -d "$rvm_ruby_gem_home" ]] ; then mkdir -p $rvm_ruby_gem_home ; fi
rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
- # TODO: Remove next line after a few releases.
- mkdir -p $rvm_gems_path/cache $rvm_gems_path/doc
+ # TODO: Remove next section after a several releases.
+ # Migrate original rvm global gem cache directory to $HOME/.gem/cache
+ if [[ -d "$rvm_path/gems/cache" ]] && [[ ! -L "$rvm_path/gems/cache" ]] ; then
+ if [[ ! -z "$(ls -A "$rvm_path"/gems/cache/)" ]] ; then
+ mv $rvm_path/gems/cache/* $HOME/.gem/cache/
+ fi
+ rmdir $rvm_path/gems/cache
+ fi
+ rm -f "$rvm_path/gems/cache"
+ ln -nfs "$HOME/.gem/cache" "$rvm_path/gems/cache"
+ # /TODO
+
# Careful not to nuke system gems cache.
if [[ ! -z "$rvm_ruby_gem_home" ]] && [[ ! -z "$(echo $rvm_ruby_gem_home | awk '/rvm/')" ]] ; then
- # Global gems cache
# Ensure that the ruby gem home exists.
mkdir -p "$rvm_ruby_gem_home"
# If there is a cache *directory* already,
# move all the gems to the global cache directory and remove it.
if [[ -d "$rvm_ruby_gem_home/cache" ]] && [[ ! -L "$rvm_ruby_gem_home/cache" ]] ; then
if [[ ! -z "$(ls -A "$rvm_ruby_gem_home"/cache/)" ]] ; then
- mv "$rvm_ruby_gem_home"/cache/* "$rvm_gems_path"/cache/
+ mv "$rvm_ruby_gem_home"/cache/* "$HOME"/.gem/cache/
fi
- rm -rf "$rvm_ruby_gem_home/cache"
+ rmdir "$rvm_ruby_gem_home"/cache
fi
- # If the ruby's gems cache directory is not a symlink to the global cache,
- # symlink it
+ # If the ruby's gems cache directory is not a symlink to the global cache, symlink it
if [[ ! -L "$rvm_ruby_gem_home/cache" ]] ; then
- ln -nfs "$rvm_gems_path/cache" "$rvm_ruby_gem_home/cache"
+ ln -nfs "$HOME/.gem/cache" "$rvm_ruby_gem_home/cache"
fi
fi ; export rvm_ruby_gem_path rvm_ruby_gem_home
}
# Use a gems(et) specified by 'rvm_ruby_gem_home'
@@ -784,11 +807,12 @@
if [[ "$rvm_interactive" = 1 ]] ; then
$rvm_scripts_path/log "info" "gems(et) : ${rvm_gem_set_name:-default}"
fi
- GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
- GEM_PATH="$rvm_ruby_gem_path" ; export GEM_PATH
+ export GEM_HOME="$rvm_ruby_gem_home"
+ export GEM_PATH="$rvm_ruby_gem_path"
+ export BUNDLE_PATH="$rvm_ruby_gem_home"
__rvm_use
fi
}
__rvm_mono_env() {