rvm 0.1.43 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,18 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ if [[ -z "$rvm_sandboxed" ]]; then
4
+ if [[ "root" = "$(whoami)" ]] || [[ -n "$rvm_prefix" && "$rvm_prefix" != "$HOME"/* ]]; then
5
+ export rvm_sandboxed=0
6
+ else
7
+ export rvm_sandboxed=1
8
+ fi
9
+ fi
10
+
3
11
  unset rvm_auto_flag
4
12
 
5
- install_source_path=$(dirname $0)
13
+ install_source_path="$(dirname "$0" | sed 's#\/scripts$##')"
6
14
  if [[ -d "$install_source_path/scripts" ]] && [[ -s "$install_source_path/scripts/utility" ]] ; then
7
- builtin cd $install_source_path
15
+ builtin cd "$install_source_path"
8
16
  fi
9
17
 
10
18
  source scripts/version
@@ -53,7 +61,7 @@ done
53
61
 
54
62
  if [[ -z "$rvm_prefix" ]] ; then
55
63
  __rvm_load_rvmrc
56
- if [[ "root" = "$(whoami)" ]] ; then
64
+ if [[ "$rvm_sandboxed" = "0" ]] ; then
57
65
  rvm_prefix="${rvm_prefix:-"/usr/local/"}"
58
66
  else
59
67
  rvm_prefix="${rvm_prefix:-"$HOME/."}"
@@ -64,7 +72,7 @@ if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
64
72
 
65
73
  source scripts/initialize
66
74
 
67
- if grep -q 'scripts/rvm' $HOME/.bash* || grep -q 'scripts/rvm' $HOME/.zsh*; then
75
+ if grep -q 'scripts/rvm' $HOME/.bash* 2>/dev/null || grep -q 'scripts/rvm' $HOME/.zsh* 2>/dev/null; then
68
76
  if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then
69
77
  export upgrade_flag=1
70
78
  else
@@ -114,7 +122,7 @@ fi
114
122
 
115
123
  spinner
116
124
 
117
- mkdir -p $rvm_archives_path $rvm_src_path $rvm_log_path $rvm_bin_path $rvm_gems_path $rvm_rubies_path $rvm_config_path $rvm_hooks_path $rvm_tmp_path
125
+ mkdir -p "$rvm_archives_path" "$rvm_src_path" "$rvm_log_path" "$rvm_bin_path" "$rvm_gems_path" "$rvm_rubies_path" "$rvm_config_path" "$rvm_hooks_path" "$rvm_tmp_path"
118
126
 
119
127
  for file in README LICENCE ; do
120
128
  spinner
@@ -148,7 +156,7 @@ done
148
156
  # Bin Scripts
149
157
  #
150
158
  # Cleanse and purge...
151
- for file in rvm-prompt rvm rvmsudo rvm-shell ; do
159
+ for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
152
160
  spinner && perl -e 'sleep 0.2'
153
161
  rm -f "$rvm_bin_path/$file"
154
162
  cp -f "$source_path/binscripts/$file" $rvm_bin_path/
@@ -183,29 +191,30 @@ fi
183
191
  # Initial Interpreter Gemsets.
184
192
  #
185
193
  spinner
186
- mkdir -p "$rvm_gemsets_path"
187
- for gemset_file in $(cd gemsets ; find . -iname '*.gems' | sed 's/^\.\///') ; do
188
- source_path="$(pwd)/gemsets"
189
- destination="$rvm_gemsets_path/$gemset_file"
190
- destination_path="$(dirname "$destination")"
191
- if [[ ! -s "$destination" ]] ; then
192
- mkdir -p "$destination_path"
193
- cp "$source_path/$gemset_file" "$destination"
194
- fi
195
- done ; unset destination destination_path source_path gemset_file
194
+ if [[ -d gemsets/ ]] ; then
195
+ mkdir -p "$rvm_gemsets_path"
196
+ for gemset_file in $(cd gemsets ; find . -iname '*.gems' | sed 's/^\.\///') ; do
197
+ destination="$rvm_gemsets_path/$gemset_file"
198
+ destination_path="$(dirname "$destination")"
199
+ if [[ ! -s "$destination" ]] ; then
200
+ mkdir -p "$destination_path"
201
+ cp "gemsets/$gemset_file" "$destination"
202
+ fi
203
+ done ; unset destination destination_path gemset_file
204
+ fi
196
205
 
197
206
  spinner
198
- mkdir -p "$rvm_patchsets_path"
199
- for patchsets_file in $(cd gemsets ; find . -iname '*' | sed 's/^\.\///') ; do
200
- source_path="$(pwd)/gemsets"
201
- destination="$rvm_patchsets_path/$patchset_file"
202
- destination_path="$(dirname "$destination")"
203
- if [[ ! -s "$destination" ]] ; then
204
- mkdir -p "$destination_path"
205
- cp "$source_path/$patchset_file" "$destination"
206
- fi
207
- done ; unset destination destination_path source_path patchset_file
208
-
207
+ if [[ -d patchsets/ ]] ; then
208
+ mkdir -p "$rvm_patchsets_path"
209
+ for patchset_file in $(cd patchsets ; find . -iname '*' | sed 's/^\.\///') ; do
210
+ destination="$rvm_patchsets_path/$patchset_file"
211
+ destination_path="$(dirname "$destination")"
212
+ if [[ ! -s "$destination" ]] ; then
213
+ mkdir -p "$destination_path"
214
+ cp "patchsets/$patchset_file" "$destination"
215
+ fi
216
+ done ; unset destination destination_path patchset_file
217
+ fi
209
218
 
210
219
  #
211
220
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
@@ -276,7 +285,7 @@ fi
276
285
 
277
286
  printf "\n Correct permissions for base binaries in $rvm_bin_path..."
278
287
  mkdir -p $rvm_bin_path
279
- for file in rvm rvmsudo rvm-shell ; do
288
+ for file in rvm rvmsudo rvm-shell rvm-auto-ruby; do
280
289
  [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
281
290
  done; unset file
282
291
  printf "\n Copying manpages into place."
@@ -285,9 +294,7 @@ for man_file in $(\ls "$install_source_path/man"); do
285
294
  cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
286
295
  done
287
296
 
288
- if [[ "$upgrade_flag" -eq 0 ]] ; then
289
- ./scripts/notes
290
- fi
297
+ [[ "$upgrade_flag" = 0 ]] && ./scripts/notes
291
298
 
292
299
  name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)"
293
300
  printf "\n\n${name:-"$(whoami)"},\n"
@@ -2,6 +2,11 @@
2
2
  # This file will be overriden every time you update rvm.
3
3
 
4
4
  # Turn on completion.
5
+ begin
6
+ require "readline"
7
+ rescue
8
+ puts "Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.\nYou may follow 'rvm notes' for dependencies and/or read the docs page http://rvm.beginrescueend.com/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries."
9
+ end
5
10
  require "irb/completion" rescue nil
6
11
 
7
12
  # Turn on history saving.
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
4
-
5
- source "$rvm_scripts_path/utility"
3
+ rvm_base_except="selector"
4
+ source "$rvm_scripts_path/base"
6
5
 
7
6
  list_gemsets() {
8
7
  if [[ "$1" = "strings" ]]; then
@@ -23,7 +22,7 @@ list_gemsets() {
23
22
  elif [[ -n "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then
24
23
  string="[ x86_64 ]"
25
24
  else
26
- string="[ $(file $rvm_rubies_path/$ruby_version_name/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
25
+ string="[ $(file $rvm_rubies_path/$ruby_version_name/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
27
26
  fi
28
27
  unset ruby_version_name
29
28
  printf "\n"
@@ -39,7 +38,7 @@ list_gemsets() {
39
38
  version=$(grep 'MY_RUBY_HOME' $rvm_config_path/default | head -n 1 | awk -F"'" '{print $2}' | xargs basename)
40
39
  if [[ ! -z "$version" ]] ; then
41
40
  printf "\n\nDefault Ruby (for new shells)\n"
42
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
41
+ string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
43
42
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
44
43
  fi ; unset version
45
44
  fi
@@ -57,7 +56,7 @@ list_default() {
57
56
  version=$($rvm_scripts_path/alias show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename)
58
57
  if [[ ! -z "$version" ]] ; then
59
58
  printf "\n\nDefault Ruby (for new shells)\n"
60
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
59
+ string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
61
60
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
62
61
  fi ; unset version
63
62
  fi
@@ -115,7 +114,7 @@ list_rubies() {
115
114
  elif [[ ! -z "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then
116
115
  string="[ x86_64 ]"
117
116
  else
118
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
117
+ string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
119
118
  fi
120
119
  printf "\n"
121
120
  if [[ "$version" = "$current_ruby" ]]; then
@@ -130,7 +129,7 @@ list_rubies() {
130
129
  version=$(grep 'MY_RUBY_HOME' $rvm_config_path/default | head -n 1 | awk -F"'" '{print $2}' | xargs basename)
131
130
  if [[ ! -z "$version" ]] ; then
132
131
  printf "\n\nDefault Ruby (for new shells)\n"
133
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
132
+ string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
134
133
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
135
134
  fi ; unset version
136
135
  fi
@@ -156,7 +156,7 @@ if [[ ! -f /etc/sysctl.conf ]] || [[ "$(grep -sc "kern.*.shm" /etc/sysctl.conf)"
156
156
  # before they will take effect.
157
157
  echo "# kern.sysv.shm* settings added by MagLev installation" > /tmp/sysctl.conf.$$
158
158
  sysctl kern.sysv.shmmax kern.sysv.shmall kern.sysv.shmmin kern.sysv.shmmni \
159
- kern.sysv.shmseg | tr ":" "=" | tr -d " " >> /tmp/sysctl.conf.$$
159
+ kern.sysv.shmseg | \tr ":" "=" | \tr -d " " >> /tmp/sysctl.conf.$$
160
160
  ;;
161
161
  Solaris-x86)
162
162
  # Do nothing in Solaris-x86 since /etc/sysctl.conf is ignored on Solaris 10.
@@ -28,7 +28,7 @@ __rvm_check_for_bison() {
28
28
  __rvm_current_patch_names() {
29
29
  # TODO: Lookup default patches on rvm_ruby_string heirarchy.
30
30
  local patches="$rvm_patch_names default"
31
- for patch_name in $(echo "$patches" | tr ',' ' ' | __rvm_strip); do
31
+ for patch_name in $(echo "$patches" | \tr ',' ' ' | __rvm_strip); do
32
32
  __rvm_expand_patch_name "$patch_name"
33
33
  done
34
34
  }
@@ -150,8 +150,8 @@ __rvm_install_ruby() {
150
150
  if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
151
151
 
152
152
  if [[ -n "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
153
-
154
- # Check for clang if the flag is set
153
+
154
+ # Check for clang if the flag is set
155
155
  __rvm_check_for_clang
156
156
  local result="$?"
157
157
  [[ "$result" -gt 0 ]] && return $result
@@ -271,7 +271,7 @@ RubyWrapper
271
271
  $rvm_scripts_path/log "error" "There has been an error while trying to apply patches to ree. Aborting the installation." ; __rvm_pushpop ; return $result
272
272
  fi
273
273
 
274
- __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level $rvm_ree_options $db_configure_flags $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while depending on your cpu(s)..."
274
+ __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while depending on your cpu(s)..."
275
275
  result=$? ; if [[ "$result" -gt 0 ]] ; then
276
276
  $rvm_scripts_path/log "error" "There has been an error while trying to run the ree installer. Aborting the installation." ; __rvm_pushpop ; return $result
277
277
  fi
@@ -305,7 +305,7 @@ RubyWrapper
305
305
  unset CFLAGS LDFLAGS ARCHFLAGS # Important.
306
306
 
307
307
  unset BUNDLE_PATH GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
308
- PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
308
+ PATH=$(echo $PATH | \tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
309
309
  PATH=$rvm_bin_path:$PATH ; export PATH
310
310
 
311
311
  if [[ -n "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ -z "$rvm_head_flag" ]] ; then
@@ -376,7 +376,7 @@ RubyWrapper
376
376
  file_name="$rvm_ruby_home/bin/irb"
377
377
  rm -f "$file_name"
378
378
  printf '#!/usr/bin/env bash\n' > "$file_name"
379
- printf "exec '$rvm_ruby_home/bin/rbx' 'irb' \"\$@\"\n" >> "$file_name"
379
+ printf "exec '$rvm_ruby_home/bin/rbx' 'irb' \"\$@\"\n" >> "$file_name"
380
380
  [[ -f "$file_name" ]] && chmod +x "$file_name"
381
381
 
382
382
  # Install Gem Wrapper on Rubinius.
@@ -470,7 +470,7 @@ RubyWrapper
470
470
 
471
471
  if [[ -n "$rvm_head_flag" ]] ; then
472
472
  builtin cd $rvm_ruby_src_path
473
- rvm_gemstone_package_file="GemStone-$(grep ^GEMSTONE version.txt | cut -f2 -d-).$(uname -sm | tr ' ' '-')"
473
+ rvm_gemstone_package_file="GemStone-$(grep ^GEMSTONE version.txt | cut -f2 -d-).$(uname -sm | \tr ' ' '-')"
474
474
  rvm_gemstone_url="${rvm_gemstone_url:-"$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"}"
475
475
  fi
476
476
 
@@ -516,11 +516,11 @@ RubyWrapper
516
516
  if [[ -n "$rvm_head_flag" ]] ; then
517
517
  git submodule update --init
518
518
  $rvm_ruby_home/bin/maglev force-reload
519
- ln -sf maglev.demo.key-$(uname -sm | tr ' ' '-') etc/maglev.demo.key
519
+ ln -sf maglev.demo.key-$(uname -sm | \tr ' ' '-') etc/maglev.demo.key
520
520
  fi
521
521
 
522
522
  #ln -fs "$rvm_ruby_home/$(echo $rvm_gemstone_package_file | awk -F'.' '{print $1}')" "$rvm_ruby_home/gemstone"
523
-
523
+
524
524
  compatible_ruby="$(__rvm_18_compat_ruby)"
525
525
 
526
526
  if [[ ! -e ${rvm_ruby_home}/etc/conf.d/maglev.conf ]] ; then
@@ -608,14 +608,14 @@ RubyWrapper
608
608
  binaries=(gem irb rdoc rake ri ruby)
609
609
  for binary_name in ${binaries[@]} ; do
610
610
  if [[ -s $rvm_ruby_home/bin/$binary_name ]] ; then
611
- cat "$rvm_ruby_home/bin/$binary_name" | tr -d '\r' > "$rvm_ruby_home/bin/$binary_name.new"
611
+ cat "$rvm_ruby_home/bin/$binary_name" | \tr -d '\r' > "$rvm_ruby_home/bin/$binary_name.new"
612
612
  #sed -e '1,1s=.*=#!'"/usr/bin/env ir=" "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
613
613
  mv -f "$rvm_ruby_home/bin/$binary_name.new" "$rvm_ruby_home/bin/$binary_name"
614
614
  chmod +x $rvm_ruby_home/bin/$binary_name
615
615
  fi
616
616
  done
617
617
 
618
- sed -e '1,1s=.*=#!'"/usr/bin/env bash=" "$rvm_ruby_home/bin/ir" | tr -d '\r' > "$rvm_ruby_home/bin/ir.new"
618
+ sed -e '1,1s=.*=#!'"/usr/bin/env bash=" "$rvm_ruby_home/bin/ir" | \tr -d '\r' > "$rvm_ruby_home/bin/ir.new"
619
619
  mv -f "$rvm_ruby_home/bin/ir.new" "$rvm_ruby_home/bin/ir"
620
620
  chmod +x $rvm_ruby_home/bin/ir
621
621
  ln -fs $rvm_ruby_home/bin/ir $rvm_ruby_home/bin/ruby
@@ -626,7 +626,7 @@ RubyWrapper
626
626
  mput|shyouhei)
627
627
  if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
628
628
  unset BUNDLE_PATH GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
629
- PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
629
+ PATH=$(echo $PATH | \tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
630
630
  PATH=$rvm_bin_path:$PATH ; export PATH
631
631
 
632
632
  rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
@@ -690,7 +690,7 @@ RubyWrapper
690
690
  ;;
691
691
 
692
692
  ruby)
693
- __rvm_check_for_bison
693
+ __rvm_check_for_bison # Run like hell
694
694
  result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
695
695
 
696
696
  if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
@@ -732,42 +732,55 @@ __rvm_fetch_ruby() {
732
732
  rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_string"}"
733
733
  rvm_ruby_package_file="${rvm_ruby_package_file:-"$rvm_ruby_package_name"}"
734
734
  rvm_archive_extension="${rvm_archive_extension:-tar.gz}"
735
+
735
736
  if [[ ! -s "$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension" ]] ; then
736
737
  if [[ "ruby" = "$rvm_ruby_interpreter" ]] ; then
737
738
  rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_release_version}.${rvm_major_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
738
739
  elif [[ "ree" = "$rvm_ruby_interpreter" ]] ; then
739
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
740
+ rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
740
741
  elif [[ "jruby" = "$rvm_ruby_interpreter" ]] ; then
741
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/$rvm_ruby_version/$rvm_ruby_package_file.$rvm_archive_extension"
742
+ rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_version}/${rvm_ruby_package_file}.${rvm_archive_extension}"
742
743
  elif [[ "maglev" = "$rvm_ruby_interpreter" ]] ; then
743
744
  : # Should already be set from selector
744
745
  else
745
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
746
+ rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
746
747
  fi
747
- $rvm_scripts_path/log "info" "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
748
- $rvm_scripts_path/fetch "$rvm_url"
748
+ "$rvm_scripts_path/log" "info" "Downloading ${rvm_ruby_package_file}, this may take a while depending on your connection..."
749
+ "$rvm_scripts_path/fetch" "${rvm_url}"
749
750
  result=$? ; if [[ "$result" -gt 0 ]] ; then
750
- $rvm_scripts_path/log "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
751
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
751
752
  fi
752
753
  fi
753
754
 
754
- # Only re-extract if forced.
755
- if [[ ! -d "$rvm_src_path/$rvm_ruby_string" ]] || [[ -n "$rvm_force_flag" ]] ; then
755
+ if [[ ! -d "$rvm_ruby_src_path" ]] || [[ -n "$rvm_force_flag" ]] ; then
756
+ rm -rf "$rvm_ruby_src_path" # Especially when forced, we want to ensure the destination is missing.
757
+
758
+ mkdir -p "/tmp/rvm_src_$$"
759
+
756
760
  if [[ "tar.gz" = "$rvm_archive_extension" ]] || [[ "tgz" = "$rvm_archive_extension" ]] ; then
757
- __rvm_run "extract" "cat $rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension | gunzip | tar xf - -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
761
+ __rvm_run "extract" "cat $rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension | gunzip | tar xf - -C /tmp/rvm_src_$$" "Extracting $rvm_ruby_package_file ..."
758
762
  result=$? ; if [[ "$result" -gt 0 ]] ; then
759
763
  $rvm_scripts_path/log "error" "There has been an error while trying to extract the source. Aborting the installation." ; __rvm_pushpop ; return $result
760
764
  fi
761
765
  elif [[ "zip" = "$rvm_archive_extension" ]] ; then
762
- __rvm_run "extract" "unzip -q -o $rvm_archives_path/$rvm_ruby_package_file -d $rvm_src_path"
766
+ __rvm_run "extract" "unzip -q -o $rvm_archives_path/$rvm_ruby_package_file -d /tmp/rvm_src_$$"
763
767
  result=$? ; if [[ "$result" -gt 0 ]] ; then
764
768
  $rvm_scripts_path/log "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation." ; __rvm_pushpop ; return $result
765
769
  fi
766
770
  fi
771
+
772
+ mv "/tmp/rvm_src_$$/$(\cd /tmp/rvm_src_$$ ; \ls)" "$rvm_ruby_src_path" ; rm -rf "/tmp/rvm_src_$$"
773
+
774
+ if [[ -n "$rvm_ruby_name" ]] && [[ -d "$rvm_src_path/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]] ; then
775
+ mv "$rvm_src_path/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" "$rvm_ruby_src_path"
776
+ fi
777
+
767
778
  else
768
779
  $rvm_scripts_path/log "info" "$rvm_ruby_src_path has already been extracted." ; __rvm_pushpop ; return 0
769
780
  fi
781
+
770
782
  else
783
+
771
784
  mkdir -p "$rvm_repo_path"
772
785
  if [[ -n "$(echo $rvm_url | awk '/^git/')" ]] ; then
773
786
  if [[ -d "$rvm_ruby_repo_path/.git" ]] ; then
@@ -1155,7 +1168,7 @@ __rvm_manage_rubies() {
1155
1168
  local manage_result=0
1156
1169
 
1157
1170
  if [[ -n "$rubies_string" ]] ;then
1158
- for rvm_ruby_string in $(echo "$rubies_string" | tr ',' ' ') ; do
1171
+ for rvm_ruby_string in $(echo "$rubies_string" | \tr ',' ' ') ; do
1159
1172
  current_manage_ruby_string="$rvm_ruby_string"
1160
1173
  eval "__rvm_${rvm_action}_ruby"
1161
1174
  result="$?"
@@ -5,4 +5,4 @@ source "$rvm_scripts_path/initialize"
5
5
  # Take if a semicolon is encountered at the end of the
6
6
  # manpath env variable, man also processes the usual,
7
7
  # generated manpaths as well as the variable contents.
8
- export MANPATH="${rvm_man_path}:${MANPATH}"
8
+ export MANPATH="${MANPATH}:${rvm_man_path}"
@@ -14,9 +14,11 @@ if [[ "Linux" = "$system" ]] ; then
14
14
  rvm_pacman_binary="$(command -v pacman)"
15
15
  rvm_yum_binary="$(command -v yum)"
16
16
 
17
+ printf "\n $item NOTE: MRI stands for Matz's Ruby Interpreter (1.8.X, 1.9.X), ree stands for Ruby Enterprise Edition and rbx stands for Rubinius.\n\n"
17
18
  printf "\n $item curl is required.\n"
18
19
  printf "\n $item patch is required (for ree, some ruby head's).\n"
19
20
  printf "\n $item If you wish to install rbx and/or any MRI head (eg. 1.9.2-head) then you must install and use rvm 1.8.7 first.\n"
21
+
20
22
  if [[ ! -z "$rvm_aptitude_binary" ]] ; then
21
23
  printf "\n $item For JRuby (if you wish to use it) you will need:"
22
24
  printf "\n $ aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk"
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env bash
2
+
3
+ source "$rvm_scripts_path/base"
4
+
5
+ usage() {
6
+ echo "Usage: rvm repair {symlinks,environments,archives,all}" >&2
7
+ return 1
8
+ }
9
+
10
+ # Removes stale symlinks in $rvm_bin_path, likely
11
+ # related to wrappers.
12
+ repair_symlinks() {
13
+ __rvm_pushpop "$rvm_bin_path"
14
+ for executable_name in $(\find . -type l); do
15
+ [[ -e "$executable_name" || "$(readlink "$executable_name")" != "$rvm_wrappers_path/"* ]] && continue
16
+ if [[ -f "$executable_name" ]] ; then
17
+ $rvm_scripts_path/log "info" "Removing stale symlink from $(basename "$executable_name")"
18
+ rm -f "$executable_name"
19
+ fi
20
+ done; unset executable_name
21
+ __rvm_pushpop
22
+ }
23
+
24
+ # Regenerates each symlink file.
25
+ repair_environments() {
26
+ for environment_name in $(\ls "$rvm_environments_path"); do
27
+ [[ -L "$rvm_environments_path/$environment_name" ]] && continue
28
+ $rvm_scripts_path/log "info" "Regenerating environment file for '$environment_name'"
29
+ [[ -f "$rvm_environments_path/$environment_name" ]] && rm -f "$rvm_environments_path/$environment_name"
30
+ (source "$rvm_scripts_path/base"; __rvm_become "$environment_name"; __rvm_ensure_has_enviroment_files)
31
+ done; unset environment_name
32
+ }
33
+
34
+ # Removes archives that have incorrect md5 sums.
35
+ repair_archives() {
36
+ for archive_file in $(\ls "$rvm_archives_path"); do
37
+ [[ -f "$rvm_archives_path/$archive_file" ]] || continue
38
+ local stored_md5sum="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive_file" | head -n1)"
39
+ if [[ -n "$stored_md5sum" ]] && ! $rvm_scripts_path/md5 "$rvm_archives_path/$archive_file" "$stored_md5sum" ; then
40
+ $rvm_scripts_path/log "info" "Removing archive for '$archive_file' - Incorrect md5 checksum."
41
+ rm -rf "$rvm_archives_path/$archive_file"
42
+ fi
43
+ done; unset archive_file
44
+ }
45
+
46
+ repair_all() {
47
+ repair_symlinks
48
+ repair_archives
49
+ repair_environments
50
+ $rvm_scripts_path/log "info" "All items repaired."
51
+ }
52
+
53
+ if [[ -z "$1" ]]; then
54
+ usage
55
+ exit $?
56
+ fi
57
+
58
+ case "$1" in
59
+ all) repair_all ;;
60
+ symlinks) repair_symlinks ;;
61
+ environments) repair_environments ;;
62
+ archives) repair_archives;;
63
+ *) usage ;;
64
+ esac
65
+
66
+ exit $?