rvm 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,11 +4,11 @@ declare rvm_verbose_flag=${rvm_verbose_flag:-0}
4
4
  declare rvm_hook=${rvm_hook:-""}
5
5
 
6
6
  if [[ -n "$rvm_hook" ]] ; then
7
- if [[ -s "$rvm_hooks_path/$rvm_hook" ]] ; then
7
+ if [[ -s "$rvm_path/hooks/$rvm_hook" ]] ; then
8
8
  if [[ ${rvm_verbose_flag:-0} -gt 0 || ${rvm_debug_flag:-0} -gt 0 ]] ; then
9
9
  "$rvm_path/scripts/log" "info" "running hook $rvm_hook"
10
10
  fi
11
- source "$rvm_hooks_path/$rvm_hook"
11
+ source "$rvm_path/hooks/$rvm_hook"
12
12
  fi
13
13
  fi
14
14
  unset rvm_hook
@@ -125,9 +125,9 @@ $(__rvm_version)
125
125
  done
126
126
 
127
127
  if [[ "$rvm_selfcontained" = "0" ]] ; then
128
- debug_files="$rvm_config_path/alias $rvm_config_path/system $rvm_config_path/db /etc/rvmrc /etc/gemrc"
128
+ debug_files="$rvm_path/config/alias $rvm_path/config/system $rvm_path/config/db /etc/rvmrc /etc/gemrc"
129
129
  else
130
- debug_files="$rvm_config_path/alias $rvm_config_path/system $rvm_config_path/db $HOME/.rvmrc $HOME/.gemrc"
130
+ debug_files="$rvm_path/config/alias $rvm_path/config/system $rvm_path/config/db $HOME/.rvmrc $HOME/.gemrc"
131
131
  fi
132
132
 
133
133
  for file_name in $(echo $debug_files); do
@@ -152,21 +152,32 @@ sections="${args// /}"
152
152
  all_sections="system rvm ruby homes binaries environment"
153
153
 
154
154
  if "$rvm_path/scripts/match" "$all_sections debug" "${ruby_strings/,*/}" ; then
155
+
155
156
  sections="$ruby_strings"
156
157
  ruby_strings=""
158
+
157
159
  fi
158
160
 
159
161
  if [[ -z "${sections// /}" ]] ; then sections="$all_sections" ; fi
160
162
 
161
163
  if [[ -z "$ruby_strings" ]] ; then
164
+
162
165
  printf "\n$(__rvm_environment_identifier):\n"
166
+
163
167
  info_sections
168
+
164
169
  else
170
+
165
171
  for ruby_string in $(printf ${ruby_strings//,/ }) ; do
172
+
166
173
  __rvm_become "$ruby_string"
174
+
167
175
  printf "\n$(__rvm_environment_identifier):\n"
176
+
168
177
  info_sections
178
+
169
179
  done
180
+
170
181
  fi
171
182
 
172
183
  exit 0
@@ -16,33 +16,14 @@ if [[ ${rvm_selfcontained:-1} -eq 0 ]] ; then
16
16
  rvm_man_path="${rvm_man_path:-"${rvm_prefix}share/man"}"
17
17
  rvm_rc_files="${rvm_rc_files:-"/etc/profile /etc/zshenv"}"
18
18
  else
19
- rvm_man_path="${rvm_man_path:-"$rvm_path/man"}"
20
19
  rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
20
+ rvm_man_path="${rvm_man_path:-"$rvm_path/man"}"
21
21
  rvm_rc_files="${rvm_rc_files:-"$HOME/.bash_profile $HOME/.bashrc $HOME/.zshenv"}"
22
22
  fi
23
23
 
24
24
  [[ -n "${rvm_archflags:-""}" ]] && rvm_make_flags_flag=1
25
25
 
26
- rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
27
- rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
28
- rvm_repo_path="${rvm_repo_path:-"$rvm_path/repos"}"
29
- rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
30
- rvm_docs_path="${rvm_docs_path:-"$rvm_path/docs"}"
31
-
32
- rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}" # Leave this one in global, need to override for system installs (for now).
33
-
34
- rvm_gems_cache_path="${rvm_gems_cache_path:-"$rvm_gems_path/cache"}"
35
- rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
36
- rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
37
- rvm_environments_path="${rvm_environments_path:-"$rvm_path/environments"}"
38
- rvm_wrappers_path="${rvm_wrappers_path:-"$rvm_path/wrappers"}"
39
- rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
40
-
41
- rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
42
- rvm_usr_path="${rvm_usr_path:-"$rvm_path/usr"}"
43
-
44
- rvm_project_rvmrc="${rvm_project_rvmrc:-1}"
45
- rvm_project_rvmrc_default="${rvm_project_rvmrc_default:-0}"
26
+ rvm_gems_cache_path="${rvm_gems_cache_path:-"${rvm_gems_path:-"$rvm_path/gems"}/cache"}"
46
27
 
47
- export rvm_path rvm_rubies_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_repo_path rvm_selfcontained
28
+ export rvm_path rvm_bin_path rvm_gems_cache_path rvm_gemset_separator rvm_selfcontained
48
29
 
@@ -194,9 +194,6 @@ question="\n<?>"
194
194
  cwd="$PWD"
195
195
 
196
196
  source_path="${source_path:-$cwd}"
197
- rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
198
- rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
199
- rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
200
197
 
201
198
  if [[ "$rvm_selfcontained" = "0" ]] ; then
202
199
  rvm_bin_path="${rvm_bin_path:-"${rvm_prefix}bin"}"
@@ -209,9 +206,6 @@ else
209
206
  fi
210
207
 
211
208
  rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
212
- rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
213
- rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
214
- rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
215
209
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
216
210
 
217
211
  printf "
@@ -230,7 +224,9 @@ else
230
224
 
231
225
  fi
232
226
 
233
- for directory in "$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" ; do
227
+ directories=( "${rvm_archives_path:-"$rvm_path/archives"}" "${rvm_src_path:-"$rvm_path/src"}" "${rvm_log_path:-"$rvm_path/log"}" "$rvm_bin_path" "${rvm_gems_path:-"$rvm_path/gems"}" "${rvm_rubies_path:-"$rvm_path/rubies"}" "$rvm_path/config" "${rvm_tmp_path:-"$rvm_path/tmp"}" )
228
+
229
+ for directory in "${directories[@]}" ; do
234
230
 
235
231
  if [[ ! -d "$directory" ]] ; then
236
232
 
@@ -240,7 +236,9 @@ for directory in "$rvm_archives_path" "$rvm_src_path" "$rvm_log_path" "$rvm_bin_
240
236
 
241
237
  done
242
238
 
243
- for file in README LICENCE ; do
239
+ files=(README LICENCE)
240
+
241
+ for file in "${files[@]}"; do
244
242
 
245
243
  cp -f "$source_path/$file" "$rvm_path/"
246
244
 
@@ -265,8 +263,8 @@ for dir_name in config scripts examples lib hooks help patches; do
265
263
 
266
264
  done
267
265
 
268
- if [[ ! -s "$rvm_config_path/user" ]] ; then
269
- echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_config_path/user"
266
+ if [[ ! -s "$rvm_path/config/user" ]] ; then
267
+ echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_path/config/user"
270
268
  fi
271
269
 
272
270
  scripts=(monitor match log install color db fetch log set package)
@@ -281,15 +279,17 @@ done
281
279
  # Bin Scripts
282
280
  #
283
281
  # Cleanse and purge...
284
- for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
282
+ files=(rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby)
283
+
284
+ for file in "${files[@]}" ; do
285
285
 
286
286
  rm -f "$rvm_bin_path/$file"
287
287
 
288
- cp -f "$source_path/binscripts/$file" $rvm_bin_path/
288
+ cp -f "$source_path/binscripts/$file" "${rvm_bin_path:-"$rvm_path/bin"}/"
289
289
 
290
290
  done
291
291
 
292
- chmod +x "$rvm_bin_path"/* # TODO: this is quite suboptimal.
292
+ chmod +x "${rvm_bin_path:-"$rvm_path/bin"}"/* # TODO: this is quite suboptimal.
293
293
 
294
294
  #
295
295
  # RC Files
@@ -389,17 +389,15 @@ fi
389
389
  #
390
390
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
391
391
  #
392
- rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
393
-
394
- mkdir -p "$rvm_rubies_path/"
392
+ mkdir -p "${rvm_rubies_path:-"$rvm_path/rubies"}/"
395
393
 
396
394
  for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do
397
395
 
398
396
  if [[ -d "$ruby" ]] ; then
399
397
 
400
- mv "$ruby" "$rvm_rubies_path/"
398
+ mv "$ruby" "${rvm_rubies_path:-"$rvm_path/rubies"}/"
401
399
 
402
- new_path="$rvm_rubies_path/$(basename $ruby)"
400
+ new_path="${rvm_rubies_path:-"$rvm_path/rubies"}/$(basename $ruby)"
403
401
 
404
402
  for file in gem rake ; do
405
403
 
@@ -468,9 +466,9 @@ for gemset in "$rvm_path"/gems/*\@ ; do
468
466
  done
469
467
 
470
468
  # Move from legacy defaults to the new, alias based system.
471
- if [[ -s "$rvm_config_path/default" ]]; then
469
+ if [[ -s "$rvm_path/config/default" ]]; then
472
470
 
473
- original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator:-"@"}#")")"
471
+ original_version="$(basename "$(grep GEM_HOME "$rvm_path/config/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator:-"@"}#")")"
474
472
 
475
473
  if [[ -n "$original_version" ]]; then
476
474
 
@@ -478,7 +476,7 @@ if [[ -s "$rvm_config_path/default" ]]; then
478
476
 
479
477
  fi ; unset original_version
480
478
 
481
- rm -rf "$rvm_config_path/default"
479
+ rm -rf "$rvm_path/config/default"
482
480
 
483
481
  fi
484
482
 
@@ -487,11 +485,11 @@ fi
487
485
  #
488
486
  printf "\n Correct permissions for base binaries in $rvm_bin_path..."
489
487
 
490
- mkdir -p "$rvm_bin_path"
488
+ mkdir -p "${rvm_bin_path:-"$rvm_path/bin"}"
491
489
 
492
490
  for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
493
491
 
494
- [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
492
+ [[ -s "${rvm_bin_path:-"$rvm_path/bin"}/$file" ]] && chmod +x "${rvm_bin_path:-"$rvm_path/bin"}/$file"
495
493
 
496
494
  done
497
495
 
@@ -32,7 +32,7 @@ list_gemsets() {
32
32
 
33
33
  printf "\nrvm gemsets\n"
34
34
 
35
- versions=($(builtin cd "$rvm_gems_path/" ; find . -maxdepth 1 -mindepth 1 -type d -print 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
35
+ versions=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}/" ; find . -maxdepth 1 -mindepth 1 -type d -print 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
36
36
 
37
37
  for version in "${versions[@]//.\/}" ; do
38
38
 
@@ -41,13 +41,13 @@ list_gemsets() {
41
41
  [[ "$all_rubies" != *"$ruby_version_name"* ]] && continue
42
42
 
43
43
  if echo "$version" | grep -q '^jruby-' ; then
44
- string="[ $("$rvm_rubies_path/$ruby_version_name/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
44
+ string="[ $("$rvm_path/rubies/$ruby_version_name/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
45
45
 
46
46
  elif [[ -n "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
47
47
  string="[ x86_64 ]"
48
48
 
49
49
  else
50
- string="[ $(file "$rvm_rubies_path/$ruby_version_name/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
50
+ string="[ $(file "$rvm_path/rubies/$ruby_version_name/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
51
51
  fi
52
52
 
53
53
  printf "\n"
@@ -67,15 +67,15 @@ list_gemsets() {
67
67
 
68
68
  done
69
69
 
70
- if [[ -f "$rvm_config_path/default" && -s "$rvm_config_path/default" ]] ; then
70
+ if [[ -f "$rvm_path/config/default" && -s "$rvm_path/config/default" ]] ; then
71
71
 
72
- version=$(grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n1 | awk -F"'" '{print $2}' | xargs basename --)
72
+ version=$(grep 'MY_RUBY_HOME' "$rvm_path/config/default" | head -n1 | awk -F"'" '{print $2}' | xargs basename --)
73
73
 
74
74
  if [[ -n "$version" ]] ; then
75
75
 
76
76
  printf "\nDefault Ruby (for new shells)\n"
77
77
 
78
- string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
78
+ string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
79
79
 
80
80
  if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
81
81
 
@@ -102,7 +102,7 @@ list_default() {
102
102
  "$rvm_path/scripts/alias" show default 2>/dev/null | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}' | xargs basename --
103
103
 
104
104
  else
105
- if [[ -L "$rvm_rubies_path/default" ]]; then
105
+ if [[ -L "$rvm_path/rubies/default" ]]; then
106
106
 
107
107
  version=$("$rvm_path/scripts/alias" show default 2>/dev/null | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}' | xargs basename --)
108
108
 
@@ -110,7 +110,7 @@ list_default() {
110
110
 
111
111
  printf "\nDefault Ruby (for new shells)\n"
112
112
 
113
- string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
113
+ string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
114
114
 
115
115
  if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
116
116
 
@@ -148,7 +148,7 @@ list_ruby_svn_tags() {
148
148
  list_strings() {
149
149
 
150
150
  (
151
- cd "$rvm_rubies_path"
151
+ cd "$rvm_path/rubies"
152
152
 
153
153
  find . -maxdepth 1 -mindepth 1 -type d | sed -e 's#./##g'
154
154
  )
@@ -163,7 +163,7 @@ list_gemset_strings() {
163
163
 
164
164
  all_rubies="$(list_strings)"
165
165
 
166
- gemsets=($(builtin cd "$rvm_gems_path" ; find . -maxdepth 1 -mindepth 1 -type d 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort))
166
+ gemsets=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}" ; find . -maxdepth 1 -mindepth 1 -type d 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort))
167
167
 
168
168
  for gemset in "${gemsets[@]//.\/}" ; do
169
169
 
@@ -180,7 +180,7 @@ list_gemset_strings() {
180
180
  # This is meant to be used with scripting.
181
181
  list_known_strings() {
182
182
 
183
- sed -e 's/#.*$//g' -e 's#\[##g' -e 's#\]##g' < "$rvm_config_path/known" | sort -r | uniq
183
+ sed -e 's/#.*$//g' -e 's#\[##g' -e 's#\]##g' < "$rvm_path/config/known" | sort -r | uniq
184
184
 
185
185
  return $?
186
186
  }
@@ -196,11 +196,11 @@ list_known() {
196
196
 
197
197
  if [[ ${rvm_interactive_flag:-0} -eq 0 ]] ; then
198
198
 
199
- cat "$rvm_config_path/known"
199
+ cat "$rvm_path/config/known"
200
200
 
201
201
  else
202
202
 
203
- less "$rvm_config_path/known"
203
+ less "$rvm_path/config/known"
204
204
 
205
205
  fi
206
206
 
@@ -209,7 +209,7 @@ list_known() {
209
209
 
210
210
  list_rubies_strings() {
211
211
 
212
- ( builtin cd "$rvm_rubies_path" ; find -maxdepth 0 -type d | tail -n+2 | xargs -n1 basename -- | __rvm_strip )
212
+ ( builtin cd "$rvm_path/rubies" ; find -maxdepth 0 -type d | tail -n+2 | xargs -n1 basename -- | __rvm_strip )
213
213
 
214
214
  return $?
215
215
  }
@@ -224,15 +224,15 @@ list_rubies() {
224
224
 
225
225
  printf "\nrvm rubies\n"
226
226
 
227
- rubies=($(builtin cd "$rvm_rubies_path/" ; find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
227
+ rubies=($(builtin cd "$rvm_path/rubies/" ; find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
228
228
 
229
229
  for version in "${rubies[@]//.\/}" ; do
230
230
 
231
- [[ ! -x "$rvm_rubies_path/$version/bin/ruby" ]] && continue
231
+ [[ ! -x "$rvm_path/rubies/$version/bin/ruby" ]] && continue
232
232
 
233
233
  if echo "$version" | grep -q '^jruby-' ; then
234
234
 
235
- string="[ $("$rvm_rubies_path/$version/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
235
+ string="[ $("$rvm_path/rubies/$version/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
236
236
 
237
237
  elif [[ ! -z "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
238
238
 
@@ -240,7 +240,7 @@ list_rubies() {
240
240
 
241
241
  else
242
242
 
243
- string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
243
+ string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
244
244
  fi
245
245
 
246
246
  printf "\n"
@@ -261,15 +261,15 @@ list_rubies() {
261
261
 
262
262
  done
263
263
 
264
- if [[ -f "$rvm_config_path/default" ]] && [[ -s "$rvm_config_path/default" ]] ; then
264
+ if [[ -f "$rvm_path/config/default" ]] && [[ -s "$rvm_path/config/default" ]] ; then
265
265
 
266
- version=$(grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n 1 | awk -F"'" '{print $2}' | xargs basename --)
266
+ version=$(grep 'MY_RUBY_HOME' "$rvm_path/config/default" | head -n 1 | awk -F"'" '{print $2}' | xargs basename --)
267
267
 
268
268
  if [[ -n "$version" ]] ; then
269
269
 
270
270
  printf "Default Ruby (for new shells)\n"
271
271
 
272
- string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
272
+ string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
273
273
 
274
274
  if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
275
275
  printf " $(tput setaf 2)$version$(tput sgr0) $string\n"
@@ -16,7 +16,8 @@ if [[ ${rvm_pretty_print_flag:-0} -eq 0 ]] ; then
16
16
  fi
17
17
 
18
18
  case "$level" in
19
- debug|info|warn) printf "$message\n" ;;
19
+ info) printf "${message#*: }\n" ;;
20
+ debug|warn) printf "$message\n" ;;
20
21
  error|fail) printf "$message\n" >&2 ;;
21
22
  *) printf "$message"
22
23
  esac
@@ -59,13 +59,18 @@ __rvm_current_patch_names() {
59
59
 
60
60
  __rvm_apply_patches() {
61
61
 
62
- local patches patch_name result patch_level_separator patch_fuzziness patch_level source_directory full_patch_path
62
+ local result patches patch_name patch_level_separator patch_fuzziness patch_level source_directory full_patch_path
63
63
 
64
64
  result=0
65
65
  patch_level_separator="%"
66
66
  patch_fuzziness="25"
67
67
  patch_level=1
68
- source_directory="${1:-"$rvm_ruby_src_path"}"
68
+
69
+ source_directory="${1:-""}"
70
+
71
+ if [[ -z "$source_directory" ]] ; then
72
+ source_directory="${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
73
+ fi
69
74
 
70
75
  (
71
76
  builtin cd "$source_directory"
@@ -107,7 +112,7 @@ __rvm_apply_patches() {
107
112
 
108
113
  __rvm_install_source() {
109
114
 
110
- local directory configure_parameters db_configure_flags
115
+ local result directory configure_parameters db_configure_flags
111
116
 
112
117
  [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] && __rvm_select
113
118
 
@@ -115,13 +120,14 @@ __rvm_install_source() {
115
120
  *-head) __rvm_ensure_has_18_compat_ruby || return 1 ;;
116
121
  esac
117
122
 
118
- "$rvm_path/scripts/log" "info" "\nInstalling Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)...\n"
123
+ "$rvm_path/scripts/log" "info" \
124
+ "Installing Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)...\n"
119
125
 
120
- builtin cd "$rvm_src_path"
126
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}"
121
127
 
122
128
  if [[ ${rvm_force_flag:-0} -eq 1 ]] ; then
123
129
 
124
- for directory in "$rvm_ruby_home" "$rvm_ruby_src_path" ; do
130
+ for directory in "$rvm_ruby_home" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" ; do
125
131
 
126
132
  if [[ -d "$directory" ]] ; then
127
133
  rm -rf "$directory"
@@ -141,7 +147,7 @@ __rvm_install_source() {
141
147
  return $result
142
148
  fi
143
149
 
144
- builtin cd "$rvm_ruby_src_path"
150
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
145
151
 
146
152
  result=$? ; if [[ "$result" -gt 0 ]] ; then
147
153
  "$rvm_path/scripts/log" "error" \
@@ -164,7 +170,7 @@ __rvm_install_source() {
164
170
  return $result
165
171
  fi
166
172
 
167
- if [[ -z "${rvm_ruby_configure:-""}" && ! -s "$rvm_ruby_src_path/configure" ]] ; then
173
+ if [[ -z "${rvm_ruby_configure:-""}" && ! -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/configure" ]] ; then
168
174
 
169
175
  if command -v autoconf > /dev/null ; then
170
176
 
@@ -199,7 +205,7 @@ __rvm_install_source() {
199
205
  # to point to an expanded path.
200
206
  if [[ "${rvm_ruby_string:-""}" = "ruby-1.9.2-head" ]] ; then
201
207
 
202
- local compatible_baseruby="$rvm_wrappers_path/$(__rvm_18_compat_ruby)/ruby"
208
+ local compatible_baseruby="$rvm_path/wrappers/$(__rvm_18_compat_ruby)/ruby"
203
209
 
204
210
  if [[ -x "$compatible_baseruby" ]] ; then
205
211
  configure_parameters="--with-baseruby=$compatible_baseruby"
@@ -325,9 +331,9 @@ __rvm_install_ruby() {
325
331
  return $result
326
332
  fi
327
333
 
328
- mv "$rvm_archives_path/macruby_nightly-latest.pkg" "$rvm_archives_path/macruby_nightly.pkg"
334
+ mv "${rvm_archives_path:-"$rvm_path/archives"}/macruby_nightly-latest.pkg" "$rvm_archives_path/macruby_nightly.pkg"
329
335
 
330
- __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '$rvm_archives_path/macruby_nightly.pkg' -target '/'"
336
+ __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '${rvm_archives_path:-"$rvm_path/archives"}/macruby_nightly.pkg' -target '/'"
331
337
 
332
338
  mkdir -p "$rvm_ruby_home/bin"
333
339
 
@@ -347,13 +353,13 @@ __rvm_install_ruby() {
347
353
  return $result
348
354
  fi
349
355
 
350
- mkdir -p $rvm_ruby_src_path
356
+ mkdir -p ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string
351
357
 
352
- unzip -o -j "$rvm_archives_path/$rvm_ruby_package_file" "MacRuby ${rvm_ruby_version}/MacRuby ${rvm_ruby_version}.pkg" -d "$rvm_ruby_src_path"
358
+ unzip -o -j "${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file" "MacRuby ${rvm_ruby_version}/MacRuby ${rvm_ruby_version}.pkg" -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
353
359
 
354
- mv "$rvm_ruby_src_path/MacRuby ${rvm_ruby_version}.pkg" "$rvm_ruby_src_path/$rvm_ruby_string.pkg"
360
+ mv "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/MacRuby ${rvm_ruby_version}.pkg" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/$rvm_ruby_string.pkg"
355
361
 
356
- __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '$rvm_ruby_src_path/$rvm_ruby_string.pkg' -target '/'"
362
+ __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/$rvm_ruby_string.pkg' -target '/'"
357
363
 
358
364
  mkdir -p "$rvm_ruby_home/bin"
359
365
  fi
@@ -386,7 +392,7 @@ RubyWrapper
386
392
  fi
387
393
 
388
394
  if [[ "$binary_name" = "ruby" ]] ; then
389
- echo "$ruby_wrapper" > "$rvm_bin_path/$rvm_ruby_string"
395
+ echo "$ruby_wrapper" > "${rvm_bin_path:-"$rvm_bin_path/bin"}/$rvm_ruby_string"
390
396
  fi
391
397
  done ; unset binaries
392
398
 
@@ -405,9 +411,9 @@ RubyWrapper
405
411
 
406
412
  "$rvm_path/scripts/log" "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
407
413
 
408
- builtin cd "$rvm_src_path"
414
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}"
409
415
 
410
- if [[ ${rvm_force_flag:-0} -eq 0 && -d "$rvm_ruby_src_path" && ! -x "$rvm_ruby_src_path/installer" ]] ; then
416
+ if [[ ${rvm_force_flag:-0} -eq 0 && -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" && ! -x "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/installer" ]] ; then
411
417
 
412
418
  "$rvm_path/scripts/log" \
413
419
  "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
@@ -426,9 +432,9 @@ RubyWrapper
426
432
  return $result
427
433
  fi
428
434
 
429
- rm -rf "$rvm_ruby_src_path"
435
+ rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
430
436
 
431
- __rvm_run "extract" "gunzip < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C $rvm_src_path" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
437
+ __rvm_run "extract" "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
432
438
  result=$?
433
439
 
434
440
  if [[ "$result" -gt 0 ]] ; then
@@ -437,10 +443,10 @@ RubyWrapper
437
443
  return $result
438
444
  fi
439
445
 
440
- mv "$rvm_src_path/$rvm_ruby_package_file" "$rvm_ruby_src_path"
446
+ mv "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_package_file" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
441
447
  fi
442
448
 
443
- builtin cd "$rvm_ruby_src_path"
449
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
444
450
 
445
451
  # wait, what? v v v TODO: Investigate line smell.
446
452
  mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
@@ -455,7 +461,7 @@ RubyWrapper
455
461
 
456
462
  __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
457
463
 
458
- __rvm_apply_patches "$rvm_ruby_src_path/source"
464
+ __rvm_apply_patches "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/source"
459
465
  result=$?
460
466
 
461
467
  if [[ "$result" -gt 0 ]] ; then
@@ -464,7 +470,7 @@ RubyWrapper
464
470
  return $result
465
471
  fi
466
472
 
467
- __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_configure_flags" "$rvm_ruby_string - #installing "
473
+ __rvm_run "install" "./installer -a $rvm_path/rubies/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_configure_flags" "$rvm_ruby_string - #installing "
468
474
  result=$?
469
475
 
470
476
  if [[ "$result" -gt 0 ]] ; then
@@ -526,7 +532,7 @@ RubyWrapper
526
532
  return $result
527
533
  fi
528
534
  __rvm_run "extract" \
529
- "gunzip < \"$rvm_archives_path/$(basename $rvm_ruby_package_file)\" | tar xf - -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
535
+ "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$(basename $rvm_ruby_package_file)\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}" "Extracting $rvm_ruby_package_file ..."
530
536
  result=$?
531
537
 
532
538
  if [[ "$result" -gt 0 ]] ; then
@@ -536,12 +542,12 @@ RubyWrapper
536
542
  fi
537
543
 
538
544
  # Remove the left over folder first.
539
- rm -rf "$rvm_ruby_src_path"
545
+ rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
540
546
 
541
- mv "$rvm_src_path/rubinius-${rvm_ruby_version}" "$rvm_ruby_src_path"
547
+ mv "${rvm_src_path:-"$rvm_path/src"}/rubinius-${rvm_ruby_version}" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
542
548
  else
543
549
  __rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
544
- #rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
550
+ #rvm_ruby_home="$rvm_path/rubies/$rvm_ruby_interpreter-$rvm_ruby_version"
545
551
  __rvm_fetch_from_github "rbx"
546
552
  result=$?
547
553
 
@@ -552,7 +558,7 @@ RubyWrapper
552
558
  fi
553
559
  fi
554
560
 
555
- builtin cd "$rvm_ruby_src_path"
561
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
556
562
 
557
563
  chmod +x ./configure
558
564
 
@@ -571,7 +577,7 @@ RubyWrapper
571
577
 
572
578
  rvm_configure_flags="${rvm_configure_flags:-"--skip-system"}"
573
579
 
574
- rvm_ruby_configure="$rvm_bin_path/$ruby configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_configure_flags" ; message="Configuring rbx"
580
+ rvm_ruby_configure="${rvm_bin_path:-"$rvm_path/bin"}/$ruby configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_configure_flags" ; message="Configuring rbx"
575
581
 
576
582
  if [[ "$rvm_llvm_flag" = "0" ]] ; then
577
583
  rvm_ruby_configure="$rvm_ruby_configure --disable-llvm"
@@ -592,9 +598,9 @@ RubyWrapper
592
598
  fi
593
599
 
594
600
  if [[ "$rvm_trace_flag" -eq 1 ]] ; then
595
- rvm_ruby_make="$rvm_wrappers_path/$ruby/rake install --trace" ; message="Compiling rbx (with --trace)"
601
+ rvm_ruby_make="$rvm_path/wrappers/$ruby/rake install --trace" ; message="Compiling rbx (with --trace)"
596
602
  else
597
- rvm_ruby_make="$rvm_wrappers_path/$ruby/rake install" ; message="Compiling rbx"
603
+ rvm_ruby_make="$rvm_path/wrappers/$ruby/rake install" ; message="Compiling rbx"
598
604
  fi
599
605
 
600
606
  __rvm_run "rake" "$rvm_ruby_make" "$message"
@@ -648,7 +654,7 @@ RubyWrapper
648
654
  printf "java must be installed and in your path in order to install JRuby." ; return 1
649
655
  fi
650
656
 
651
- builtin cd "$rvm_src_path"
657
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}"
652
658
 
653
659
  __rvm_fetch_ruby
654
660
  result=$?
@@ -659,7 +665,7 @@ RubyWrapper
659
665
  return $result
660
666
  fi
661
667
 
662
- builtin cd "$rvm_ruby_src_path"
668
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
663
669
 
664
670
  if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
665
671
  __rvm_run "ant.dist" "ant dist" "$rvm_ruby_string - #ant dist"
@@ -670,11 +676,11 @@ RubyWrapper
670
676
  case "$rvm_ruby_version" in
671
677
  1.3|1.2)
672
678
  __rvm_run "nailgun" \
673
- "builtin cd \"$rvm_ruby_src_path/tool/nailgun\" && make $rvm_make_flags" "Building Nailgun"
679
+ "builtin cd \"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/tool/nailgun\" && make $rvm_make_flags" "Building Nailgun"
674
680
  ;;
675
681
  *)
676
682
  __rvm_run "nailgun" \
677
- "builtin cd \"$rvm_ruby_src_path/tool/nailgun\" && ./configure --prefix=$rvm_ruby_home && make $rvm_make_flags" "Building Nailgun"
683
+ "builtin cd \"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/tool/nailgun\" && ./configure --prefix=$rvm_ruby_home && make $rvm_make_flags" "Building Nailgun"
678
684
  ;;
679
685
  esac
680
686
 
@@ -684,7 +690,7 @@ RubyWrapper
684
690
 
685
691
  rm -rf "$rvm_ruby_home"
686
692
 
687
- __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "$rvm_ruby_string - #installing to $rvm_ruby_home"
693
+ __rvm_run "install" "/bin/cp -Rf ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string $rvm_ruby_home" "$rvm_ruby_string - #installing to $rvm_ruby_home"
688
694
 
689
695
  (
690
696
  builtin cd "$rvm_ruby_home/bin/"
@@ -739,11 +745,11 @@ RubyWrapper
739
745
  return $result
740
746
  fi
741
747
 
742
- builtin cd "$rvm_src_path"
748
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}"
743
749
 
744
- if [[ ! -d "$rvm_src_path/$rvm_ruby_string" || ${rvm_force_flag:-0} -eq 1 ]] ; then
750
+ if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" || ${rvm_force_flag:-0} -eq 1 ]] ; then
745
751
 
746
- rm -rf "$rvm_src_path/$rvm_ruby_string/" "$rvm_src_path/$rvm_ruby_string/"
752
+ rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/"
747
753
 
748
754
  __rvm_fetch_ruby
749
755
  result=$?
@@ -757,7 +763,7 @@ RubyWrapper
757
763
 
758
764
  if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
759
765
 
760
- builtin cd "$rvm_ruby_src_path"
766
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
761
767
 
762
768
  rvm_gemstone_package_file="GemStone-$(\grep ^GEMSTONE version.txt | cut -f2 -d-).$(uname -sm | \tr ' ' '-')"
763
769
 
@@ -775,15 +781,15 @@ RubyWrapper
775
781
  return $result
776
782
  fi
777
783
 
778
- builtin cd "$rvm_src_path"
784
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}"
779
785
 
780
786
  if [[ -s "$rvm_ruby_package_file" ]] ; then
781
- mv "$rvm_ruby_package_file" "$rvm_ruby_src_path"
787
+ mv "$rvm_ruby_package_file" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
782
788
  fi
783
789
 
784
- builtin cd "$rvm_ruby_src_path"
790
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
785
791
 
786
- __rvm_run "gemstone.extract" "gunzip < \"$rvm_archives_path/${rvm_gemstone_package_file}.${rvm_archive_extension}\" | tar xf - -C $rvm_ruby_src_path"
792
+ __rvm_run "gemstone.extract" "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/${rvm_gemstone_package_file}.${rvm_archive_extension}\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
787
793
  result=$?
788
794
 
789
795
  if [[ "$result" -gt 0 ]] ; then
@@ -802,7 +808,7 @@ RubyWrapper
802
808
  rm -rf $rvm_ruby_home
803
809
  fi
804
810
 
805
- __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "Installing maglev to $rvm_ruby_home"
811
+ __rvm_run "install" "/bin/cp -Rf ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string $rvm_ruby_home" "Installing maglev to $rvm_ruby_home"
806
812
 
807
813
  (
808
814
  builtin cd "$rvm_ruby_home/bin/"
@@ -839,14 +845,14 @@ RubyWrapper
839
845
 
840
846
  if [[ ! -e ${rvm_ruby_home}/etc/conf.d/maglev.conf ]] ; then
841
847
  "$rvm_path/scripts/log" "info" "Creating default 'maglev' repository."
842
- "$rvm_wrappers_path/$compatible_ruby/rake" "stone:create[maglev]" >/dev/null 2>&1
848
+ "$rvm_path/wrappers/$compatible_ruby/rake" "stone:create[maglev]" >/dev/null 2>&1
843
849
  fi
844
850
 
845
851
  "$rvm_path/scripts/log" "info" "Generating maglev HTML documentation"
846
- "$rvm_wrappers_path/$compatible_ruby/rake" rdoc >/dev/null 2>&1
852
+ "$rvm_path/wrappers/$compatible_ruby/rake" rdoc >/dev/null 2>&1
847
853
 
848
854
  "$rvm_path/scripts/log" "info" "Generating smalltalk FFI."
849
- "$rvm_wrappers_path/$compatible_ruby/rake" stwrappers >/dev/null 2>&1
855
+ "$rvm_path/wrappers/$compatible_ruby/rake" stwrappers >/dev/null 2>&1
850
856
 
851
857
  unset compatible_ruby
852
858
 
@@ -890,14 +896,14 @@ RubyWrapper
890
896
 
891
897
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
892
898
 
893
- builtin cd "$rvm_ruby_src_path"
899
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
894
900
 
895
901
  compatible_ruby="$(__rvm_18_compat_ruby)"
896
902
 
897
- "$rvm_wrappers_path/$compatible_ruby/gem" install pathname2 --no-rdoc --no-ri
903
+ "$rvm_path/wrappers/$compatible_ruby/gem" install pathname2 --no-rdoc --no-ri
898
904
 
899
905
  # MONO_LIB=/Library/Frameworks/Mono.framework/Versions/current/lib/
900
- rvm_ruby_make="$rvm_wrappers_path/$compatible_ruby/rake MERLIN_ROOT=\"$rvm_ruby_src_path/Merlin/Main\" compile mono=1 configuration=release --trace"
906
+ rvm_ruby_make="$rvm_path/wrappers/$compatible_ruby/rake MERLIN_ROOT=\"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main\" compile mono=1 configuration=release --trace"
901
907
  __rvm_run "rake" "$rvm_ruby_make" "Building IronRuby..."
902
908
  unset compatible_ruby
903
909
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
@@ -905,26 +911,42 @@ RubyWrapper
905
911
  rm -rf "$rvm_ruby_home"/*
906
912
  mkdir -p "$rvm_ruby_home/bin" "$rvm_ruby_home/lib" "$rvm_ruby_home/lib/ruby" "$rvm_ruby_home/lib/IronRuby"
907
913
 
908
- cp -r "$rvm_ruby_src_path/Merlin/Main/Bin/mono_release"/* "$rvm_ruby_home/bin/"
909
- cp -r "$rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Scripts/bin"/* "$rvm_ruby_home/bin/"
910
- cp -r "$rvm_ruby_src_path/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby"/* "$rvm_ruby_home/lib/ruby"
911
- cp -r "$rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Libs"/* "$rvm_ruby_home/lib/IronRuby"
914
+ cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main/Bin/mono_release"/* "$rvm_ruby_home/bin/"
915
+ cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main/Languages/Ruby/Scripts/bin"/* "$rvm_ruby_home/bin/"
916
+ cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby"/* "$rvm_ruby_home/lib/ruby"
917
+ cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main/Languages/Ruby/Libs"/* "$rvm_ruby_home/lib/IronRuby"
912
918
  else
913
- "$rvm_path/scripts/log" "info" "Retrieving IronRuby"
919
+ "$rvm_path/scripts/log" "info" \
920
+ "Retrieving IronRuby"
914
921
 
915
- "$rvm_path/scripts/fetch" "$rvm_ruby_url" "$rvm_ruby_package_file"
916
- result=$? ; if [[ "$result" -gt 0 ]] ; then
917
- "$rvm_path/scripts/log" "error" "There has been an error while trying to fetch the source. Halting the installation." ; return $result
922
+ "$rvm_path/scripts/fetch" "$rvm_ruby_url" \
923
+ "$rvm_ruby_package_file"
924
+ result=$?
925
+
926
+ if [[ "$result" -gt 0 ]] ; then
927
+ "$rvm_path/scripts/log" "error" \
928
+ "There has been an error while trying to fetch the source. Halting the installation."
929
+ return $result
918
930
  fi
919
931
 
920
- mkdir -p "$rvm_ruby_src_path" "$rvm_ruby_home"
921
- unzip -o -d "${rvm_ruby_src_path}" "${rvm_archives_path}/${rvm_ruby_package_file}" >> "$rvm_ruby_log_path/extract.log" 2>> "$rvm_ruby_log_path/extract.error.log"
922
- result=$? ; if [[ "$result" -gt 1 ]] ; then
923
- "$rvm_path/scripts/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Halting the installation." ; return $result
932
+ mkdir -p "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" "$rvm_ruby_home"
933
+
934
+ unzip -o -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" \
935
+ "${rvm_archives_path:-"$rvm_path/archives"}/${rvm_ruby_package_file}" >> \
936
+ "${rvm_log_path:-"$rvm_path/log"}$rvm_ruby_string/extract.log" 2>> \
937
+ "${rvm_log_path:-"$rvm_path/log"}$rvm_ruby_string/extract.error.log"
938
+ result=$?
939
+
940
+ if [[ "$result" -gt 1 ]] ; then
941
+
942
+ "$rvm_path/scripts/log" "error" \
943
+ "There has been an error while trying to extract $rvm_ruby_package_file. Halting the installation."
944
+ return $result
945
+
924
946
  fi
925
947
 
926
948
  for dir in bin lib silverlight ; do
927
- cp -Rf "$rvm_src_path/$rvm_ruby_string/$dir" "$rvm_ruby_home/$dir"
949
+ cp -Rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/$dir" "$rvm_ruby_home/$dir"
928
950
  done
929
951
  fi
930
952
 
@@ -954,7 +976,9 @@ RubyWrapper
954
976
 
955
977
  builtin hash -r
956
978
 
957
- __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"
979
+ __rvm_run "gems.install" \
980
+ "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_global_gems_path\" $rvm_ruby_home/bin/gem install --no-rdoc --no-ri rake $rvm_gem_options" \
981
+ "Installing $rvm_gem_name to $dir"
958
982
  ;;
959
983
 
960
984
  mput|shyouhei)
@@ -969,12 +993,11 @@ RubyWrapper
969
993
 
970
994
  builtin hash -r
971
995
 
972
- rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
996
+ rvm_ruby_home="$rvm_path/rubies/$rvm_ruby_interpreter-$rvm_ruby_version"
973
997
 
974
998
  __rvm_fetch_from_github "mput" "trunk"
975
999
 
976
- __rvm_apply_patches
977
- result=$?
1000
+ __rvm_apply_patches ; result=$?
978
1001
 
979
1002
  if [[ "$result" -gt 0 ]] ; then
980
1003
  "$rvm_path/scripts/log" "error" \
@@ -982,7 +1005,7 @@ RubyWrapper
982
1005
  return $result
983
1006
  fi
984
1007
 
985
- if [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
1008
+ if [[ ! -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/configure" ]] ; then
986
1009
 
987
1010
  if command -v autoconf &> /dev/null ; then
988
1011
 
@@ -998,7 +1021,8 @@ RubyWrapper
998
1021
  if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
999
1022
 
1000
1023
  if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
1001
- "$rvm_path/scripts/log" "debug" "Skipping configure step, Makefile exists so configure must have already been run."
1024
+ "$rvm_path/scripts/log" "debug" \
1025
+ "Skipping configure step, Makefile exists so configure must have already been run."
1002
1026
  fi
1003
1027
 
1004
1028
  elif [[ -n "$rvm_ruby_configure" ]] ; then
@@ -1015,7 +1039,8 @@ RubyWrapper
1015
1039
  elif [[ -s ./configure ]] ; then
1016
1040
  local configure_command="./configure --prefix=$rvm_ruby_home $rvm_configure_flags"
1017
1041
 
1018
- __rvm_run "configure" "" "Configuring $rvm_ruby_string using $rvm_configure_flags, this may take a while depending on your cpu(s)..."
1042
+ __rvm_run "configure" "" \
1043
+ "Configuring $rvm_ruby_string using $rvm_configure_flags, this may take a while depending on your cpu(s)..."
1019
1044
  result=$?
1020
1045
 
1021
1046
  if [[ "$result" -gt 0 ]] ; then
@@ -1031,7 +1056,8 @@ RubyWrapper
1031
1056
 
1032
1057
  rvm_ruby_make=${rvm_ruby_make:-"make"}
1033
1058
 
1034
- __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while depending on your cpu(s)..."
1059
+ __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" \
1060
+ "Compiling $rvm_ruby_string, this may take a while depending on your cpu(s)..."
1035
1061
  result=$?
1036
1062
 
1037
1063
  if [[ "$result" -gt 0 ]] ; then
@@ -1051,7 +1077,8 @@ RubyWrapper
1051
1077
  return $result
1052
1078
  fi
1053
1079
 
1054
- "$rvm_path/scripts/log" "info" "Installation of $rvm_ruby_string is complete."
1080
+ "$rvm_path/scripts/log" "info" \
1081
+ "Installation of $rvm_ruby_string is complete."
1055
1082
 
1056
1083
  export GEM_HOME="$rvm_ruby_gem_home"
1057
1084
  export GEM_PATH="$rvm_ruby_gem_path"
@@ -1098,15 +1125,17 @@ RubyWrapper
1098
1125
  }
1099
1126
 
1100
1127
  __rvm_fetch_from_github() {
1101
- rm -rf "$rvm_ruby_src_path"
1128
+ local result
1129
+
1130
+ rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1102
1131
 
1103
- if [[ ! -d "$rvm_ruby_repo_path/.git" ]] ; then
1132
+ if [[ ! -d "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string/.git" ]] ; then
1104
1133
 
1105
- rm -rf "$rvm_ruby_repo_path"
1134
+ rm -rf "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1106
1135
 
1107
1136
  builtin cd "$rvm_home"
1108
1137
 
1109
- __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_url"
1138
+ __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_url ${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" "Cloning $rvm_ruby_repo_url"
1110
1139
  result=$?
1111
1140
 
1112
1141
  if [[ "$result" -gt 0 ]] ; then
@@ -1114,22 +1143,26 @@ __rvm_fetch_from_github() {
1114
1143
 
1115
1144
  "$rvm_path/scripts/log" "info" "Could not fetch $rvm_ruby_repo_url - trying $rvm_ruby_repo_http_url"
1116
1145
 
1117
- __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_http_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_http_url"
1146
+ __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_http_url ${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" "Cloning $rvm_ruby_repo_http_url"
1118
1147
  fi
1119
1148
  else
1120
1149
  local branch="${2:-"master"}"
1121
1150
 
1122
- builtin cd "$rvm_ruby_repo_path"
1151
+ builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1123
1152
 
1124
1153
  __rvm_run "$1.repo" "git pull origin $branch" "Pulling from origin $branch"
1125
1154
  fi
1126
1155
 
1127
- __rvm_run "$1.copy" "\\cp -R \"$rvm_ruby_repo_path\" \"$rvm_ruby_src_path\"" "Copying from repo to source..."
1156
+ __rvm_run "$1.copy" "\\cp -R \"${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string\" \"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string\"" "Copying from repo to source..."
1128
1157
 
1129
- builtin cd "$rvm_ruby_src_path"
1158
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1159
+
1160
+ return $?
1130
1161
  }
1131
1162
 
1132
1163
  __rvm_fetch_ruby() {
1164
+ local result
1165
+
1133
1166
  [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] && __rvm_select
1134
1167
 
1135
1168
  "$rvm_path/scripts/log" "info" "$rvm_ruby_string - #fetching "
@@ -1146,7 +1179,7 @@ __rvm_fetch_ruby() {
1146
1179
  rvm_archive_extension="${rvm_archive_extension:-tar.gz}"
1147
1180
  fi
1148
1181
 
1149
- if [[ ! -s "$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension" ]] ; then
1182
+ if [[ ! -s "${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension" ]] ; then
1150
1183
 
1151
1184
  case "$rvm_ruby_interpreter" in
1152
1185
  ruby)
@@ -1179,17 +1212,17 @@ __rvm_fetch_ruby() {
1179
1212
  fi
1180
1213
  fi
1181
1214
 
1182
- if [[ ! -d "$rvm_ruby_src_path" || ${rvm_force_flag:-0} -eq 1 ]] ; then
1215
+ if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" || ${rvm_force_flag:-0} -eq 1 ]] ; then
1183
1216
 
1184
- if [[ -d "$rvm_ruby_src_path" ]] ; then
1185
- rm -rf "$rvm_ruby_src_path" # Especially when forced, we want to ensure the destination is missing.
1217
+ if [[ -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" ]] ; then
1218
+ rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" # Especially when forced, we want to ensure the destination is missing.
1186
1219
  fi
1187
1220
 
1188
1221
  mkdir -p "/tmp/rvm_src_$$"
1189
1222
 
1190
1223
  case "$rvm_archive_extension" in
1191
1224
  tar.gz|tgz)
1192
- __rvm_run "extract" "gunzip < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
1225
+ __rvm_run "extract" "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1193
1226
  result=$?
1194
1227
 
1195
1228
  if [[ "$result" -gt 0 ]] ; then
@@ -1199,7 +1232,7 @@ __rvm_fetch_ruby() {
1199
1232
  fi
1200
1233
  ;;
1201
1234
  zip)
1202
- __rvm_run "extract" "unzip -q -o $rvm_archives_path/$rvm_ruby_package_file -d /tmp/rvm_src_$$"
1235
+ __rvm_run "extract" "unzip -q -o ${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file -d /tmp/rvm_src_$$"
1203
1236
  result=$?
1204
1237
 
1205
1238
  if [[ "$result" -gt 0 ]] ; then
@@ -1209,7 +1242,7 @@ __rvm_fetch_ruby() {
1209
1242
  fi
1210
1243
  ;;
1211
1244
  tar.bz2)
1212
- __rvm_run "extract" "bunzip2 < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
1245
+ __rvm_run "extract" "bunzip2 < \"${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1213
1246
  result=$?
1214
1247
 
1215
1248
  if [[ "$result" -gt 0 ]] ; then
@@ -1225,29 +1258,30 @@ __rvm_fetch_ruby() {
1225
1258
  ;;
1226
1259
  esac
1227
1260
 
1228
- mv "/tmp/rvm_src_$$/$(builtin cd /tmp/rvm_src_$$ ; ls)" "$rvm_ruby_src_path" ; rm -rf "/tmp/rvm_src_$$"
1261
+ mv "/tmp/rvm_src_$$/$(builtin cd /tmp/rvm_src_$$ ; ls)" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" ; rm -rf "/tmp/rvm_src_$$"
1229
1262
 
1230
- if [[ -n "${rvm_ruby_name:-""}" && -d "$rvm_src_path/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]] ; then
1231
- mv "$rvm_src_path/$(echo "$rvm_ruby_string" | sed -e 's/-n.*//')" "$rvm_ruby_src_path"
1263
+ if [[ -n "${rvm_ruby_name:-""}" && -d "${rvm_src_path:-"$rvm_path/src"}/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]] ; then
1264
+ mv "${rvm_src_path:-"$rvm_path/src"}/$(echo "$rvm_ruby_string" | sed -e 's/-n.*//')" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1232
1265
  fi
1233
1266
 
1234
- "$rvm_ruby_string - #extracted to $rvm_ruby_src_path"
1267
+ "$rvm_path/scripts/log" "info" \
1268
+ "$rvm_ruby_string - #extracted to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1235
1269
 
1236
1270
  else
1237
1271
  "$rvm_path/scripts/log" "info" \
1238
- "$rvm_ruby_string - #extracted to $rvm_ruby_src_path (already extracted)"
1272
+ "$rvm_ruby_string - #extracted to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string (already extracted)"
1239
1273
  fi
1240
1274
 
1241
1275
  return 0
1242
1276
  else
1243
1277
 
1244
- mkdir -p "$rvm_repo_path"
1278
+ mkdir -p "${rvm_repo_path:-"$rvm_path/repos"}"
1245
1279
 
1246
1280
  if [[ -n "$(echo "$rvm_ruby_url" | awk '/^git/')" ]] ; then
1247
1281
 
1248
- if [[ -d "$rvm_ruby_repo_path/.git" ]] ; then
1282
+ if [[ -d "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string/.git" ]] ; then
1249
1283
 
1250
- builtin cd "$rvm_ruby_repo_path"
1284
+ builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1251
1285
 
1252
1286
  if [[ -z "$rvm_ruby_revision" ]] ; then
1253
1287
 
@@ -1280,20 +1314,20 @@ __rvm_fetch_ruby() {
1280
1314
  fi
1281
1315
 
1282
1316
  else
1283
- rm -rf "$rvm_ruby_repo_path"
1317
+ rm -rf "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1284
1318
 
1285
1319
  rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/http:/}"
1286
1320
 
1287
1321
  "$rvm_path/scripts/log" "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
1288
1322
 
1289
- git clone --depth 1 "$rvm_ruby_repo_url" "$rvm_ruby_repo_path"
1323
+ git clone --depth 1 "$rvm_ruby_repo_url" "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1290
1324
  result=$?
1291
1325
 
1292
1326
  if [[ "$result" -gt 0 ]] ; then
1293
1327
  "$rvm_path/scripts/log" "info" \
1294
1328
  "cloning from $rvm_ruby_repo_url failed, now attempting to clone from $rvm_ruby_repo_http_url, this may take a while depending on your connection..."
1295
1329
 
1296
- git clone "$rvm_ruby_repo_http_url" "$rvm_ruby_repo_path"
1330
+ git clone "$rvm_ruby_repo_http_url" "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1297
1331
  result=$?
1298
1332
 
1299
1333
  if [[ "$result" -gt 0 ]] ; then
@@ -1334,9 +1368,9 @@ __rvm_fetch_ruby() {
1334
1368
  rvm_rev="-$rvm_ruby_revision"
1335
1369
  fi
1336
1370
 
1337
- if [[ -d "$rvm_ruby_repo_path/.svn" ]] ; then
1371
+ if [[ -d "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string/.svn" ]] ; then
1338
1372
 
1339
- builtin cd "$rvm_ruby_repo_path"
1373
+ builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1340
1374
 
1341
1375
  "$rvm_path/scripts/log" "info" "Updating ruby from $rvm_ruby_url"
1342
1376
 
@@ -1350,9 +1384,9 @@ __rvm_fetch_ruby() {
1350
1384
  __rvm_run "svn.checkout" "svn update -q ${rvm_rev/-r/-r }"
1351
1385
  fi
1352
1386
  else
1353
- rm -rf "$rvm_ruby_repo_path"
1387
+ rm -rf "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1354
1388
 
1355
- __rvm_run "svn.checkout" "svn checkout -q ${rvm_rev/-r/-r } $rvm_ruby_url $rvm_ruby_repo_path" "Downloading source from ${rvm_ruby_url}."
1389
+ __rvm_run "svn.checkout" "svn checkout -q ${rvm_rev/-r/-r } $rvm_ruby_url ${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" "Downloading source from ${rvm_ruby_url}."
1356
1390
  fi
1357
1391
  result=$?
1358
1392
 
@@ -1365,9 +1399,9 @@ __rvm_fetch_ruby() {
1365
1399
 
1366
1400
  "$rvm_path/scripts/log" "info" "Copying from repo to src path..."
1367
1401
 
1368
- rm -rf "$rvm_ruby_src_path"
1402
+ rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1369
1403
 
1370
- cp -R "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
1404
+ cp -R "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1371
1405
  fi
1372
1406
  }
1373
1407
 
@@ -1388,7 +1422,7 @@ __rvm_uninstall_ruby() {
1388
1422
 
1389
1423
  if [[ -n "${rvm_ruby_string:-""}" ]] ; then
1390
1424
 
1391
- for dir in "$rvm_rubies_path" ; do
1425
+ for dir in "$rvm_path/rubies" ; do
1392
1426
  if [[ -d "$dir/$rvm_ruby_string" ]] ; then
1393
1427
  "$rvm_path/scripts/log" "info" "Removing $dir/$rvm_ruby_string..."
1394
1428
 
@@ -1398,8 +1432,8 @@ __rvm_uninstall_ruby() {
1398
1432
  "$dir/$rvm_ruby_string has already been removed."
1399
1433
  fi
1400
1434
 
1401
- if [[ -e "$rvm_bin_path/$rvm_ruby_string" ]] ; then
1402
- rm -f "$rvm_bin_path/$rvm_ruby_string"
1435
+ if [[ -e "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string" ]] ; then
1436
+ rm -f "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string"
1403
1437
  fi
1404
1438
  done ; unset dir
1405
1439
 
@@ -1424,7 +1458,7 @@ __rvm_remove_ruby() {
1424
1458
 
1425
1459
  if [[ -n "${rvm_ruby_string:-""}" ]] ; then
1426
1460
 
1427
- for dir in $rvm_src_path $rvm_rubies_path ; do
1461
+ for dir in ${rvm_src_path:-"$rvm_path/src"} $rvm_path/rubies ; do
1428
1462
 
1429
1463
  if [[ -d $dir/$rvm_ruby_string ]] ; then
1430
1464
  "$rvm_path/scripts/log" "info" "Removing $dir/$rvm_ruby_string..."
@@ -1434,8 +1468,8 @@ __rvm_remove_ruby() {
1434
1468
  "$rvm_path/scripts/log" "info" "it seems that $dir/$rvm_ruby_string is already non existent."
1435
1469
  fi
1436
1470
 
1437
- if [[ -e "$rvm_bin_path/$rvm_ruby_string" ]] ; then
1438
- rm -f "$rvm_bin_path/$rvm_ruby_string"
1471
+ if [[ -e "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string" ]] ; then
1472
+ rm -f "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string"
1439
1473
  fi
1440
1474
 
1441
1475
  __rvm_check_default
@@ -1458,7 +1492,7 @@ __rvm_remove_gemsets() {
1458
1492
  if [[ ${rvm_gems_flag:-0} -eq 1 ]] ; then
1459
1493
  "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string gemsets..."
1460
1494
 
1461
- gemsets=($(builtin cd "${rvm_gems_path}"/ ; find . -maxdepth 1 -mindepth 1 -type d))
1495
+ gemsets=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}"/ ; find . -maxdepth 1 -mindepth 1 -type d))
1462
1496
 
1463
1497
  for gemset in "${gemsets[@]//.\/}" ; do
1464
1498
  if [[ -d "$gemset" ]] ; then
@@ -1487,7 +1521,7 @@ __rvm_remove_environments() {
1487
1521
 
1488
1522
  local environments environment
1489
1523
 
1490
- environments=($(find "$rvm_environments_path" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1524
+ environments=($(find "$rvm_path/environments" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1491
1525
 
1492
1526
  for environment in "${environments[@]}" ; do
1493
1527
  if [[ -d "$environment" ]] ; then
@@ -1503,7 +1537,7 @@ __rvm_remove_aliases() {
1503
1537
 
1504
1538
  local alias_name aliases
1505
1539
 
1506
- aliases=($(awk '/'$rvm_ruby_string'/' $rvm_config_path/alias | sed 's/=.*//'))
1540
+ aliases=($(awk '/'$rvm_ruby_string'/' "$rvm_path/config/alias" | sed 's/=.*//'))
1507
1541
 
1508
1542
  for alias_name in "${aliases[@]}" ; do
1509
1543
  # Remove from alias key-value store
@@ -1516,7 +1550,7 @@ __rvm_remove_archives() {
1516
1550
 
1517
1551
  "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string archives..."
1518
1552
 
1519
- rm -f "$rvm_archives_path/${rvm_ruby_package_file}.${rvm_archive_extension}"
1553
+ rm -f "${rvm_archives_path:-"$rvm_path/archives"}/${rvm_ruby_package_file}.${rvm_archive_extension}"
1520
1554
  fi
1521
1555
  }
1522
1556
 
@@ -1526,11 +1560,11 @@ __rvm_remove_binaries() {
1526
1560
  # Iterate over all binaries and check for symlinked wrappers etc.
1527
1561
  local binary_name binaries full_patch_path
1528
1562
 
1529
- binaries=($(find "$rvm_bin_path" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1563
+ binaries=($(find "${rvm_bin_path:-"$rvm_path/bin"}" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1530
1564
 
1531
1565
  for binary_name in "${binaries[@]}" ; do
1532
1566
 
1533
- full_binary_path="$rvm_bin_path/$binary_name"
1567
+ full_binary_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary_name"
1534
1568
 
1535
1569
  if [[ -L "$full_binary_path" ]] && "$rvm_path/scripts/match" "$(readlink "$full_binary_path")" "$rvm_ruby_string"; then
1536
1570
  rm -f "$full_binary_path"
@@ -1555,11 +1589,11 @@ __rvm_post_install() {
1555
1589
 
1556
1590
  for binary in "${binaries[@]}" ; do
1557
1591
 
1558
- if [[ -e "$rvm_ruby_home/bin/$binary" || -e "$rvm_ruby_src_path/bin/$binary" ]] ; then
1592
+ if [[ -e "$rvm_ruby_home/bin/$binary" || -e "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/$binary" ]] ; then
1559
1593
 
1560
- if [[ "$rvm_ruby_src_path" != "$rvm_ruby_home" && -f "$rvm_ruby_src_path/bin/$binary" ]] ; then
1594
+ if [[ "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" != "$rvm_ruby_home" && -f "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/$binary" ]] ; then
1561
1595
 
1562
- cp -f "$rvm_ruby_src_path/bin/$binary" "$rvm_ruby_home/bin/$binary"
1596
+ cp -f "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/$binary" "$rvm_ruby_home/bin/$binary"
1563
1597
 
1564
1598
  elif [[ -f "$rvm_ruby_gem_home/bin/$binary" ]] ; then
1565
1599
 
@@ -1603,13 +1637,14 @@ __rvm_generate_default_docs() {
1603
1637
 
1604
1638
  if [[ "$rvm_docs_flag" = "1" && "$rvm_ruby_interpreter" != "macruby" ]]; then
1605
1639
 
1606
- __rvm_run_with_env "docs.generate" "$rvm_ruby_string" "rvm docs generate-ri" "Attempting to generate ri documentation..."
1640
+ __rvm_run_with_env "docs.generate" "$rvm_ruby_string" \
1641
+ "rvm docs generate-ri" "Attempting to generate ri documentation..."
1607
1642
  fi
1608
1643
  }
1609
1644
 
1610
1645
  __rvm_rubygems_setup() {
1611
1646
 
1612
- local home path dir directory_name version_number ruby_lib_gem_path
1647
+ local result home path dir directory_name version_number ruby_lib_gem_path
1613
1648
 
1614
1649
  if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.9/')" ]] || [[ -n "$(echo "$rvm_ruby_interpreter" | awk '/^mput/')" ]] ; then
1615
1650
  install=0
@@ -1625,11 +1660,11 @@ __rvm_rubygems_setup() {
1625
1660
 
1626
1661
  if [[ "$install" -eq 0 ]] ; then
1627
1662
  # 1.9.X has it's own built-in gem command
1628
- __rvm_inject_ruby_shebang "$rvm_ruby_src_path/bin/gem"
1663
+ __rvm_inject_ruby_shebang "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/gem"
1629
1664
 
1630
1665
  __rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
1631
1666
 
1632
- cp "$rvm_ruby_src_path/bin/gem" "$rvm_ruby_home/bin/gem"
1667
+ cp "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/gem" "$rvm_ruby_home/bin/gem"
1633
1668
 
1634
1669
  home="$GEM_HOME" ; path="$GEM_PATH" # Save
1635
1670
 
@@ -1637,7 +1672,8 @@ __rvm_rubygems_setup() {
1637
1672
 
1638
1673
  export GEM_HOME="$dir" ; export GEM_PATH="$dir" ; export BUNDLE_PATH="$dir"
1639
1674
 
1640
- __rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "$rvm_ruby_string - updating #rubygems for $dir"
1675
+ __rvm_run "rubygems.update" \
1676
+ "$rvm_ruby_home/bin/gem update --system" "$rvm_ruby_string - updating #rubygems for $dir"
1641
1677
 
1642
1678
  done
1643
1679
 
@@ -1688,11 +1724,11 @@ __rvm_rubygems_setup() {
1688
1724
 
1689
1725
  # Sanity check... If setup.rb is missing from the rubygems source path,
1690
1726
  # something went wrong. Cleanup, aisle 3!
1691
- if [[ ! -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then
1692
- rm -rf "$rvm_src_path/$rvm_gem_package_name"
1727
+ if [[ ! -f "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name/setup.rb" ]]; then
1728
+ rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name"
1693
1729
  fi
1694
1730
 
1695
- if [[ ! -d "$rvm_src_path/$rvm_gem_package_name" ]] ; then
1731
+ if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name" ]] ; then
1696
1732
 
1697
1733
  "$rvm_path/scripts/log" "info" "Retrieving $rvm_gem_package_name"
1698
1734
 
@@ -1704,17 +1740,22 @@ __rvm_rubygems_setup() {
1704
1740
  "There has been an error while trying to fetch the source. Halting the installation." ; return $result
1705
1741
  fi
1706
1742
 
1707
- mkdir -p "$rvm_src_path/$rvm_gem_package_name"
1743
+ if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name" ]] ; then
1744
+ mkdir -p "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name"
1745
+ fi
1708
1746
 
1709
- __rvm_run "rubygems.extract" "gunzip < \"$rvm_archives_path/$rvm_gem_package_name.tgz\" | tar xf - -C $rvm_src_path" "Extracting $rvm_gem_package_name ..."
1747
+ __rvm_run "rubygems.extract" \
1748
+ "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$rvm_gem_package_name.tgz\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}" "Extracting $rvm_gem_package_name ..."
1710
1749
  fi
1711
1750
 
1712
- builtin cd "$rvm_src_path/$rvm_gem_package_name"
1751
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name"
1713
1752
 
1714
- __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"
1753
+ __rvm_run "rubygems.install" \
1754
+ "GEM_PATH="$rvm_ruby_gem_path:$rvm_ruby_global_gems_path" GEM_HOME=$rvm_ruby_gem_home BUNDLE_PATH=$rvm_ruby_gem_home $rvm_ruby_home/bin/ruby ${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name/setup.rb"
1715
1755
  result=$?
1716
1756
  if [[ $result -gt 0 ]] ; then
1717
- "$rvm_path/scripts/log" "warning" "$rvm_ruby_string - #warning Installation of rubygems $rvm_ruby_package_name did not complete successfully."
1757
+ "$rvm_path/scripts/log" "warning" \
1758
+ "$rvm_ruby_string - #warning Installation of rubygems $rvm_ruby_package_name did not complete successfully."
1718
1759
  fi
1719
1760
 
1720
1761
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
@@ -1739,12 +1780,12 @@ __rvm_rubygems_setup() {
1739
1780
 
1740
1781
  fi
1741
1782
 
1742
- if [[ -s "$rvm_ruby_src_path/bin/rdoc" ]] ; then
1743
- __rvm_inject_ruby_shebang "$rvm_ruby_src_path/bin/rdoc"
1783
+ if [[ -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rdoc" ]] ; then
1784
+ __rvm_inject_ruby_shebang "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rdoc"
1744
1785
  fi
1745
1786
 
1746
- if [[ -s "$rvm_ruby_src_path/bin/rake" ]] ; then
1747
- __rvm_inject_ruby_shebang "$rvm_ruby_src_path/bin/rake"
1787
+ if [[ -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rake" ]] ; then
1788
+ __rvm_inject_ruby_shebang "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rake"
1748
1789
  fi
1749
1790
 
1750
1791
  return $result
@@ -1777,7 +1818,7 @@ __rvm_inject_gem_env() {
1777
1818
 
1778
1819
  elif [[ -n "$(head -n 1 $actual_file | awk '/bash/')" ]] ; then
1779
1820
 
1780
- string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_path'}\nPATH=$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH\nBUNDLE_PATH=\${BUNDLE_PATH:-'$rvm_ruby_gem_home'}\n"
1821
+ string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_home:$rvm_ruby_global_gems_path'}\nPATH=$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH\nBUNDLE_PATH=\${BUNDLE_PATH:-'$rvm_ruby_gem_home'}\n"
1781
1822
 
1782
1823
  fi
1783
1824
 
@@ -1792,16 +1833,24 @@ __rvm_inject_gem_env() {
1792
1833
  }
1793
1834
 
1794
1835
  __rvm_actual_file() {
1836
+
1795
1837
  if [[ -L $1 ]] ; then # If the file is a symlink,
1838
+
1796
1839
  actual_file="$(readlink $1)" # read the link target so we can preserve it.
1840
+
1797
1841
  else
1842
+
1798
1843
  actual_file="$1"
1844
+
1799
1845
  fi
1846
+
1800
1847
  }
1801
1848
 
1802
1849
  __rvm_manage_rubies() {
1803
- local manage_result=0
1804
- local bin_line=""
1850
+
1851
+ local manage_result bin_line
1852
+
1853
+ manage_result=0
1805
1854
 
1806
1855
  rvm_gemset_name=""
1807
1856
  rvm_ruby_selected_flag=0
@@ -1857,7 +1906,7 @@ __rvm_manage_rubies() {
1857
1906
 
1858
1907
  __rvm_unset_ruby_variables
1859
1908
  fi
1860
- done < <(builtin cd "$rvm_rubies_path" ; find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | sed -e 's#./##g')
1909
+ done < <(builtin cd "$rvm_path/rubies" ; find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | sed -e 's#./##g')
1861
1910
 
1862
1911
  else
1863
1912
  "$rvm_path/scripts/log" "warn" \