rvm 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,7 +37,7 @@ __rvm_select() {
37
37
 
38
38
  unset rvm_ruby_patch_level
39
39
  else
40
- $rvm_scripts_path/log "fail" "MacRuby can only be installed on a Darwin OS."
40
+ "$rvm_scripts_path/log" "fail" "MacRuby can only be installed on a Darwin OS."
41
41
  fi
42
42
  ;;
43
43
 
@@ -131,8 +131,8 @@ __rvm_select() {
131
131
  fi
132
132
  fi
133
133
 
134
- if ! $rvm_scripts_path/match "$rvm_ruby_version" "^1\.8" ; then
135
- $rvm_scripts_path/log "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version"
134
+ if ! "$rvm_scripts_path/match" "$rvm_ruby_version" "^1\.8" ; then
135
+ "$rvm_scripts_path/log" "fail" "Unknown Ruby Enterprise Edition version: $rvm_ruby_version"
136
136
  fi
137
137
  ;;
138
138
 
@@ -148,7 +148,7 @@ __rvm_select() {
148
148
 
149
149
  ruby)
150
150
  if [[ -z "$rvm_ruby_version" && -z "$rvm_head_flag" ]]; then
151
- $rvm_scripts_path/log "fail" "Unknown ruby version: $rvm_ruby_version"
151
+ "$rvm_scripts_path/log" "fail" "Unknown ruby version: $rvm_ruby_version"
152
152
  else
153
153
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
154
154
  if [[ -z "$rvm_head_flag" ]]; then
@@ -159,7 +159,7 @@ __rvm_select() {
159
159
 
160
160
  current)
161
161
  ruby_binary="$(command -v ruby)"
162
- if [[ $? -eq 0 ]] && $rvm_scripts_path/match "$ruby_binary" "rvm" ; then
162
+ if [[ $? -eq 0 ]] && "$rvm_scripts_path/match" "$ruby_binary" "rvm" ; then
163
163
  rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
164
164
  else
165
165
  rvm_ruby_interpreter="system"
@@ -176,7 +176,7 @@ __rvm_select() {
176
176
  __rvm_select
177
177
  else
178
178
  if [[ -z "$rvm_ruby_string" ]] ; then
179
- $rvm_scripts_path/log "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
179
+ "$rvm_scripts_path/log" "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
180
180
  return 1
181
181
  fi
182
182
  fi
@@ -186,9 +186,9 @@ __rvm_select() {
186
186
 
187
187
  if [[ -n "$rvm_ruby_interpreter" && "system" != "$rvm_ruby_interpreter" && "default" != "$rvm_ruby_interpreter" ]] ; then
188
188
  if [[ ! -z "$rvm_ruby_version" ]] ; then
189
- rvm_release_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $1 }')
190
- rvm_major_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $2 }')
191
- rvm_minor_version=$(echo $rvm_ruby_version | awk -F'.' '{ print $3 }')
189
+ rvm_release_version="${rvm_ruby_version/.*/}"
190
+ rvm_major_version=${rvm_ruby_version%.*} ; rvm_major_version=${rvm_major_version#*.}
191
+ rvm_minor_version="${rvm_ruby_version//*.}"
192
192
  fi
193
193
 
194
194
  rvm_ruby_package_name="${rvm_ruby_package_name:-$(echo $rvm_ruby_string | sed -e 's/-n.*$//')}"
@@ -249,7 +249,7 @@ __rvm_use() {
249
249
  fi
250
250
 
251
251
  if [[ ! -z "$rvm_verbose_flag" ]] ; then
252
- $rvm_scripts_path/log "info" "Now using system ruby."
252
+ "$rvm_scripts_path/log" "info" "Now using system ruby."
253
253
  fi
254
254
 
255
255
  export rvm_ruby_string="system"
@@ -267,11 +267,11 @@ __rvm_use() {
267
267
  if [[ -z "$IRBRC" ]] ; then unset IRBRC ; fi
268
268
 
269
269
  if [[ ! -d $MY_RUBY_HOME ]] ; then
270
- $rvm_scripts_path/log "warn" "$rvm_ruby_interpreter $rvm_ruby_string is not installed."
270
+ "$rvm_scripts_path/log" "warn" "$rvm_ruby_interpreter $rvm_ruby_string is not installed."
271
271
  if [[ ! -z "$rvm_install_on_use_flag" ]] ; then
272
- $rvm_scripts_path/manage "install" "$rvm_ruby_string"
272
+ "$rvm_scripts_path/manage" "install" "$rvm_ruby_string"
273
273
  else
274
- $rvm_scripts_path/log "info" "To install do: 'rvm install $rvm_ruby_string'"
274
+ "$rvm_scripts_path/log" "info" "To install do: 'rvm install $rvm_ruby_string'"
275
275
  return 1
276
276
  fi
277
277
  fi
@@ -280,7 +280,7 @@ __rvm_use() {
280
280
  __rvm_ensure_has_environment_files
281
281
 
282
282
  if [[ ! -z "$rvm_verbose_flag" ]] ; then
283
- $rvm_scripts_path/log "info" "Using $(basename $GEM_HOME | \tr '-' ' ' | sed 's/'${rvm_gemset_separator}'/ with gemset /')"
283
+ "$rvm_scripts_path/log" "info" "Using $(basename $GEM_HOME | \tr '-' ' ' | sed 's/'${rvm_gemset_separator}'/ with gemset /')"
284
284
  fi
285
285
 
286
286
  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)"
@@ -301,35 +301,35 @@ __rvm_use() {
301
301
  if [[ -n "$rvm_default_flag" && "default" != "$rvm_ruby_interpreter" ]] ; then
302
302
  if [[ "$rvm_selfcontained" = "0" ]] ; then
303
303
  # Sets up the default wrappers.
304
- $rvm_scripts_path/wrapper "$rvm_ruby_string" --no-prefix
304
+ "$rvm_scripts_path/wrapper" "$rvm_ruby_string" --no-prefix
305
305
  else
306
- $rvm_scripts_path/wrapper "$rvm_scripts_path" "default"
306
+ "$rvm_scripts_path/wrapper" "$rvm_scripts_path" "default"
307
307
  fi
308
308
  if [[ "system" = "$rvm_ruby_interpreter" ]] ; then
309
- $rvm_scripts_path/alias delete default &> /dev/null
309
+ "$rvm_scripts_path/alias" delete default &> /dev/null
310
310
  \find "$rvm_bin_path" -name 'default_*' -maxdepth 1 -delete
311
- \rm -f $rvm_config_path/default
312
- \rm -f $rvm_environments_path/default
313
- \rm -rf $rvm_wrappers_path/default
311
+ \rm -f "$rvm_config_path/default"
312
+ \rm -f "$rvm_environments_path/default"
313
+ \rm -rf "$rvm_wrappers_path/default"
314
314
  else
315
- RUBY_VERSION="$($rvm_ruby_home/bin/ruby -v | sed 's#^\(.*\) (.*$#\1#')"
315
+ RUBY_VERSION="$("$rvm_ruby_home/bin/ruby" -v | sed 's#^\(.*\) (.*$#\1#')"
316
316
  export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION
317
- $rvm_scripts_path/alias delete default &> /dev/null
318
- $rvm_scripts_path/alias create default "$environment_id" >& /dev/null
319
- ln -nfs $rvm_environments_path/$environment_id $rvm_environments_path/default
320
- ln -nfs $rvm_wrappers_path/$environment_id $rvm_wrappers_path/default
317
+ "$rvm_scripts_path/alias" delete default &> /dev/null
318
+ "$rvm_scripts_path/alias" create default "$environment_id" >& /dev/null
319
+ ln -nfs "$rvm_environments_path/$environment_id" "$rvm_environments_path/default"
320
+ ln -nfs "$rvm_wrappers_path/$environment_id" "$rvm_wrappers_path/default"
321
321
  fi
322
322
  fi ; unset rvm_default_flag
323
323
 
324
324
  if [[ -n "$rvm_wrapper_name" ]] ; then
325
- $rvm_scripts_path/wrapper "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
325
+ "$rvm_scripts_path/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1
326
326
  unset rvm_wrapper_name
327
327
  fi
328
328
 
329
329
  if [[ -n "$rvm_ruby_alias" ]]; then
330
- $rvm_scripts_path/log "info" "Attempting to alias $environment_id to $rvm_ruby_alias"
331
- $rvm_scripts_path/alias delete "$rvm_ruby_alias" > /dev/null 2>&1
332
- rvm_alias_expanded=1 $rvm_scripts_path/alias create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
330
+ "$rvm_scripts_path/log" "info" "Attempting to alias $environment_id to $rvm_ruby_alias"
331
+ "$rvm_scripts_path/alias" delete "$rvm_ruby_alias" > /dev/null 2>&1
332
+ rvm_alias_expanded=1 "$rvm_scripts_path/alias" create "$rvm_ruby_alias" "$environment_id" > /dev/null 2>&1
333
333
  unset ruby_alias rvm_ruby_alias
334
334
  fi
335
335
 
@@ -339,11 +339,11 @@ __rvm_use() {
339
339
  export MAGLEV_HOME="$rvm_ruby_home"
340
340
  export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
341
341
  if [[ -x "$MAGLEV_HOME/gemstone/bin/gslist" ]] ; then
342
- $MAGLEV_HOME/gemstone/bin/gslist -clv > /dev/null 2>&1 ; result=$?
343
- if [[ $result -eq 1 ]] ; then $rvm_ruby_home/bin/maglev start ; fi
342
+ "$MAGLEV_HOME/gemstone/bin/gslist" -clv > /dev/null 2>&1 ; result=$?
343
+ if [[ $result -eq 1 ]] ; then "$rvm_ruby_home/bin/maglev" start ; fi
344
344
  fi
345
345
  fi
346
- rvm_hook="after_use" ; source $rvm_scripts_path/hook
346
+ rvm_hook="after_use" ; source "$rvm_scripts_path/hook"
347
347
  }
348
348
 
349
349
  __rvm_ruby_string() {
@@ -355,6 +355,13 @@ __rvm_ruby_string() {
355
355
  # * rvm_ruby_revision
356
356
  # * rvm_ruby_tag
357
357
 
358
+ if printf "$rvm_ruby_string" | \grep -q "$rvm_gemset_separator" ; then
359
+ set_name="${rvm_ruby_string/*${rvm_gemset_separator}/}"
360
+ else
361
+ set_name=""
362
+ fi
363
+ if [[ -n "$set_name" ]] ; then rvm_gemset_name="$set_name" ; fi
364
+
358
365
  # Alias'd rubies
359
366
  if [[ -z "$rvm_expanding_aliases" ]]; then
360
367
  rvm_ruby_string="${rvm_ruby_string:-"default"}"
@@ -366,14 +373,11 @@ __rvm_ruby_string() {
366
373
  rvm_ruby_string="system"
367
374
  fi
368
375
  fi
369
-
370
- set_name=$(echo "$rvm_ruby_string" | awk -F${rvm_gemset_separator} '{print $2}')
371
- if [[ ! -z "$set_name" ]] ; then rvm_gemset_name="$set_name" ; fi
372
- ruby_string=$(echo "$rvm_ruby_string" | awk -F${rvm_gemset_separator} '{print $1}')
376
+ ruby_string=${rvm_ruby_string/${rvm_gemset_separator}*/}
373
377
 
374
378
  __rvm_unset_ruby_variables
375
379
 
376
- for string in $(echo $ruby_string | \tr '-' ' ') ; do
380
+ for string in $(printf "${ruby_string//-/ }") ; do
377
381
  if [[ "head" = "$string" ]] ; then
378
382
  rvm_ruby_revision="head"
379
383
  unset rvm_ruby_patch_level rvm_ruby_revision rvm_ruby_tag
@@ -386,16 +390,16 @@ __rvm_ruby_string() {
386
390
  rvm_ruby_version="nightly"
387
391
  rvm_nightly_flag=1
388
392
  break
389
- elif $rvm_scripts_path/match "$string" "^preview" ; then
393
+ elif "$rvm_scripts_path/match" "$string" "^preview" ; then
390
394
  rvm_ruby_patch_level="$string"
391
- elif $rvm_scripts_path/match "$string" "^rc[0-9]" ; then
395
+ elif "$rvm_scripts_path/match" "$string" "^rc[0-9]" ; then
392
396
  rvm_ruby_patch_level="$string"
393
- elif $rvm_scripts_path/match "$string" "^[0-9]\.[0-9]" ; then
397
+ elif "$rvm_scripts_path/match" "$string" "^[0-9]\.[0-9]" ; then
394
398
  rvm_ruby_version="$string"
395
399
  unset rvm_ruby_revision rvm_ruby_tag
396
- elif $rvm_scripts_path/match "$string" "^p[0-9]" ; then
400
+ elif "$rvm_scripts_path/match" "$string" "^p[0-9]" ; then
397
401
  rvm_ruby_patch_level="$string"
398
- elif [[ -n "$rvm_ruby_version" ]] && $rvm_scripts_path/match "$string" "^[0-9][0-9]" ; then
402
+ elif [[ -n "$rvm_ruby_version" ]] && "$rvm_scripts_path/match" "$string" "^[0-9][0-9]" ; then
399
403
  if [[ "ree" = "$rvm_ruby_interpreter" ]] ; then
400
404
  rvm_ruby_patch_level="$string"
401
405
  unset rvm_ruby_revision
@@ -407,40 +411,40 @@ __rvm_ruby_string() {
407
411
  else
408
412
  rvm_ruby_revision="r$string"
409
413
  fi
410
- elif $rvm_scripts_path/match "$string" "^r[0-9]" ; then
414
+ elif "$rvm_scripts_path/match" "$string" "^r[0-9]" ; then
411
415
  unset rvm_ruby_patch_level
412
416
  rvm_ruby_revision="$string"
413
- elif $rvm_scripts_path/match "$string" "^s[0-9]" ; then
417
+ elif "$rvm_scripts_path/match" "$string" "^s[0-9]" ; then
414
418
  unset rvm_ruby_revision
415
419
  rvm_ruby_sha="$string"
416
- elif $rvm_scripts_path/match "$string" "^t[v0-9]" ; then
420
+ elif "$rvm_scripts_path/match" "$string" "^t[v0-9]" ; then
417
421
  unset rvm_ruby_patch_level rvm_ruby_revision
418
422
  rvm_ruby_tag="$string"
419
- elif $rvm_scripts_path/match "$string" "^m[0-9]" ; then
423
+ elif "$rvm_scripts_path/match" "$string" "^m[0-9]" ; then
420
424
  rvm_ruby_mode="$string"
421
- elif $rvm_scripts_path/match "$string" "^u[a-z0-9]" ; then
425
+ elif "$rvm_scripts_path/match" "$string" "^u[a-z0-9]" ; then
422
426
  unset rvm_ruby_patch_level rvm_ruby_revision rvm_ruby_tag rvm_ruby_patch
423
427
  rvm_ruby_user_tag="$string"
424
- elif $rvm_scripts_path/match "$string" "^b[0-9][0-9]" ; then
428
+ elif "$rvm_scripts_path/match" "$string" "^b[0-9][0-9]" ; then
425
429
  rvm_ruby_bits="$string"
426
- elif $rvm_scripts_path/match "$string" "^n" ; then
430
+ elif "$rvm_scripts_path/match" "$string" "^n" ; then
427
431
  rvm_ruby_name="${string/n/}"
428
- elif $rvm_scripts_path/match "ruby rbx jruby macruby ree rubinius maglev mput shyouhei ironruby " "$string " ; then
432
+ elif [[ "ruby rbx jruby macruby ree rubinius maglev mput shyouhei ironruby " =~ "$string " ]] ; then
429
433
  # NOTE: The space at the end of each of the above strings is *very* important.
430
434
  rvm_ruby_interpreter="$string"
431
435
  else
432
- $rvm_scripts_path/log "error" "Unknown ruby string component: '$string'"
436
+ "$rvm_scripts_path/log" "error" "Unknown ruby string component: '$string'"
433
437
  return 1
434
438
  fi
435
439
  done
436
440
 
437
441
  # Unspecified interpreter
438
442
  if [[ -z "$rvm_ruby_interpreter" ]] ; then
439
- if $rvm_scripts_path/match "$rvm_ruby_version" "^1\.[8-9]" ; then
443
+ if "$rvm_scripts_path/match" "$rvm_ruby_version" "^1\.[8-9]" ; then
440
444
  rvm_ruby_interpreter="ruby"
441
- elif $rvm_scripts_path/match "$rvm_ruby_version" "^0.5" ; then
445
+ elif "$rvm_scripts_path/match" "$rvm_ruby_version" "^0.5" ; then
442
446
  rvm_ruby_interpreter="macruby"
443
- elif $rvm_scripts_path/match "$rvm_ruby_version" "^1.[2-4]" ; then
447
+ elif "$rvm_scripts_path/match" "$rvm_ruby_version" "^1.[2-4]" ; then
444
448
  rvm_ruby_interpreter="jruby"
445
449
  fi
446
450
  fi
@@ -513,7 +517,7 @@ __rvm_gemset_select() {
513
517
  fi
514
518
  fi
515
519
 
516
- if [[ -n "$rvm_gemset_name" ]] && ! $rvm_scripts_path/match "$rvm_gemset_name" "^[0-9]\.[0-9]" ; then
520
+ if [[ -n "$rvm_gemset_name" ]] && ! "$rvm_scripts_path/match" "$rvm_gemset_name" "^[0-9]\.[0-9]" ; then
517
521
  rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
518
522
  else
519
523
  if [[ -n "$rvm_ruby_string" ]] && [[ "$rvm_ruby_interpreter" != "system" ]] ; then
@@ -540,7 +544,7 @@ __rvm_gemset_select() {
540
544
  rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
541
545
  fi ; unset gemset
542
546
  else
543
- $rvm_scripts_path/log "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
547
+ "$rvm_scripts_path/log" "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
544
548
  return 1
545
549
  fi
546
550
  fi
@@ -548,7 +552,7 @@ __rvm_gemset_select() {
548
552
  # If the gemset does not exist, then notify the user as such and abort the action.
549
553
  if [[ -n "$rvm_gemset_name" ]] && [[ ! -d "$rvm_ruby_gem_home" ]] ; then
550
554
  if [[ "$rvm_gemset_create_on_use_flag" -ne 1 ]] && [[ "$rvm_create_flag" -ne 1 ]] && [[ "$rvm_delete_flag" -ne 1 ]] ; then
551
- $rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
555
+ "$rvm_scripts_path/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
552
556
  return 1
553
557
  fi
554
558
  elif [[ "$rvm_delete_flag" -eq 1 ]] ; then
@@ -580,21 +584,21 @@ __rvm_gemset_use() {
580
584
  if [[ -n "$rvm_ruby_gem_home" ]] ; then
581
585
  if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
582
586
  if [[ "$rvm_gemset_create_on_use_flag" -eq 1 ]] || [[ "$rvm_create_flag" -eq 1 ]]; then
583
- $rvm_scripts_path/gemsets create $rvm_gemset_name
587
+ "$rvm_scripts_path/gemsets" create "$rvm_gemset_name"
584
588
  else
585
- $rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
589
+ "$rvm_scripts_path/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
586
590
  return 1
587
591
  fi
588
592
  fi
589
593
 
590
594
  if [[ "$rvm_interactive" -eq 1 ]] || [[ "$rvm_verbose_flag" -eq 1 ]] ; then
591
- $rvm_scripts_path/log "info" "Now using gemset '${rvm_gemset_name:-default}'"
595
+ "$rvm_scripts_path/log" "info" "Now using gemset '${rvm_gemset_name:-default}'"
592
596
  fi
593
597
 
594
- rvm_ruby_gem_home="$(echo $GEM_HOME | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}${rvm_gemset_name}"
598
+ rvm_ruby_gem_home="$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}${rvm_gemset_name}"
595
599
  GEM_HOME="$rvm_ruby_gem_home"
596
600
  BUNDLE_PATH="$rvm_ruby_gem_home"
597
- GEM_PATH="$rvm_ruby_gem_home/bin:$(echo $GEM_HOME | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global/bin"
601
+ GEM_PATH="$rvm_ruby_gem_home/bin:$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global/bin"
598
602
  export rvm_ruby_gem_home GEM_HOME BUNDLE_PATH GEM_PATH
599
603
 
600
604
  __rvm_use # Now ensure the selection takes effect for the environment.
@@ -604,8 +608,8 @@ __rvm_gemset_use() {
604
608
 
605
609
  __rvm_gemset_clear() {
606
610
  unset rvm_gemset_name ; shift
607
- rvm_ruby_gem_home="$(echo $GEM_HOME | sed "s#${rvm_gemset_separator:-'@'}.*\$##g")"
608
- rvm_ruby_global_gems_path="$(echo $GEM_HOME | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global"
611
+ rvm_ruby_gem_home="$(echo "$GEM_HOME" | sed "s#${rvm_gemset_separator:-'@'}.*\$##g")"
612
+ rvm_ruby_global_gems_path="$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global"
609
613
  GEM_HOME=$rvm_ruby_gem_home
610
614
  BUNDLE_PATH="$rvm_ruby_gem_home"
611
615
  GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin"
@@ -3,7 +3,7 @@
3
3
  source "$rvm_scripts_path/base"
4
4
 
5
5
  if [[ -z "$1" ]] ; then
6
- $rvm_scripts_path/log "error" "Action must be specified."
6
+ "$rvm_scripts_path/log" "error" "Action must be specified."
7
7
  exit 1
8
8
  fi
9
9
 
@@ -35,7 +35,7 @@ __rvm_ruby_do() {
35
35
  elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(command -v $binary)" ]] ; then
36
36
  binary="$(basename $(command -v $binary) 2>/dev/null)"
37
37
  else
38
- $rvm_scripts_path/log "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
38
+ "$rvm_scripts_path/log" "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
39
39
  __rvm_unset_ruby_variables
40
40
  return 1
41
41
  fi
@@ -48,9 +48,9 @@ __rvm_ruby_do() {
48
48
  load_path="$(dirname $(command -v $binary) 2>/dev/null):$rvm_ruby_load_path"
49
49
  # TODO: the else case below should be run if $args =~ /\.rb$/
50
50
  if [[ "ruby" = "$(basename $binary)" ]] && [[ "$rvm_benchmark_flag" -ne 1 ]] ; then
51
- if $rvm_scripts_path/match "$args" "\.rb$" ; then
51
+ if "$rvm_scripts_path/match" "$args" "\.rb$" ; then
52
52
  if [[ -z "$prefix" ]] ; then prefix="-S" ; fi
53
- if ! $rvm_scripts_path/match "$args" "$prefix" ; then
53
+ if ! "$rvm_scripts_path/match" "$args" "$prefix" ; then
54
54
  args="$prefix $args"
55
55
  fi
56
56
  fi
@@ -70,7 +70,7 @@ __rvm_ruby_do() {
70
70
  if [[ "$current_env" != "$current_set_ruby" ]]; then
71
71
  current_env="$current_set_ruby ($current_env)"
72
72
  fi
73
- $rvm_scripts_path/log "info" "$current_env: $(ruby -v $rvm_ruby_mode | \tr "\n" ' ')\n"
73
+ "$rvm_scripts_path/log" "info" "$current_env: $(ruby -v $rvm_ruby_mode | \tr "\n" ' ')\n"
74
74
  unset current_env
75
75
  fi
76
76
  eval "$rvm_command"
@@ -117,7 +117,7 @@ __rvm_yaml() {
117
117
  if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
118
118
  for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
119
119
  if [[ ! -z "$rvm_debug_flag" ]] ; then
120
- $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
120
+ "$rvm_scripts_path/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
121
121
  fi
122
122
  yaml="$yaml\n \"${rubies[$index]}\": ${statuses[$index]}"
123
123
  done ; unset index array_start
@@ -139,7 +139,7 @@ __rvm_json() {
139
139
  if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
140
140
  for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
141
141
  if [[ ! -z "$rvm_debug_flag" ]] ; then
142
- $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
142
+ "$rvm_scripts_path/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
143
143
  fi
144
144
  json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}"
145
145
  if (( $index + 1 < $total + $array_start )) ; then json="$json, " ; fi
@@ -163,8 +163,8 @@ action="$1";
163
163
  args="$*"
164
164
 
165
165
  if [[ "$action" == "ruby" ]] && echo "$args" | \grep -q "^'--[^[:space:]]*'$" ; then
166
- $rvm_scripts_path/log "warn" "You called rvm ruby with the arguments $args which look like use options."
167
- $rvm_scripts_path/log "warn" "Please note that 'rvm ruby' invokes set operations instead."
166
+ "$rvm_scripts_path/log" "warn" "You called rvm ruby with the arguments $args which look like use options."
167
+ "$rvm_scripts_path/log" "warn" "Please note that 'rvm ruby' invokes set operations instead."
168
168
  fi
169
169
 
170
170
  rvm_ruby_strings="$(__rvm_expand_ruby_string "$rvm_ruby_strings")"
@@ -180,6 +180,6 @@ if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
180
180
  if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
181
181
  if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
182
182
 
183
- rvm_hook="after_do" ; source $rvm_scripts_path/hook
183
+ rvm_hook="after_do" ; source "$rvm_scripts_path/hook"
184
184
 
185
185
  exit ${#errors[*]}
@@ -7,7 +7,7 @@ source "$rvm_scripts_path/base"
7
7
 
8
8
  __error_on_result() {
9
9
  if [[ "$1" -gt 0 ]]; then
10
- $rvm_scripts_path/log "fail" "$2 - Aborting now."
10
+ "$rvm_scripts_path/log" "fail" "$2 - Aborting now."
11
11
  return 0
12
12
  else
13
13
  return 1
@@ -27,23 +27,23 @@ snapshot_save() {
27
27
  \rm -rf "$snapshot_temp_path"
28
28
  \mkdir -p "$snapshot_temp_path"
29
29
 
30
- $rvm_scripts_path/log "info" "Backing up a list of aliases"
30
+ "$rvm_scripts_path/log" "info" "Backing up a list of aliases"
31
31
  \cp "$rvm_config_path/alias" "$snapshot_temp_path/"
32
32
 
33
- $rvm_scripts_path/log "info" "Backing up your user preferences"
33
+ "$rvm_scripts_path/log" "info" "Backing up your user preferences"
34
34
  \cp "$rvm_config_path/user" "$snapshot_temp_path/"
35
35
 
36
- $rvm_scripts_path/log "info" "Backing up your installed packages"
36
+ "$rvm_scripts_path/log" "info" "Backing up your installed packages"
37
37
  sed -e 's/-//' -e 's/^lib//' < "$rvm_config_path/packages" | awk -F= '{print $1}' | sort | uniq > "$snapshot_temp_path/packages"
38
38
 
39
- $rvm_scripts_path/log "info" "Backing up all of your gemsets"
39
+ "$rvm_scripts_path/log" "info" "Backing up all of your gemsets"
40
40
  \mkdir -p "$snapshot_temp_path/gems"
41
41
  __rvm_pushpop "$snapshot_temp_path/gems"
42
- for snapshot_gemset in $($rvm_scripts_path/list gemsets strings) ; do
42
+ for snapshot_gemset in $("$rvm_scripts_path/list" gemsets strings) ; do
43
43
  __rvm_become "$snapshot_gemset"
44
44
  result="$?"
45
45
  __error_on_result "$result" "Error becoming ruby $snapshot_gemset" && return "$result"
46
- $rvm_scripts_path/gemsets export "${snapshot_gemset}.gems" >/dev/null
46
+ "$rvm_scripts_path/gemsets" export "${snapshot_gemset}.gems" >/dev/null
47
47
  result="$?"
48
48
  __error_on_result "$result" "Error exporting gemset contents for $snapshot_gemset" && return "$result"
49
49
  \mkdir -p "./$snapshot_gemset/"
@@ -51,15 +51,15 @@ snapshot_save() {
51
51
  done; unset snapshot_gemset
52
52
  __rvm_pushpop
53
53
 
54
- $rvm_scripts_path/log "info" "Backing up all of your installed rubies"
54
+ "$rvm_scripts_path/log" "info" "Backing up all of your installed rubies"
55
55
  echo '#!/usr/bin/env bash -e' > "$snapshot_temp_path/install-rubies.sh"
56
56
  echo "source \"\$rvm_scripts_path/rvm\" || true" >> "$snapshot_temp_path/install-rubies.sh"
57
57
  local snapshot_ruby_name_file="$rvm_tmp_path/$$-rubies"
58
58
  local snapshot_alias_name_file="$rvm_tmp_path/$$-aliases"
59
59
  local snapshot_installable_file="$rvm_tmp_path/$$-installable"
60
60
 
61
- $rvm_scripts_path/alias list | awk -F ' => ' '{print $1}' | sort | uniq 2>/dev/null > "$snapshot_alias_name_file"
62
- $rvm_scripts_path/list strings | \tr ' ' '\n' | sort | uniq > "$snapshot_ruby_name_file"
61
+ "$rvm_scripts_path/alias" list | awk -F ' => ' '{print $1}' | sort | uniq 2>/dev/null > "$snapshot_alias_name_file"
62
+ "$rvm_scripts_path/list" strings | \tr ' ' '\n' | sort | uniq > "$snapshot_ruby_name_file"
63
63
  comm -2 -3 "$snapshot_ruby_name_file" "$snapshot_alias_name_file" > "$snapshot_installable_file"
64
64
  \rm -rf "$snapshot_ruby_name_file" "$snapshot_alias_name_file"
65
65
 
@@ -78,7 +78,7 @@ snapshot_save() {
78
78
 
79
79
  \rm -rf "$snapshot_installable_file"
80
80
 
81
- $rvm_scripts_path/log "info" "Compressing snapshotting"
81
+ "$rvm_scripts_path/log" "info" "Compressing snapshotting"
82
82
  local destination_path="$PWD"
83
83
  __rvm_pushpop "$snapshot_temp_path"
84
84
  \rm -rf "$destination_path/$1.tar.gz"
@@ -87,11 +87,10 @@ snapshot_save() {
87
87
  __error_on_result "$result" "Error creating archive $destination_path/$1.tar.gz" && return "$result"
88
88
  __rvm_pushpop
89
89
 
90
- $rvm_scripts_path/log "info" "Cleaning up"
90
+ "$rvm_scripts_path/log" "info" "Cleaning up"
91
91
  \rm -rf "$snapshot_temp_path"
92
92
 
93
- $rvm_scripts_path/log "info" "Snapshot complete"
94
-
93
+ "$rvm_scripts_path/log" "info" "Snapshot complete"
95
94
  }
96
95
 
97
96
  snapshot_load() {
@@ -113,31 +112,31 @@ snapshot_load() {
113
112
  \rm -rf "$snapshot_temp_path"
114
113
  \mkdir -p "$snapshot_temp_path"
115
114
 
116
- $rvm_scripts_path/log "info" "Extracting snapshot"
115
+ "$rvm_scripts_path/log" "info" "Extracting snapshot"
117
116
  __rvm_pushpop "$snapshot_temp_path"
118
117
  tar xzf "$snapshot_archive"
119
118
  result="$?"
120
119
  __error_on_result "$result" "Error extracting the archive '$snapshot_archive'" && return "$result"
121
120
  __rvm_pushpop
122
121
 
123
- $rvm_scripts_path/log "info" "Restoring user settings"
122
+ "$rvm_scripts_path/log" "info" "Restoring user settings"
124
123
  \cp -f "$snapshot_temp_path/user" "$rvm_config_path/user"
125
124
 
126
- $rvm_scripts_path/log "info" "Installing rvm-managed packages"
125
+ "$rvm_scripts_path/log" "info" "Installing rvm-managed packages"
127
126
  for snapshot_package in $(cat "$snapshot_temp_path/packages"); do
128
- $rvm_scripts_path/package install "$snapshot_package"
127
+ "$rvm_scripts_path/package" install "$snapshot_package"
129
128
  result="$?"
130
129
  __error_on_result "$result" "Error installing package '$snapshot_package'" && return "$result"
131
130
  done; unset snapshot_package
132
131
 
133
- $rvm_scripts_path/log "info" "Installing rubies"
132
+ "$rvm_scripts_path/log" "info" "Installing rubies"
134
133
  chmod +x "$snapshot_temp_path/install-rubies.sh"
135
- $snapshot_temp_path/install-rubies.sh
134
+ "$snapshot_temp_path/install-rubies.sh"
136
135
  result="$?"
137
136
  __error_on_result "$result" "Error importing rubies." && return "$result"
138
137
 
139
138
  export rvm_create_flag=1
140
- $rvm_scripts_path/log "info" "Setting up gemsets"
139
+ "$rvm_scripts_path/log" "info" "Setting up gemsets"
141
140
  __rvm_pushpop "$snapshot_temp_path/gems"
142
141
  for snapshot_gemset in $(\ls | \grep '\.gems$' | sed 's/.gems$//'); do
143
142
  __rvm_become "$snapshot_gemset"
@@ -147,17 +146,19 @@ snapshot_load() {
147
146
  \cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/"
148
147
  result="$?"
149
148
  __error_on_result "$result" "Error copying across cache for $snapshot_gemset" && return "$result"
150
- $rvm_scripts_path/gemsets import "$snapshot_gemset" >/dev/null 2>&1
149
+ "$rvm_scripts_path/gemsets" import "$snapshot_gemset" >/dev/null 2>&1
151
150
  result="$?"
152
151
  __error_on_result "$result" "Error importing gemset for $snapshot_gemset" && return "$result"
153
152
  done; unset snapshot_gemset
154
153
  __rvm_pushpop
155
154
 
156
- $rvm_scripts_path/log "info" "Restoring aliases"
155
+ "$rvm_scripts_path/log" "info" "Restoring aliases"
157
156
  while read -r package_info; do
158
- local alias_name="$(echo "$package_info" | awk -F= '{print $1}')"
159
- local alias_ruby="$(echo "$package_info" | awk -F= '{print $2}')"
160
- $rvm_scripts_path/alias create "$alias_name" "$alias_ruby"
157
+ # Note: this assumes an '=' int the input...
158
+ local alias_name="${package_info/=*}"
159
+ local alias_ruby="${package_info/*=}"
160
+
161
+ "$rvm_scripts_path/alias" create "$alias_name" "$alias_ruby"
161
162
  if [[ "$alias_name" = "default" ]]; then
162
163
  (source "$rvm_scripts_path/rvm" && rvm use "$alias_ruby" --default) >/dev/null 2>&1
163
164
  result="$?"
@@ -166,10 +167,10 @@ snapshot_load() {
166
167
  done < "$snapshot_temp_path/alias"
167
168
  unset package_info
168
169
 
169
- $rvm_scripts_path/log "info" "Cleaning up load process"
170
+ "$rvm_scripts_path/log" "info" "Cleaning up load process"
170
171
  \rm -rf "$snapshot_temp_path"
171
172
 
172
- $rvm_scripts_path/log "info" "Loaded snapshot from $(basename "$snapshot_archive")"
173
+ "$rvm_scripts_path/log" "info" "Loaded snapshot from $(basename "$snapshot_archive")"
173
174
  }
174
175
 
175
176
  snapshot_usage() {