Permalink
Browse files

Bugfix: Remove archive if it fails checks. Feature: Initial bundler s…

…upport.
  • Loading branch information...
1 parent badebc3 commit 7953ba0f8cc6da4dbca2bce113e94a2239272c24 @wayneeseguin wayneeseguin committed Feb 13, 2010
Showing with 64 additions and 44 deletions.
  1. +1 −0 binscripts/rvmsudo
  2. +2 −1 scripts/cli
  3. +1 −0 scripts/fetch
  4. +3 −1 scripts/gems
  5. +36 −28 scripts/manage
  6. +6 −5 scripts/selector
  7. +15 −9 scripts/utility
View
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
prefix="PATH='$PATH'"
+if [[ ! -z "$BUNDLE_PATH" ]] ; then prefix="BUNDLE_PATH='$BUNDLE_PATH' $prefix" ; fi
if [[ ! -z "$GEM_HOME" ]] ; then prefix="GEM_HOME='$GEM_HOME' $prefix" ; fi
if [[ ! -z "$GEM_PATH" ]] ; then prefix="GEM_PATH='$GEM_PATH' $prefix" ; fi
View
@@ -56,7 +56,8 @@ __rvm_parse_args() {
unset rvm_gem_set_name ; shift
export rvm_ruby_gem_home="$(echo $GEM_HOME | sed 's/%.*$//')"
export GEM_HOME="$rvm_ruby_gem_home"
- export GEM_PATH="$rvm_ruby_gem_path"
+ export BUNDLE_PATH="$rvm_ruby_gem_home"
+ export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_gem_home%global/bin"
rvm_ruby_args="clear"
rvm_parse_break=1
elif [[ "delete" = "$1" ]] ; then
View
@@ -48,6 +48,7 @@ else
fi
if [[ $download -gt 0 ]] ; then
+ rm -f $archive
eval $fetch_command "$1"
result=$?
if [[ $result -gt 0 ]] ; then
View
@@ -92,6 +92,7 @@ __rvm_gems_dump() {
if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
export GEM_HOME="$rvm_ruby_gem_home"
export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string%global/bin"
+ export BUNDLE_PATH="$rvm_ruby_gem_home"
fi
if [[ -z "$rvm_file_name" ]] ; then
@@ -124,6 +125,7 @@ __rvm_gems_load() {
if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
export GEM_HOME="$rvm_ruby_gem_home"
export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string%global/bin"
+ export BUNDLE_PATH="$rvm_ruby_gem_home"
fi
if [[ ! -z "$(echo "$gems_args" | awk '/\.gem.*$/')" ]] ; then
@@ -244,7 +246,7 @@ __rvm_gem_install() {
if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
if [[ ! -z "$rvm_ruby_gem_home" ]] && [[ "$rvm_ruby_gem_home" != "$rvm_gems_path" ]] ; then
- command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string%global/bin' $gem_prefix gem install $gems_args $rvm_gem_options $gem_postfix $vars"
+ command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string%global/bin' BUNDLE_PATH='$rvm_ruby_gem_home' $gem_prefix gem install $gems_args $rvm_gem_options $gem_postfix $vars"
else
command="$gem_prefix gem install $gems_args $rvm_gem_options -q $gem $gem_postfix $vars"
fi
View
@@ -93,8 +93,9 @@ __rvm_install_source() {
$rvm_scripts_path/log "info" "Installation of $rvm_ruby_string is complete."
- 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_rubygems_setup
__rvm_bin_script
@@ -154,12 +155,12 @@ __rvm_install_ruby() {
for binary_name in $(echo $binaries); do
# if [[ $binary_name != "gem" ]] ; then prefix="-S" ; 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:\$PATH" ; export PATH
+export GEM_HOME="$rvm_ruby_gem_home"
+export GEM_PATH="$rvm_ruby_gem_path"
+export MY_RUBY_HOME="$rvm_ruby_home"
+export PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:\$PATH"
exec $macruby_path/mac$binary_name $prefix "\$@"
RubyWrapper
@@ -257,7 +258,7 @@ RubyWrapper
__rvm_unset_ruby_variables ; rvm_ruby_string="$original_string" ; __rvm_select
unset original_string
- unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
+ unset BUNDLE_PATH GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
PATH=$rvm_bin_path:$PATH ; export PATH
@@ -330,10 +331,11 @@ RubyWrapper
ruby_wrapper=$(cat <<RubyWrapper
#!/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:\$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:\$PATH"
exec $rvm_ruby_home/bin/rbx $prefix$binary_name "\$@"
RubyWrapper
@@ -550,10 +552,11 @@ RubyWrapper
ruby_wrapper=$(cat <<RubyWrapper
#!/bin/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:\$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:\$PATH"
exec mono $rvm_ruby_home/bin/ir.exe $binary_path "\$@"
RubyWrapper
@@ -573,7 +576,7 @@ RubyWrapper
mput|shyouhei)
if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
- unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
+ unset BUNDLE_PATH GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
PATH=$rvm_bin_path:$PATH ; export PATH
@@ -629,8 +632,9 @@ RubyWrapper
$rvm_scripts_path/log "info" "Installation of $rvm_ruby_string is complete."
- 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_rubygems_setup
__rvm_bin_script
@@ -826,10 +830,12 @@ __rvm_post_install() {
$rvm_scripts_path/log "info" "Installing gems for $rvm_ruby_string."
for rvm_gem_name in rake ; do
- home="$GEM_HOME" ; export GEM_HOME="$rvm_ruby_global_gems_path"
- path="$GEM_PATH" ; export GEM_PATH="$rvm_ruby_global_gems_path"
+ home="$GEM_HOME" ; path="$GEM_PATH" # Save
+ export GEM_HOME="$rvm_ruby_global_gems_path"
+ export GEM_PATH="$rvm_ruby_global_gems_path"
+ export BUNDLE_PATH="$rvm_ruby_global_gems_path"
__rvm_run "gems.install" "$rvm_ruby_home/bin/gem install $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name"
- export GEM_HOME="$home" ; export GEM_PATH="$path" ; unset home path
+ export GEM_HOME="$home" ; export GEM_PATH="$path" ; export BUNDLE_PATH="$home" ; unset home path
done ; unset rvm_gem_name
$rvm_scripts_path/log "info" "Installation of gems for $rvm_ruby_string is complete."
@@ -851,10 +857,12 @@ __rvm_rubygems_setup() {
__rvm_inject_ruby_shebang "$rvm_ruby_src_path/bin/gem"
__rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
cp $rvm_ruby_src_path/bin/gem $rvm_ruby_home/bin/gem
- home="$GEM_HOME" ; export GEM_HOME="$rvm_ruby_global_gems_path"
- path="$GEM_PATH" ; export GEM_PATH="$rvm_ruby_global_gems_path"
+ home="$GEM_HOME" ; path="$GEM_PATH" # Save
+ export GEM_HOME="$rvm_ruby_global_gems_path"
+ export GEM_PATH="$rvm_ruby_global_gems_path"
+ export BUNDLE_PATH="$rvm_ruby_global_gems_path"
__rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "Updating rubygems for $rvm_ruby_string"
- export GEM_HOME="$home" ; export GEM_PATH="$path" ; unset home path
+ export GEM_HOME="$home" ; export GEM_PATH="$path" ; export BUNDLE_PATH="$home" unset home path
__rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
__rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
@@ -884,7 +892,7 @@ __rvm_rubygems_setup() {
builtin cd "$rvm_src_path/$rvm_gem_package_name"
- __rvm_run "rubygems.install" "GEM_PATH=$rvm_ruby_gem_path GEM_HOME=$rvm_ruby_gem_home $rvm_ruby_home/bin/ruby $rvm_src_path/$rvm_gem_package_name/setup.rb" "Installing rubygems for $rvm_ruby_home/bin/ruby"
+ __rvm_run "rubygems.install" "GEM_PATH=$rvm_ruby_gem_path GEM_HOME=$rvm_ruby_gem_home BUNDLE_PATH=$rvm_ruby_gem_home $rvm_ruby_home/bin/ruby $rvm_src_path/$rvm_gem_package_name/setup.rb" "Installing rubygems for $rvm_ruby_home/bin/ruby"
result=$?
if [[ $result -eq 0 ]] ; then
$rvm_scripts_path/log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
@@ -925,9 +933,9 @@ __rvm_inject_gem_env() {
__rvm_actual_file $1
if [[ -f "$actual_file" ]] ; then
if [[ ! -z "$(head -n 1 $actual_file | awk '/[j]*ruby/')" ]] ; then
- string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_ruby_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_ruby_gem_path'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:' + ENV['PATH']"
+ string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_ruby_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_ruby_gem_path'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:' + ENV['PATH']\nENV['BUNDLE_PATH']=ENV['BUNDLE_PATH'] || '$rvm_ruby_gem_home'\n"
elif [[ ! -z "$(head -n 1 $actual_file | awk '/bash/')" ]] ; then
- string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_path'}\nPATH=$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH"
+ string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_path'}\nPATH=$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH\nBUNDLE_PATH=\${BUNDLE_PATH:-'$rvm_ruby_gem_home'}\n"
fi
if [[ ! -z "$string" ]] ; then
awk "NR==2 {print \"$string\"} {print}" "$actual_file" > "$actual_file.new"
View
@@ -238,13 +238,13 @@ __rvm_use() {
else
rvm_ruby_interpreter="system"
$rvm_scripts_path/log "warn" "no default rvm specified, defaulting to pre-rvm system."
- unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
+ unset GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
if [[ -s $rvm_config_path/system ]] ; then source $rvm_config_path/system ; fi
fi
elif [[ "system" = "$rvm_ruby_interpreter" ]] ; then
- unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
+ unset GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
new_path="$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)"
new_path="$rvm_bin_path:$new_path"
if [[ -s $rvm_config_path/system ]] ; then
@@ -271,11 +271,12 @@ __rvm_use() {
else
GEM_HOME="$rvm_ruby_gem_home"
GEM_PATH="$rvm_ruby_gem_path"
+ BUNDLE_PATH="$rvm_ruby_gem_home"
MY_RUBY_HOME="$rvm_ruby_home"
RUBY_VERSION="$rvm_ruby_string"
IRBRC="$rvm_ruby_irbrc"
- export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
+ export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
if [[ -z "$IRBRC" ]] ; then unset IRBRC ; fi
@@ -312,11 +313,11 @@ __rvm_use() {
rm -f $rvm_bin_path/default*
else
RUBY_VERSION="$($rvm_ruby_home/bin/ruby -v | sed 's#^\(.*\) (.*$#\1#')"
- export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION
+ export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION
echo "export PATH=\"$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_bin_path:\$PATH\"" > $rvm_config_path/default
- for variable in RUBY_VERSION GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gem_set_name MAGLEV_HOME ; do
+ for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gem_set_name MAGLEV_HOME ; do
eval "export $variable"
eval value=\$${variable}
if [[ ! -z "$value" ]] ; then
View
@@ -53,8 +53,10 @@ binaries:
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
@@ -187,14 +189,17 @@ __rvm_bin_scripts() {
# 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
@@ -208,7 +213,7 @@ RubyWrapper
# 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
@@ -251,7 +256,7 @@ __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
@@ -796,8 +801,9 @@ __rvm_gems_use() {
$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
}

0 comments on commit 7953ba0

Please sign in to comment.