rvm 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,9 +4,7 @@
4
4
  # http://rvm.beginrescueend.com
5
5
  # http://github.com/wayneeseguin/rvm
6
6
 
7
- rvm_reload_flag=${rvm_reload_flag:-0}
8
- rvm_loaded_flag=${rvm_loaded_flag:-0}
9
- if [[ $rvm_loaded_flag -eq 0 || $rvm_reload_flag -eq 1 ]] ; then
7
+ if [[ ${rvm_loaded_flag:-0} -eq 0 || ${rvm_reload_flag:-0} -eq 1 ]] ; then
10
8
  rvm_reload_flag=0
11
9
 
12
10
  if [[ -z "$rvm_ignore_rvmrc" ]]; then
@@ -50,14 +48,13 @@ if [[ $rvm_loaded_flag -eq 0 || $rvm_reload_flag -eq 1 ]] ; then
50
48
  if [[ -z "$rvm_path" ]] ; then
51
49
  rvm_path="${rvm_prefix}rvm"
52
50
  fi
53
- rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
54
51
 
55
52
  if [[ -d "$rvm_path" ]] ; then
56
53
  for script in array utility initialize version selector cli cd override_gem ; do
57
- if [[ -f "$rvm_scripts_path/$script" ]] ; then
58
- source "$rvm_scripts_path/$script"
54
+ if [[ -f "$rvm_path/scripts/$script" ]] ; then
55
+ source "$rvm_path/scripts/$script"
59
56
  else
60
- "$rvm_scripts_path/log" "error" "RVM: Could not source script '$rvm_scripts_path/$script', file does not exist. RVM will likely not work as expected."
57
+ "$rvm_path/scripts/log" "error" "RVM: Could not source script '$rvm_path/scripts/$script', file does not exist. RVM will likely not work as expected."
61
58
  fi
62
59
  done
63
60
 
@@ -126,7 +126,7 @@ Be sure to get head often as rvm development happens fast,
126
126
  you can do this by running 'rvm update --head' followed by 'rvm reload'
127
127
  or opening a new shell
128
128
 
129
- w⦿‿⦿$
129
+ w⦿‿⦿t
130
130
 
131
131
  ~ Wayne
132
132
 
@@ -145,7 +145,7 @@ Upgrade Notes
145
145
  rvm remove X ; rvm install X
146
146
 
147
147
  * If you wish to have the 'pretty colors' again, set in ~/.rvmrc:
148
- export rvm_pretty_print=1
148
+ export rvm_pretty_print_flag=1
149
149
  "
150
150
  }
151
151
 
@@ -192,6 +192,7 @@ __rvm_initialize
192
192
  item="* "
193
193
  question="\n<?>"
194
194
  cwd="$PWD"
195
+
195
196
  source_path="${source_path:-$cwd}"
196
197
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
197
198
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
@@ -209,13 +210,10 @@ fi
209
210
 
210
211
  rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
211
212
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
212
- rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
213
213
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
214
214
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
215
215
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
216
216
 
217
- export rvm_gemset_separator="@" # TODO: Remove this after a while.
218
-
219
217
  printf "
220
218
  RVM: Shell scripts enabling management of multiple ruby environments.
221
219
  RTFM: http://rvm.beginrescueend.com/
@@ -223,35 +221,60 @@ printf "
223
221
  "
224
222
 
225
223
  if [[ ${upgrade_flag:-0} -eq 1 ]] ;then
224
+
226
225
  printf "\nUpgrading the RVM installation in $rvm_path/"
226
+
227
227
  else
228
- printf "\nInstalling rvm to $rvm_path/"
228
+
229
+ printf "\nInstalling RVM to $rvm_path/"
230
+
229
231
  fi
230
232
 
231
- 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"
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
234
+
235
+ if [[ ! -d "$directory" ]] ; then
236
+
237
+ mkdir -p "$directory"
238
+
239
+ fi
240
+
241
+ done
232
242
 
233
243
  for file in README LICENCE ; do
244
+
234
245
  cp -f "$source_path/$file" "$rvm_path/"
246
+
235
247
  done
236
248
 
237
249
  #
238
250
  # Scripts
239
251
  #
240
252
  for dir_name in config scripts examples lib hooks help patches; do
241
- mkdir -p "$rvm_path/$dir_name"
253
+
242
254
  if [[ -d "$source_path/$dir_name" ]] ; then
255
+
256
+ if [[ ! -d "$rvm_path/$dir_name" ]] ; then
257
+
258
+ mkdir -p "$rvm_path/$dir_name"
259
+
260
+ fi
261
+
243
262
  cp -Rf "$source_path/$dir_name" "$rvm_path"
263
+
244
264
  fi
245
- done ; unset dir_name
265
+
266
+ done
246
267
 
247
268
  if [[ ! -s "$rvm_config_path/user" ]] ; then
248
- mkdir -p "$rvm_config_path/"
249
269
  echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_config_path/user"
250
270
  fi
251
271
 
252
- scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
272
+ scripts=(monitor match log install color db fetch log set package)
273
+
253
274
  for script_name in "${scripts[@]}" ; do
254
- chmod +x "$rvm_scripts_path/$script_name" 2>/dev/null # Hide errors.
275
+
276
+ chmod +x "$rvm_path/scripts/$script_name" 2>/dev/null # Hide errors.
277
+
255
278
  done
256
279
 
257
280
  #
@@ -259,29 +282,48 @@ done
259
282
  #
260
283
  # Cleanse and purge...
261
284
  for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
285
+
262
286
  rm -f "$rvm_bin_path/$file"
287
+
263
288
  cp -f "$source_path/binscripts/$file" $rvm_bin_path/
289
+
264
290
  done
265
- chmod +x "$rvm_bin_path"/*
291
+
292
+ chmod +x "$rvm_bin_path"/* # TODO: this is quite suboptimal.
266
293
 
267
294
  #
268
295
  # RC Files
269
296
  #
270
297
  if [[ -n "$rvm_auto_flag" ]] ; then
298
+
271
299
  printf "Checking rc files... ($rvm_rc_files)"
300
+
272
301
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
302
+
273
303
  for rcfile in $(printf $rvm_rc_files) ; do
304
+
274
305
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
306
+
275
307
  if [[ -s "$HOME/.profile" ]] ; then
308
+
276
309
  if ! grep -q '.profile' "$rcfile" ; then
310
+
277
311
  echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
312
+
278
313
  printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> "$rcfile"
314
+
279
315
  fi
316
+
280
317
  fi
318
+
281
319
  if ! grep -q "scripts\/rvm" "$rcfile" ; then
282
- echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
283
- printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> "$rcfile"
320
+
321
+ echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
322
+
323
+ printf "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> "$rcfile"
324
+
284
325
  fi
326
+
285
327
  done
286
328
  fi
287
329
  fi
@@ -290,47 +332,91 @@ fi
290
332
  # Initial Interpreter Gemsets.
291
333
  #
292
334
  if [[ -d gemsets/ ]] ; then
293
- mkdir -p "$rvm_gemsets_path"
335
+
336
+ if [[ ! -d "$rvm_path/gemsets" ]] ; then
337
+
338
+ mkdir -p "$rvm_path/gemsets"
339
+
340
+ fi
294
341
 
295
342
  for gemset_file in $(builtin cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
296
- destination="$rvm_gemsets_path/$gemset_file"
343
+
344
+ destination="$rvm_path/gemsets/$gemset_file"
345
+
297
346
  destination_path="$(dirname "$destination")"
347
+
298
348
  if [[ ! -s "$destination" ]] ; then
349
+
299
350
  mkdir -p "$destination_path"
351
+
300
352
  cp "gemsets/$gemset_file" "$destination"
353
+
301
354
  fi
302
- done ; unset destination destination_path gemset_file
355
+
356
+ done
357
+
358
+ unset destination destination_path gemset_file
359
+
303
360
  fi
304
361
 
305
362
  if [[ -d patchsets/ ]] ; then
306
- mkdir -p "$rvm_patchsets_path"
307
- for patchset_file in $(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
308
- destination="$rvm_patchsets_path/$patchset_file"
309
- destination_path="$(dirname "$destination")"
363
+
364
+ if [[ ! -d "$rvm_path/patchsets" ]] ; then
365
+
366
+ mkdir -p "$rvm_path/patchsets"
367
+
368
+ fi
369
+
370
+ patchsets=($(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///'))
371
+
372
+ for patchset_file in "${patchsets[@]}" ; do
373
+
374
+ destination="$rvm_path/patchsets/$patchset_file"
375
+
310
376
  if [[ ! -s "$destination" ]] ; then
377
+
378
+ destination_path="$(dirname "$destination")"
379
+
311
380
  mkdir -p "$destination_path"
381
+
312
382
  cp "patchsets/$patchset_file" "$destination"
383
+
313
384
  fi
314
- done ; unset destination destination_path patchset_file
385
+ done
386
+
315
387
  fi
316
388
 
317
389
  #
318
390
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
319
391
  #
320
392
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
393
+
321
394
  mkdir -p "$rvm_rubies_path/"
395
+
322
396
  for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do
397
+
323
398
  if [[ -d "$ruby" ]] ; then
399
+
324
400
  mv "$ruby" "$rvm_rubies_path/"
401
+
325
402
  new_path="$rvm_rubies_path/$(basename $ruby)"
403
+
326
404
  for file in gem rake ; do
405
+
327
406
  if [[ -s "$new_path/bin/$file" ]] ; then
407
+
328
408
  sed -e '1,1s=.*=#!'"${new_path}/bin/ruby=" "${new_path}/bin/${file}" > "${new_path}/bin/${file}.new"
409
+
329
410
  mv -f "$new_path/bin/$file.new" "$new_path/bin/$file"
411
+
330
412
  chmod +x "$new_path/bin/$file"
413
+
331
414
  fi
415
+
332
416
  done
417
+
333
418
  fi
419
+
334
420
  done
335
421
  #
336
422
  # End of rubies migration.
@@ -340,36 +426,60 @@ done
340
426
  # Migrate old gemset directories to new gemset pattern.
341
427
  #
342
428
  for gemset in "$rvm_path"/gems/*\%* ; do
343
- new_path=${gemset/\%/${rvm_gemset_separator}}
429
+
430
+ new_path=${gemset/\%/${rvm_gemset_separator:-"@"}}
431
+
344
432
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
433
+
345
434
  printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
435
+
346
436
  mv "$gemset" "$new_path"
437
+
347
438
  fi
439
+
348
440
  done
349
441
 
350
442
  for gemset in "$rvm_path"/gems/*\+* ; do
351
- new_path=${gemset/\+/${rvm_gemset_separator}}
443
+
444
+ new_path=${gemset/\+/${rvm_gemset_separator:-"@"}}
445
+
352
446
  if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
447
+
353
448
  printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
449
+
354
450
  mv $gemset $new_path
451
+
355
452
  fi
453
+
356
454
  done
357
455
 
358
456
  for gemset in "$rvm_path"/gems/*\@ ; do
457
+
359
458
  new_path=$(echo $gemset | sed -e 's#\@$##')
459
+
360
460
  if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
461
+
361
462
  printf "\n Fixing: $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
463
+
362
464
  mv "$gemset" "$new_path"
465
+
363
466
  fi
467
+
364
468
  done
365
469
 
366
470
  # Move from legacy defaults to the new, alias based system.
367
471
  if [[ -s "$rvm_config_path/default" ]]; then
368
- original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
472
+
473
+ original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator:-"@"}#")")"
474
+
369
475
  if [[ -n "$original_version" ]]; then
370
- "$rvm_scripts_path/alias" create default "$original_version" &> /dev/null
476
+
477
+ "$rvm_path/scripts/alias" create default "$original_version" &> /dev/null
478
+
371
479
  fi ; unset original_version
480
+
372
481
  rm -rf "$rvm_config_path/default"
482
+
373
483
  fi
374
484
 
375
485
  #
@@ -380,13 +490,21 @@ printf "\n Correct permissions for base binaries in $rvm_bin_path..."
380
490
  mkdir -p "$rvm_bin_path"
381
491
 
382
492
  for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
493
+
383
494
  [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
384
- done; unset file
495
+
496
+ done
497
+
385
498
  printf "\n Copying manpages into place."
386
499
 
387
- for man_file in $(builtin cd "$install_source_path/man" ; find * -type f -maxdepth 0 -print); do
500
+ files=($(builtin cd "$install_source_path/man" ; find . -maxdepth 1 -mindepth 1 -type f -print))
501
+
502
+ for file in "${files[@]//.\/}" ; do
503
+
388
504
  rm -rf "$rvm_man_path/$man_file"
505
+
389
506
  cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
507
+
390
508
  done
391
509
 
392
510
  [[ "$upgrade_flag" = 0 ]] && ./scripts/notes
@@ -400,13 +518,19 @@ if [[ ${upgrade_flag:-0} -eq 1 ]] ; then
400
518
  check_rubyopt_conditions
401
519
 
402
520
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
521
+
403
522
  else
523
+
404
524
  if [[ ${rvm_selfcontained:-0} -eq 1 ]] ; then
525
+
405
526
  installation_complete
527
+
406
528
  fi
407
529
 
408
530
  if [[ -s "$HOME/.bashrc" ]] && grep -q '&& return' "$HOME/.bashrc" ; then
531
+
409
532
  andand_return_warning
533
+
410
534
  fi
411
535
 
412
536
  check_rubyopt_conditions
@@ -44,7 +44,7 @@ __rvm_select() {
44
44
  fi
45
45
  rvm_ruby_patch_level=""
46
46
  else
47
- "$rvm_scripts_path/log" "fail" "MacRuby can only be installed on a Darwin OS."
47
+ "$rvm_path/scripts/log" "fail" "MacRuby can only be installed on a Darwin OS."
48
48
  fi
49
49
  ;;
50
50
 
@@ -151,8 +151,8 @@ __rvm_select() {
151
151
  fi
152
152
  fi
153
153
 
154
- if ! "$rvm_scripts_path/match" "$rvm_ruby_version" "^1\.8" ; then
155
- "$rvm_scripts_path/log" "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version"
154
+ if ! "$rvm_path/scripts/match" "$rvm_ruby_version" "^1\.8" ; then
155
+ "$rvm_path/scripts/log" "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version"
156
156
  fi
157
157
  ;;
158
158
 
@@ -168,7 +168,7 @@ __rvm_select() {
168
168
 
169
169
  ruby)
170
170
  if [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 0 ]]; then
171
- "$rvm_scripts_path/log" "fail" "Unknown ruby version: $rvm_ruby_version"
171
+ "$rvm_path/scripts/log" "fail" "Unknown ruby version: $rvm_ruby_version"
172
172
 
173
173
  else
174
174
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
@@ -182,7 +182,7 @@ __rvm_select() {
182
182
  current)
183
183
  ruby_binary="$(command -v ruby)"
184
184
 
185
- if [[ $? -eq 0 ]] && "$rvm_scripts_path/match" "$ruby_binary" "rvm" ; then
185
+ if [[ $? -eq 0 ]] && "$rvm_path/scripts/match" "$ruby_binary" "rvm" ; then
186
186
  rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
187
187
 
188
188
  else
@@ -201,7 +201,7 @@ __rvm_select() {
201
201
 
202
202
  else
203
203
  if [[ -z "${rvm_ruby_string:-""}" ]] ; then
204
- "$rvm_scripts_path/log" "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
204
+ "$rvm_path/scripts/log" "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
205
205
  return 1
206
206
  fi
207
207
  fi
@@ -233,8 +233,8 @@ __rvm_select() {
233
233
  fi
234
234
 
235
235
  if [[ ! -z "$rvm_gemset_name" ]] ; then
236
- rvm_ruby_gem_home="${rvm_ruby_gem_home}${rvm_gemset_separator}${rvm_gemset_name}"
237
- rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_gems_path}/${rvm_ruby_string}${rvm_gemset_separator}global"
236
+ rvm_ruby_gem_home="${rvm_ruby_gem_home}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
237
+ rvm_ruby_gem_path="${rvm_ruby_gem_home}:${rvm_gems_path}/${rvm_ruby_string}${rvm_gemset_separator:-"@"}global"
238
238
  fi
239
239
 
240
240
  rvm_ruby_selected_flag=1
@@ -287,7 +287,9 @@ __rvm_use() {
287
287
  done
288
288
  fi
289
289
 
290
- [[ ${rvm_verbose_flag:-0} -gt 0 ]] && "$rvm_scripts_path/log" "info" "Now using system ruby."
290
+ if [[ ${rvm_verbose_flag:-0} -gt 0 ]] ; then
291
+ "$rvm_path/scripts/log" "info" "Now using system ruby."
292
+ fi
291
293
 
292
294
  export rvm_ruby_string="system"
293
295
 
@@ -304,11 +306,14 @@ __rvm_use() {
304
306
  IRBRC=${IRBRC:-""} ; if [[ -z "$IRBRC" ]] ; then unset IRBRC ; fi
305
307
 
306
308
  if [[ ! -d "$MY_RUBY_HOME" ]] ; then
307
- "$rvm_scripts_path/log" "warn" "$rvm_ruby_interpreter $rvm_ruby_string is not installed."
309
+ "$rvm_path/scripts/log" "warn" \
310
+ "$rvm_ruby_interpreter $rvm_ruby_string is not installed."
311
+
308
312
  if [[ ${rvm_install_on_use_flag:-0} -eq 1 ]] ; then
309
- "$rvm_scripts_path/manage" "install" "$rvm_ruby_string"
313
+ "$rvm_path/scripts/manage" "install" "$rvm_ruby_string"
310
314
  else
311
- "$rvm_scripts_path/log" "info" "To install do: 'rvm install $rvm_ruby_string'"
315
+ "$rvm_path/scripts/log" "info" \
316
+ "To install do: 'rvm install $rvm_ruby_string'"
312
317
  return 1
313
318
  fi
314
319
  fi
@@ -317,7 +322,7 @@ __rvm_use() {
317
322
  __rvm_ensure_has_environment_files
318
323
 
319
324
  [[ ${rvm_verbose_flag:-0} -gt 0 ]] && \
320
- "$rvm_scripts_path/log" "info" \
325
+ "$rvm_path/scripts/log" "info" \
321
326
  "Using ${GEM_HOME/${rvm_gemset_separator:-'@'}/ with gemset }"
322
327
 
323
328
  new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
@@ -342,13 +347,13 @@ __rvm_use() {
342
347
 
343
348
  if [[ "${rvm_selfcontained:-""}" = "0" ]] ; then
344
349
  # Sets up the default wrappers.
345
- "$rvm_scripts_path/wrapper" "$rvm_ruby_string" --no-prefix
350
+ "$rvm_path/scripts/wrapper" "$rvm_ruby_string" --no-prefix
346
351
  else
347
- "$rvm_scripts_path/wrapper" "$rvm_scripts_path" "default"
352
+ "$rvm_path/scripts/wrapper" "$rvm_path/scripts" "default"
348
353
  fi
349
354
 
350
355
  if [[ "system" = "$rvm_ruby_interpreter" ]] ; then
351
- "$rvm_scripts_path/alias" delete default &> /dev/null
356
+ "$rvm_path/scripts/alias" delete default &> /dev/null
352
357
  \find "$rvm_bin_path" -name 'default_*' -maxdepth 0 -delete
353
358
  \rm -f "$rvm_config_path/default"
354
359
  \rm -f "$rvm_environments_path/default"
@@ -357,8 +362,8 @@ __rvm_use() {
357
362
  else
358
363
  RUBY_VERSION="$("$rvm_ruby_home/bin/ruby" -v | sed 's#^\(.*\) (.*$#\1#')"
359
364
  export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION
360
- "$rvm_scripts_path/alias" delete default &> /dev/null
361
- "$rvm_scripts_path/alias" create default "$environment_id" >& /dev/null
365
+ "$rvm_path/scripts/alias" delete default &> /dev/null
366
+ "$rvm_path/scripts/alias" create default "$environment_id" >& /dev/null
362
367
  \ln -nfs "$rvm_environments_path/$environment_id" "$rvm_environments_path/default"
363
368
  \ln -nfs "$rvm_wrappers_path/$environment_id" "$rvm_wrappers_path/default"
364
369
  fi
@@ -367,14 +372,14 @@ __rvm_use() {
367
372
  rvm_default_flag=0
368
373
 
369
374
  if [[ -n "${rvm_wrapper_name:-""}" ]] ; then
370
- "$rvm_scripts_path/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
375
+ "$rvm_path/scripts/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
371
376
  rvm_wrapper_name=""
372
377
  fi
373
378
 
374
379
  if [[ -n "${rvm_ruby_alias:-""}" ]]; then
375
- "$rvm_scripts_path/log" "info" "Attempting to alias $environment_id to $rvm_ruby_alias"
376
- "$rvm_scripts_path/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
377
- rvm_alias_expanded=1 "$rvm_scripts_path/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
380
+ "$rvm_path/scripts/log" "info" "Attempting to alias $environment_id to $rvm_ruby_alias"
381
+ "$rvm_path/scripts/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
382
+ rvm_alias_expanded=1 "$rvm_path/scripts/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
378
383
  ruby_alias="" ; rvm_ruby_alias=""
379
384
  fi
380
385
 
@@ -387,7 +392,7 @@ __rvm_use() {
387
392
  fi
388
393
  fi
389
394
 
390
- rvm_hook="after_use" ; source "$rvm_scripts_path/hook"
395
+ rvm_hook="after_use" ; source "$rvm_path/scripts/hook"
391
396
 
392
397
  return 0
393
398
  }
@@ -411,15 +416,15 @@ __rvm_ruby_string() {
411
416
  rvm_ruby_revision=${rvm_ruby_revision:-""}
412
417
  rvm_ruby_tag=${rvm_ruby_tag:-""}
413
418
 
414
- if echo "$rvm_ruby_string" | \grep -q "$rvm_gemset_separator" ; then
415
- rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
416
- rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator}*/}"
419
+ if echo "$rvm_ruby_string" | \grep -q "${rvm_gemset_separator:-"@"}" ; then
420
+ rvm_gemset_name="${rvm_ruby_string/*${rvm_gemset_separator:-"@"}/}"
421
+ rvm_ruby_string="${rvm_ruby_string/${rvm_gemset_separator:-"@"}*/}"
417
422
  rvm_sticky_flag=1
418
423
  fi
419
424
 
420
425
  # Alias'd rubies
421
426
  if [[ ${rvm_expanding_aliases:-0} -eq 0 && -n ${rvm_ruby_string:-""} ]]; then
422
- if expanded_alias_name="$("$rvm_scripts_path/alias" show "$rvm_ruby_string" 2>/dev/null)" && [[ -n "$expanded_alias_name" ]] ; then
427
+ if expanded_alias_name="$("$rvm_path/scripts/alias" show "$rvm_ruby_string" 2>/dev/null)" && [[ -n "$expanded_alias_name" ]] ; then
423
428
  rvm_ruby_string="$expanded_alias_name"
424
429
 
425
430
  elif [[ "$rvm_ruby_string" = default ]]; then
@@ -428,96 +433,109 @@ __rvm_ruby_string() {
428
433
  fi
429
434
  fi
430
435
 
431
- ruby_string=${rvm_ruby_string/${rvm_gemset_separator}*/}
436
+ ruby_string=${rvm_ruby_string/${rvm_gemset_separator:-"@"}*/}
432
437
 
433
438
  __rvm_unset_ruby_variables
434
439
 
435
- strings=(${ruby_string//-/ })
440
+ strings=($(echo ${ruby_string//-/ }))
441
+
442
+ if [[ ${#strings[@]} -eq 0 ]] ; then
443
+
444
+ if echo "${GEM_HOME:-""}" | grep -q "rvm" ; then
445
+ # Current Ruby
446
+ strings="${GEM_HOME##*\/}"
447
+ strings=("${strings/%${rvm_gemset_separator:-"@"}*}")
448
+ rvm_ruby_string=${strings[@]:(1)}
449
+ else
450
+ strings=(system)
451
+ rvm_ruby_string="system"
452
+ fi
453
+ fi
436
454
 
437
- for string in "${strings[@]}" ; do
455
+ for string in "${strings[@]:-""}" ; do
438
456
 
439
457
  # TODO: case...
440
458
 
441
459
  case "$string" in
442
460
  head)
443
461
 
444
- rvm_ruby_revision="head"
445
- rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag=""
446
- export rvm_head_flag=1
447
- ;;
448
-
449
- system)
450
- rvm_ruby_interpreter="system"
451
- rvm_ruby_patch_level="" ; rvm_ruby_tag="" ; rvm_head_flag=0 ; rvm_ruby_revision="" ; rvm_ruby_version="" ; rvm_gemset_name=""
452
- return 0
453
- ;;
454
-
455
- nightly)
456
- rvm_ruby_version="nightly"
457
- rvm_nightly_flag=1
458
- break
459
- ;;
460
-
461
- preview*)
462
- rvm_ruby_patch_level="$string"
463
- ;;
462
+ rvm_ruby_revision="head"
463
+ rvm_ruby_patch_level="" ; rvm_ruby_revision="" ; rvm_ruby_tag=""
464
+ export rvm_head_flag=1
465
+ ;;
464
466
 
465
- rc[[:digit:]]*)
466
- rvm_ruby_patch_level="$string"
467
- ;;
468
-
469
- [[:digit:]]\.[[:digit:]]*)
470
- rvm_ruby_version="$string"
471
- rvm_ruby_revision=""
472
- rvm_ruby_tag=""
473
- ;;
474
-
475
- p[[:digit:]]*)
476
- rvm_ruby_patch_level="$string"
477
- ;;
478
-
479
- #elif [[ -n "${rvm_ruby_version:-""}" ]] && "$rvm_scripts_path/match" "$string" "^
480
- [[:digit:]][[:digit:]]*)
481
-
482
- case "${rvm_ruby_interpreter:-""}" in
483
- ree)
484
- rvm_ruby_patch_level="$string"
485
- rvm_ruby_revision=""
486
- ;;
487
-
488
- rbx)
489
- rvm_ruby_patch_level="$string"
490
- ;;
491
-
492
- maglev)
493
- rvm_ruby_version="$string"
494
- rvm_ruby_revision=""
495
- rvm_ruby_patch_level=""
496
- ;;
497
-
498
- *)
499
- rvm_ruby_revision="r$string"
500
- ;;
501
- esac
502
- ;;
503
-
504
- r[[:digit:]]*)
505
- rvm_ruby_patch_level=""
506
- rvm_ruby_revision="$string"
507
- ;;
467
+ system)
468
+ rvm_ruby_interpreter="system"
469
+ rvm_ruby_patch_level="" ; rvm_ruby_tag="" ; rvm_head_flag=0 ; rvm_ruby_revision="" ; rvm_ruby_version="" ; rvm_gemset_name=""
470
+ return 0
471
+ ;;
472
+
473
+ nightly)
474
+ rvm_ruby_version="nightly"
475
+ rvm_nightly_flag=1
476
+ break
477
+ ;;
478
+
479
+ preview*)
480
+ rvm_ruby_patch_level="$string"
481
+ ;;
482
+
483
+ rc[[:digit:]]*)
484
+ rvm_ruby_patch_level="$string"
485
+ ;;
486
+
487
+ [[:digit:]]\.[[:digit:]]*)
488
+ rvm_ruby_version="$string"
489
+ rvm_ruby_revision=""
490
+ rvm_ruby_tag=""
491
+ ;;
492
+
493
+ p[[:digit:]]*)
494
+ rvm_ruby_patch_level="$string"
495
+ ;;
496
+
497
+ #elif [[ -n "${rvm_ruby_version:-""}" ]] && "$rvm_path/scripts/match" "$string" "^
498
+ [[:digit:]][[:digit:]]*)
499
+
500
+ case "${rvm_ruby_interpreter:-""}" in
501
+ ree)
502
+ rvm_ruby_patch_level="$string"
503
+ rvm_ruby_revision=""
504
+ ;;
505
+
506
+ rbx)
507
+ rvm_ruby_patch_level="$string"
508
+ ;;
509
+
510
+ maglev)
511
+ rvm_ruby_version="$string"
512
+ rvm_ruby_revision=""
513
+ rvm_ruby_patch_level=""
514
+ ;;
515
+
516
+ *)
517
+ rvm_ruby_revision="r$string"
518
+ ;;
519
+ esac
520
+ ;;
521
+
522
+ r[[:digit:]]*)
523
+ rvm_ruby_patch_level=""
524
+ rvm_ruby_revision="$string"
525
+ ;;
508
526
 
509
- s[[:digit:]]*)
510
- rvm_ruby_revision=""
511
- rvm_ruby_sha="$string"
512
- ;;
527
+ s[[:digit:]]*)
528
+ rvm_ruby_revision=""
529
+ rvm_ruby_sha="$string"
530
+ ;;
513
531
 
514
- tv[[:digit:]]* | t[[:digit:]]*)
515
- rvm_ruby_patch_level="" ; rvm_ruby_revision=""
516
- rvm_ruby_tag="$string"
517
- ;;
532
+ tv[[:digit:]]* | t[[:digit:]]*)
533
+ rvm_ruby_patch_level="" ; rvm_ruby_revision=""
534
+ rvm_ruby_tag="$string"
535
+ ;;
518
536
 
519
- m[[:digit:]]*)
520
- rvm_ruby_mode="$string"
537
+ m[[:digit:]]*)
538
+ rvm_ruby_mode="$string"
521
539
  ;;
522
540
 
523
541
  u[[:alnum:]]*)
@@ -538,7 +556,7 @@ __rvm_ruby_string() {
538
556
  ;;
539
557
 
540
558
  *)
541
- "$rvm_scripts_path/log" "error" \
559
+ "$rvm_path/scripts/log" "error" \
542
560
  "Unknown ruby string component: '$string'"
543
561
  return 1
544
562
  ;;
@@ -623,7 +641,7 @@ __rvm_gemset_select() {
623
641
 
624
642
  rvm_ruby_gem_home=${rvm_ruby_gem_home:-""}
625
643
  rvm_gemset_name=${rvm_gemset_name:-""}
626
- rvm_ruby_global_gems_path="$rvm_path/gems/${rvm_ruby_string:-""}${rvm_gemset_separator}global"
644
+ rvm_ruby_global_gems_path="$rvm_path/gems/${rvm_ruby_string:-""}${rvm_gemset_separator:-"@"}global"
627
645
 
628
646
  if [[ -z "${rvm_gemset_name:-""}" ]] ; then
629
647
 
@@ -632,17 +650,17 @@ __rvm_gemset_select() {
632
650
  if [[ ${rvm_sticky_flag:-0} -eq 1 ]] ; then
633
651
 
634
652
  if [[ -n "${GEM_HOME:-""}" ]] ; then
635
- rvm_gemset_name=$(echo $GEM_HOME | xargs basename | awk -F${rvm_gemset_separator} '{print $2}')
653
+ rvm_gemset_name=$(echo $GEM_HOME | xargs basename | awk -F${rvm_gemset_separator:-"@"} '{print $2}')
636
654
  fi
637
655
 
638
656
  if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
639
- rvm_gemset_name=$(echo $rvm_ruby_gem_home | xargs basename | awk -F${rvm_gemset_separator} '{print $2}')
657
+ rvm_gemset_name=$(echo $rvm_ruby_gem_home | xargs basename | awk -F${rvm_gemset_separator:-"@"} '{print $2}')
640
658
  fi
641
659
  fi
642
660
 
643
661
  if ! echo "${rvm_gemset_name:-""}" | grep -q "^[[:digit:]]\.[[:digit:]]" ; then
644
662
 
645
- rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
663
+ rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
646
664
 
647
665
  else
648
666
  if [[ -n "${rvm_ruby_string:-""}" && "${rvm_ruby_interpreter:-""}" != "system" ]] ; then
@@ -668,13 +686,13 @@ __rvm_gemset_select() {
668
686
  if [[ -n "${rvm_ruby_string:-""}" ]] ; then
669
687
 
670
688
  if [[ -z "${rvm_ruby_gem_home:-""}" || -n "${gemset:-""}" ]] ; then
671
- rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
689
+ rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
672
690
 
673
691
  elif [[ -n "${gemset:-""}" && "${rvm_gemset_name:-""}" != "${gemset:-""}" ]] ; then
674
- rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
692
+ rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
675
693
  fi
676
694
  else
677
- "$rvm_scripts_path/log" "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
695
+ "$rvm_path/scripts/log" "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
678
696
  return 1
679
697
  fi
680
698
  fi
@@ -686,7 +704,7 @@ __rvm_gemset_select() {
686
704
 
687
705
  if [[ ${rvm_gemset_create_on_use_flag:-0} -ne 1 && ${rvm_create_flag:-0} -ne 1 && ${rvm_delete_flag:-0} -ne 1 ]] ; then
688
706
 
689
- "$rvm_scripts_path/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
707
+ "$rvm_path/scripts/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
690
708
 
691
709
  return 1
692
710
  fi
@@ -697,7 +715,7 @@ __rvm_gemset_select() {
697
715
 
698
716
  if [[ -z "${rvm_ruby_gem_home:-""}" && -n "${rvm_ruby_string:-""}" ]] ; then
699
717
  rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
700
- rvm_ruby_global_gems_path="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator}global"
718
+ rvm_ruby_global_gems_path="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator:-"@"}global"
701
719
  fi
702
720
 
703
721
  rvm_ruby_gem_path="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
@@ -718,7 +736,7 @@ __rvm_gemset_select() {
718
736
  # Use a gemset specified by 'rvm_ruby_gem_home'
719
737
  __rvm_gemset_use() {
720
738
  if [[ -z "${rvm_gemset_name:-""}" ]] ; then
721
- "$rvm_scripts_path/log" "error" "Gemset was not given.\n Usage:\n rvm gemset use <gemsetname>\n"
739
+ "$rvm_path/scripts/log" "error" "Gemset was not given.\n Usage:\n rvm gemset use <gemsetname>\n"
722
740
  return 1
723
741
  fi
724
742
 
@@ -727,21 +745,21 @@ __rvm_gemset_use() {
727
745
  if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
728
746
 
729
747
  if [[ ${rvm_gemset_create_on_use_flag:-0} -eq 1 || ${rvm_create_flag:-0} -eq 1 ]] ; then
730
- "$rvm_scripts_path/gemsets" create "$rvm_gemset_name"
748
+ "$rvm_path/scripts/gemsets" create "$rvm_gemset_name"
731
749
  else
732
- "$rvm_scripts_path/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
750
+ "$rvm_path/scripts/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
733
751
  return 1
734
752
  fi
735
753
  fi
736
754
 
737
755
  if [[ ${rvm_interactive_flag:-0} -gt 0 && ${rvm_verbose_flag:-1} -ne 0 ]] ; then
738
- "$rvm_scripts_path/log" "info" "Now using gemset '${rvm_gemset_name:-default}'"
756
+ "$rvm_path/scripts/log" "info" "Now using gemset '${rvm_gemset_name:-default}'"
739
757
  fi
740
758
 
741
- rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator}*}${rvm_gemset_separator}${rvm_gemset_name}"
759
+ rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-"@"}*}${rvm_gemset_separator:-"@"}${rvm_gemset_name}"
742
760
  GEM_HOME="$rvm_ruby_gem_home"
743
761
  BUNDLE_PATH="$rvm_ruby_gem_home"
744
- GEM_PATH="$rvm_ruby_gem_home/bin:$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global/bin"
762
+ GEM_PATH="$rvm_ruby_gem_home/bin:$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator:-"@"}'.*$//')${rvm_gemset_separator:-"@"}global/bin"
745
763
  export rvm_ruby_gem_home GEM_HOME BUNDLE_PATH GEM_PATH
746
764
 
747
765
  __rvm_use # Now ensure the selection takes effect for the environment.
@@ -752,8 +770,8 @@ __rvm_gemset_use() {
752
770
 
753
771
  __rvm_gemset_clear() {
754
772
  rvm_gemset_name="" ; shift # TODO: Is this shift necessary???
755
- rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-'@'}*}"
756
- rvm_ruby_global_gems_path="$(echo "${GEM_HOME:-""}" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global"
773
+ rvm_ruby_gem_home="${GEM_HOME//${rvm_gemset_separator:-"@"}*}"
774
+ rvm_ruby_global_gems_path="$(echo "${GEM_HOME:-""}" | sed 's/'${rvm_gemset_separator:-"@"}'.*$//')${rvm_gemset_separator:-"@"}global"
757
775
  GEM_HOME=$rvm_ruby_gem_home
758
776
  BUNDLE_PATH="$rvm_ruby_gem_home"
759
777
  GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin"