rvm 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bash/rvm +48 -35
  2. metadata +1 -1
data/bash/rvm CHANGED
@@ -3,7 +3,7 @@
3
3
  rvm_author="Wayne E. Seguin"
4
4
  rvm_author_email="wayneeseguin@gmail.com"
5
5
  rvm_website="http://github.com/wayneeseguin/rvm"
6
- rvm_version="0.0.9"
6
+ rvm_version="0.0.10"
7
7
  rvm_updated="2009.08.25"
8
8
 
9
9
  #
@@ -364,11 +364,9 @@ function rvm-use {
364
364
  default)
365
365
  # TODO: There is a reproducible bug here when switching off of 1.8.7...
366
366
  # Seems that the path is not reset properly.
367
- rm -f ~/.rvm/current
368
- unset MY_RUBY_HOME
369
- unset GEM_HOME
370
- unset RUBY_VERSION
371
- PATH=$original_path ; export PATH
367
+ rm -f $install_path/current
368
+ source $install_path/default
369
+ PATH="$default_path" ; export PATH
372
370
  ;;
373
371
  #leopard) MY_RUBY_HOME="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr"; GEM_HOME="$HOME/.gem/ruby/1.8" ;;
374
372
 
@@ -435,15 +433,12 @@ function rvm-use {
435
433
  RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
436
434
  export GEM_HOME MY_RUBY_HOME RUBY_VERSION
437
435
 
438
- # Setup ~/.rvm/current
439
- echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:\$PATH ; export PATH" > ~/.rvm/current
436
+ echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$default_path ; export PATH" > $install_path/current
440
437
  for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
441
438
  eval "export $variable"
442
439
  eval value=\$${variable}
443
- echo "${variable}='$value' ; export ${variable}" >> ~/.rvm/current
440
+ echo "${variable}='$value' ; export ${variable}" >> $install_path/current
444
441
  done
445
- else
446
- PATH=$original_path ; export PATH
447
442
  fi
448
443
 
449
444
  info "Switching to $implementation $version $patchlevel ..."
@@ -458,13 +453,13 @@ function rvm-use {
458
453
 
459
454
  function rvm-list {
460
455
  echo -e "\nruby:"
461
- ls -l ~/.rvm/ | awk '/ ruby-[1-2].*/ { print " - " $NF }'
456
+ ls -l $install_path/ | awk '/ ruby-[1-2].*/ { print " - " $NF }'
462
457
  echo
463
458
  echo "jruby:"
464
- ls -l ~/.rvm/ | awk '/jruby-.*/ { print " - " $NF }'
459
+ ls -l $install_path/ | awk '/jruby-.*/ { print " - " $NF }'
465
460
  echo
466
461
  echo "ree:"
467
- ls ~/.rvm/ | awk '/ruby-enterprise-.*/ { print " - " $NF }'
462
+ ls $install_path/ | awk '/ruby-enterprise-.*/ { print " - " $NF }'
468
463
  echo
469
464
  }
470
465
 
@@ -487,6 +482,9 @@ function rvm-gem-dir {
487
482
  fail "Unknown Version: ${2-version}"
488
483
  fi
489
484
  ;;
485
+ default)
486
+ warn "Not Implemented Yet."
487
+ ;;
490
488
  *)
491
489
  fail "Ruby implementation '$implementation' is not known."
492
490
  esac
@@ -500,11 +498,11 @@ function rvm-gem-dir {
500
498
  }
501
499
 
502
500
  function rvm-src-dir {
503
- case "$implementation" in
501
+ case "${1-implementation}" in
504
502
 
505
503
  jruby)
506
- version="${version-1.3.1}"
507
- if [ "$version" = "1.2.0" -o "$version" = "1.3.1" ] ; then
504
+ version=${version-1.3.1}
505
+ if [ "${2-version}" = "1.2.0" -o "${2-version}" = "1.3.1" ] ; then
508
506
  src_dir="$source_path/$implementation-$version"
509
507
  else
510
508
  fail "Unknown jRuby version: $version"
@@ -513,31 +511,35 @@ function rvm-src-dir {
513
511
 
514
512
  ree)
515
513
  version=${version-1.8.6}
516
- if [ "$version" = "1.8.6" ] ; then
517
- src_dir="$source_path/ruby-enterprise-$version-"${3-20090610}""
514
+ if [ "${2-version}" = "1.8.6" -o "${2-version}" = "1.8" ] ; then
515
+ src_dir="$source_path/ruby-enterprise-${2-version}-"${3-20090610}""
518
516
  else
519
- fail "Unknown Ruby Enterprise Edition version: $version"
517
+ fail "Unknown Ruby Enterprise Edition version: ${2-version}"
520
518
  fi
521
519
  ;;
522
520
 
523
521
  ruby)
524
- if [ "$version" = "1.8.7" ] ; then
522
+ if [ "${2-version}" = "1.8.7" ] ; then
525
523
  src_dir="$source_path/ruby-1.8.7-p${patchlevel-174}"
526
524
 
527
- elif [ "${version%\.*}" = "1.8" ] ; then
525
+ elif [ "${2-version}" = "1.8" -o "${2-version}" = "1.8.6" ] ; then
528
526
  src_dir="$source_path/ruby-1.8.6-p${patchlevel-369}"
529
527
 
530
- elif [ "$version" = "1.9.2" ] ; then
528
+ elif [ "${2-version}" = "1.9.2" ] ; then
531
529
  src_dir="$source_path/ruby-1.9.2-p${patchlevel-review1}"
532
530
 
533
- elif [ "${version%\.*}" = "1.9" ] ; then
531
+ elif [ "${2-version}" = "1.9" -o "${2-version}" = "1.9.1" ] ; then
534
532
  src_dir="$source_path/ruby-1.9.1-p${patchlevel-243}"
535
533
 
536
534
  else
537
- fail "Unknown ruby version: $version"
535
+ fail "unknown Ruby version: ${2-version}"
538
536
  fi
539
537
  ;;
540
538
 
539
+ default)
540
+ warn "Invalid request, rvm cannot change to the default source directory."
541
+ ;;
542
+
541
543
  *)
542
544
  fail "Ruby implementation '$implementation' is not known."
543
545
  return 1
@@ -585,9 +587,13 @@ function rvm {
585
587
  install|uninstall|use|path|info|gemdir|setup|version|debug|srcdir|list)
586
588
  action=$token ;;
587
589
  ruby|jruby|ree|default|all)
588
- implementation="$token" ;;
590
+ implementation="$token"
591
+ action="${action-use}"
592
+ ;;
589
593
  1.8|1.8.6|1.8.7|1.9|1.9.1|1.9.2|1.2.0|1.3.1)
590
- version="$token" ;;
594
+ version="$token"
595
+ action="${action-use}"
596
+ ;;
591
597
  -v|--version)
592
598
  if [ -z "$1" ] ; then
593
599
  action="version"
@@ -621,17 +627,24 @@ function rvm {
621
627
  else
622
628
  prefix_path=${prefix-$HOME/.}
623
629
  fi
624
- source_path="${source_path-${prefix_path}rvm/src}"
630
+ source_path="${source_path-$install_path/src}"
625
631
  install_path="${prefix_path}rvm"
626
632
 
627
- mkdir -p ~/.rvm/ $source_path $install_path
633
+ mkdir -p $prefix_path $source_path $install_path
628
634
 
629
- if [ -f ~/.rvm/original_path ] ; then
630
- original_path=`cat ~/.rvm/original_path`
635
+ if [ ! -f $install_path/default ] ; then
636
+ for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME PATH ; do
637
+ eval "export $variable"
638
+ eval value=\$${variable}
639
+ echo "${variable}='$value' ; export ${variable}" >> $install_path/default
640
+ done
631
641
  fi
632
- if [ -z "$original_path" ] ; then
633
- echo $PATH > $install_path/.original_path
634
- original_path=$PATH
642
+
643
+ if [ -s $install_path/default_path ] ; then
644
+ default_path=`cat $install_path/default_path`
645
+ else
646
+ echo $PATH > $install_path/default_path
647
+ default_path=$PATH
635
648
  fi
636
649
 
637
650
  if [ "$debug" = "1" ] ; then set -x ; fi
@@ -666,7 +679,7 @@ function rvm {
666
679
  info "ruby: `which ruby`\ngem: `which gem`\nirb: `which irb`"
667
680
  info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"%5}')"
668
681
  info "\n.bash_profile: \n$(cat ~/.bash_profile | tail -n 5)\n"
669
- info "\n.rvm/current: \n$(cat ~/.rvm/current)\n"
682
+ info "\n$install_path/current: \n$($install_path/current)\n"
670
683
  return 0
671
684
  ;;
672
685
  *)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin