rvm 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +7 -3
  2. data/bash/rvm +58 -21
  3. metadata +1 -1
data/README CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  About:
3
3
 
4
- rvm 0.0.9 http://github.com/wayneeseguin/rvm
4
+ rvm 0.0.10 http://github.com/wayneeseguin/rvm
5
5
 
6
6
  by Wayne E. Seguin (wayneeseguin@gmail.com)
7
7
 
@@ -18,7 +18,7 @@
18
18
  gemdir - Switch to gem directory for installation (new login shell)
19
19
  srcdir - Switch to src directory for the current ruby installation
20
20
  gemdup - Clone source implementation version gems to currently used version
21
- (expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
21
+ (highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
22
22
  install - Install a ruby version, default is from source
23
23
  uninstall - Uninstall a ruby version
24
24
  debug - Emit environment and configuration information for debugging
@@ -60,10 +60,14 @@
60
60
  $ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
61
61
  $ rvm use default # Use the system default (as if no rvm)
62
62
  $ rvm gemdup ~/.gem/ruby/1.8/ # Install gems from ~/.gem/ruby/1.8/
63
+ $ rvm gemdir # Switch to gems directory for current ruby
64
+ $ rvm gemdir system # Switch to the system gems directory
65
+ $ rvm gemdir system user # Switch to the system user gems directory
66
+ $ rvm gemdir ruby 1.9 # Switch to gems directory for ruby 1.9.1
63
67
 
64
68
  TODO: (in order)
65
69
 
66
- * rvm gemdir default
70
+ * rvm gemdup
67
71
  * root support
68
72
  * Settings file, user overridable
69
73
  * Show current in rvm list, if applicable
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.10"
6
+ rvm_version="0.0.11"
7
7
  rvm_updated="2009.08.25"
8
8
 
9
9
  #
@@ -78,11 +78,14 @@ function rvm-usage {
78
78
  $ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
79
79
  $ rvm use default # Use the system default (as if no rvm)
80
80
  $ rvm gemdup ~/.gem/ruby/1.8/ # Install gems from ~/.gem/ruby/1.8/
81
+ $ rvm gemdir # Switch to gems directory for current ruby
82
+ $ rvm gemdir system # Switch to the system gems directory
83
+ $ rvm gemdir system user # Switch to the system user gems directory
84
+ $ rvm gemdir ruby 1.9 # Switch to gems directory for ruby 1.9.1
81
85
 
82
86
  TODO: (in order)
83
87
 
84
88
  * rvm gemdup
85
- * rvm gemdir default
86
89
  * root support
87
90
  * Settings file, user overridable
88
91
  * Show current in rvm list, if applicable
@@ -465,25 +468,34 @@ function rvm-list {
465
468
 
466
469
  function rvm-gem-dir {
467
470
 
468
- case "${1-implementation}" in
471
+ implementation=${1-$implementation}
472
+ if [ "$implementation" = "" ] ; then implementation="current" ; fi
473
+
474
+ case "$implementation" in
469
475
  jruby) GEM_HOME="$HOME/.gem/jruby/1.8" ;;
470
476
  ree) GEM_HOME="$HOME/.gem/ruby-enterprise/1.8" ;;
471
477
  ruby)
472
- if [ "${2-version}" = "1.8" -o "${2-version}" = "1.8.6" ] ; then
478
+ if [ "${2-$version}" = "1.8" -o "${2-$version}" = "1.8.6" ] ; then
473
479
  GEM_HOME="$HOME/.gem/ruby/1.8"
474
480
 
475
- elif [ "${2-version}" = "1.9.2" ] ; then
481
+ elif [ "${2-$version}" = "1.9.2" ] ; then
476
482
  GEM_HOME="$HOME/.gem/ruby/1.9.2"
477
483
 
478
- elif [ "${2-version}" = "1.9" -o "${2-version}" = "1.9.1" ] ; then
484
+ elif [ "${2-$version}" = "1.9" -o "${2-$version}" = "1.9.1" ] ; then
479
485
  GEM_HOME="$HOME/.gem/ruby/1.9.1"
480
486
 
481
487
  else
482
- fail "Unknown Version: ${2-version}"
488
+ fail "Unknown Version: ${2-$version}"
483
489
  fi
484
490
  ;;
485
- default)
486
- warn "Not Implemented Yet."
491
+ current)
492
+ GEM_HOME=$(ruby -r rubygems -e "puts Gem::default_path.compact.first")
493
+ ;;
494
+ system)
495
+ GEM_HOME=$default_system_gem_path
496
+ ;;
497
+ user)
498
+ GEM_HOME=$default_gem_path
487
499
  ;;
488
500
  *)
489
501
  fail "Ruby implementation '$implementation' is not known."
@@ -498,11 +510,11 @@ function rvm-gem-dir {
498
510
  }
499
511
 
500
512
  function rvm-src-dir {
501
- case "${1-implementation}" in
513
+ case "${1-$implementation}" in
502
514
 
503
515
  jruby)
504
516
  version=${version-1.3.1}
505
- if [ "${2-version}" = "1.2.0" -o "${2-version}" = "1.3.1" ] ; then
517
+ if [ "${2-$version}" = "1.2.0" -o "${2-$version}" = "1.3.1" ] ; then
506
518
  src_dir="$source_path/$implementation-$version"
507
519
  else
508
520
  fail "Unknown jRuby version: $version"
@@ -511,28 +523,28 @@ function rvm-src-dir {
511
523
 
512
524
  ree)
513
525
  version=${version-1.8.6}
514
- if [ "${2-version}" = "1.8.6" -o "${2-version}" = "1.8" ] ; then
515
- src_dir="$source_path/ruby-enterprise-${2-version}-"${3-20090610}""
526
+ if [ "${2-$version}" = "1.8.6" -o "${2-$version}" = "1.8" ] ; then
527
+ src_dir="$source_path/ruby-enterprise-${2-$version}-"${3-20090610}""
516
528
  else
517
- fail "Unknown Ruby Enterprise Edition version: ${2-version}"
529
+ fail "Unknown Ruby Enterprise Edition version: ${2-$version}"
518
530
  fi
519
531
  ;;
520
532
 
521
533
  ruby)
522
- if [ "${2-version}" = "1.8.7" ] ; then
534
+ if [ "${2-$version}" = "1.8.7" ] ; then
523
535
  src_dir="$source_path/ruby-1.8.7-p${patchlevel-174}"
524
536
 
525
- elif [ "${2-version}" = "1.8" -o "${2-version}" = "1.8.6" ] ; then
537
+ elif [ "${2-$version}" = "1.8" -o "${2-$version}" = "1.8.6" ] ; then
526
538
  src_dir="$source_path/ruby-1.8.6-p${patchlevel-369}"
527
539
 
528
- elif [ "${2-version}" = "1.9.2" ] ; then
540
+ elif [ "${2-$version}" = "1.9.2" ] ; then
529
541
  src_dir="$source_path/ruby-1.9.2-p${patchlevel-review1}"
530
542
 
531
- elif [ "${2-version}" = "1.9" -o "${2-version}" = "1.9.1" ] ; then
543
+ elif [ "${2-$version}" = "1.9" -o "${2-$version}" = "1.9.1" ] ; then
532
544
  src_dir="$source_path/ruby-1.9.1-p${patchlevel-243}"
533
545
 
534
546
  else
535
- fail "unknown Ruby version: ${2-version}"
547
+ fail "unknown Ruby version: ${2-$version}"
536
548
  fi
537
549
  ;;
538
550
 
@@ -556,7 +568,7 @@ function rvm-src-dir {
556
568
  # clones from source implementation/version to current
557
569
  function rvm-gem-dup {
558
570
 
559
- gem_dir=$1 # TODO: check for and remove trailing /gems
571
+ gem_dir=${1-$default_gem_path} # TODO: check for and remove trailing /gems
560
572
  if [ ! -z "$gem_dir" ] ; then
561
573
  for gem_name_version in `ls $gem_dir/gems` ; do
562
574
  gem_name=${gem_name_version%-*}
@@ -584,12 +596,22 @@ function rvm {
584
596
  while [ $# -gt 0 ] ; do
585
597
  token="$1" ; shift
586
598
  case "$token" in
587
- install|uninstall|use|path|info|gemdir|setup|version|debug|srcdir|list)
599
+ install|uninstall|use|path|info|setup|version|debug|srcdir|list)
588
600
  action=$token ;;
589
601
  ruby|jruby|ree|default|all)
590
602
  implementation="$token"
591
603
  action="${action-use}"
592
604
  ;;
605
+ gemdir)
606
+ action=$token
607
+ if [ "$2" = "system" ] ; then
608
+ implementation="system"
609
+ elif [ "$1" = "user" ] ; then
610
+ implementation="user"
611
+ else
612
+ implementation="current"
613
+ fi
614
+ ;;
593
615
  1.8|1.8.6|1.8.7|1.9|1.9.1|1.9.2|1.2.0|1.3.1)
594
616
  version="$token"
595
617
  action="${action-use}"
@@ -647,6 +669,21 @@ function rvm {
647
669
  default_path=$PATH
648
670
  fi
649
671
 
672
+ # default (user) gem path
673
+ if [ -s $install_path/default_gem_path ] ; then
674
+ default_gem_path=`cat $install_path/default_gem_path`
675
+ else
676
+ ruby -r rubygems -e "puts Gem::default_path.compact.first" > $install_path/default_gem_path
677
+ fi
678
+
679
+ # system gem path
680
+ if [ -s $install_path/default_system_gem_path ] ; then
681
+ default_system_gem_path=`cat $install_path/default_system_gem_path`
682
+ else
683
+ ruby -r rubygems -e "puts Gem::default_path.compact[1] || Gem::default_path.compact.first" > $install_path/default_system_gem_path
684
+ fi
685
+
686
+
650
687
  if [ "$debug" = "1" ] ; then set -x ; fi
651
688
 
652
689
  case "$action" in
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.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin