Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Manually rehash whenever path is set

  • Loading branch information...
commit 8940cacb81bd77cbe8b4a5f6be49394103ed872e 1 parent dac774d
@Sutto Sutto authored
Showing with 19 additions and 6 deletions.
  1. +8 −2 scripts/manage
  2. +5 −4 scripts/selector
  3. +6 −0 scripts/utility
View
10 scripts/manage
@@ -86,7 +86,11 @@ __rvm_install_source() {
$rvm_scripts_path/log "error" "There has been an error, source directory is missing. Did the download or extraction fail? Aborting the installation." ; __rvm_pushpop ; return $result
fi
- if [[ -d "${rvm_path}/usr" ]] ; then export PATH="${rvm_path}/usr/bin:${PATH}" ; fi
+
+ if [[ -d "${rvm_path}/usr" ]] ; then
+ export PATH="${rvm_path}/usr/bin:${PATH}"
+ builtin hash -r
+ fi
__rvm_apply_patches
result="$?"
@@ -322,6 +326,7 @@ RubyWrapper
unset BUNDLE_PATH GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH=$(echo $PATH | \tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
__rvm_conditionally_add_bin_path ; export PATH
+ builtin hash -r
if [[ -n "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ -z "$rvm_head_flag" ]] ; then
$rvm_scripts_path/log "info" "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
@@ -634,7 +639,7 @@ RubyWrapper
mv -f "$rvm_ruby_home/bin/ir.new" "$rvm_ruby_home/bin/ir"
chmod +x $rvm_ruby_home/bin/ir
ln -fs $rvm_ruby_home/bin/ir $rvm_ruby_home/bin/ruby
-
+ builtin hash -r
__rvm_run "gems.install" "PATH=$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:$PATH GEM_HOME=$rvm_ruby_gem_home GEM_PATH=$rvm_ruby_gem_home $rvm_ruby_home/bin/gem install --no-rdoc --no-ri rake $rvm_gem_options" "Installing $rvm_gem_name to $dir"
;;
@@ -643,6 +648,7 @@ RubyWrapper
unset BUNDLE_PATH GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH=$(echo $PATH | \tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
__rvm_conditionally_add_bin_path ; export PATH
+ builtin hash -r
rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
View
9 scripts/selector
@@ -290,7 +290,11 @@ __rvm_use() {
# Export ruby string and gem set me for extrenal scripts to take advantage of them.
if [[ -n "$rvm_ruby_string" ]] ; then export rvm_ruby_string ; fi
if [[ -n "$rvm_gemset_name" ]] ; then export rvm_gemset_name ; fi
- if [[ -n "$new_path" ]] ; then export PATH="$new_path" ; unset new_path ; fi
+ if [[ -n "$new_path" ]]; then
+ export PATH="$new_path"
+ unset new_path
+ builtin hash -r
+ fi
if [[ -n "$rvm_rvmrc_flag" ]] ; then __rvm_set_rvmrc ; fi
environment_id="$(__rvm_environment_identifier)"
@@ -340,9 +344,6 @@ __rvm_use() {
if [[ $result -eq 1 ]] ; then $rvm_ruby_home/bin/maglev start ; fi
fi
fi
-
- # Rehash executable locations, e.g. to force the shell to recognize new items in the path.
- builtin hash -r
rvm_hook="after_use" ; source $rvm_scripts_path/hook
}
View
6 scripts/utility
@@ -156,12 +156,14 @@ __rvm_set_path_variable() {
__rvm_clean_path() {
PATH=$(echo $PATH | \tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | \tr -s '\n' ':' | sed 's#:$##')
export PATH
+ builtin hash -r
}
# Clean all rvm items out of the current working path.
__rvm_remove_rvm_from_path() {
PATH=$(echo $PATH | \tr -s ':' '\n' | \grep -v "\.rvm" | \tr -s '\n' ':' | sed 's#:$##')
export PATH
+ builtin hash -r
}
# Run a specified command and log it.
@@ -358,6 +360,7 @@ __rvm_bin_script() {
__rvm_conditionally_add_bin_path() {
if echo "$PATH" | \tr ':' ' ' | \grep -vqF "$rvm_bin_path " ; then
PATH="$rvm_bin_path:$PATH"
+ builtin hash -r
fi
}
@@ -367,6 +370,7 @@ __rvm_reset() {
PATH="$(echo $PATH | \tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)"
__rvm_conditionally_add_bin_path
export PATH
+ builtin hash -r
for flag in default passenger editor ; do \rm -f "$rvm_bin_path"/${flag}_* ; done
unset flag
@@ -586,6 +590,7 @@ __rvm_mono_env() {
export ACLOCAL_FLAGS="-I $ACLOCAL_PATH"
export PKG_CONFIG_PATH="$rvm_usr_path/lib/pkgconfig:$PKG_CONFIG_PATH"
PATH="$rvm_usr_path/bin:$PATH"
+ builtin hash -r
}
__rvm_become() {
@@ -659,6 +664,7 @@ __rvm_load_env_file() {
# Restore the path to it's state minus rvm
PATH="$(echo $PATH | \tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)"
. "$rvm_environments_path/$1"
+ builtin hash -r
else
rvm use "$1" >/dev/null 2>&1
fi
Please sign in to comment.
Something went wrong with that request. Please try again.