wayneeseguin-rvm 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README +26 -22
  2. data/bash/rvm +102 -22
  3. data/bash/rvm-install +6 -0
  4. metadata +1 -1
data/README CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  About:
3
3
 
4
- rvm 0.0.5 http://github.com/wayneeseguin/rvm
4
+ rvm 0.0.8 http://github.com/wayneeseguin/rvm
5
5
 
6
6
  by Wayne E. Seguin (wayneeseguin@gmail.com)
7
7
 
@@ -11,23 +11,24 @@
11
11
 
12
12
  Action:
13
13
 
14
- * usage - Show this usage information
15
- use - Switch to using a specific ruby versio (new login shell)
16
- info - Show information for current ruby
17
- gemdir - Switch to gem directory for installation (new login shell)
18
- srcdir - Switch to src directory for the current ruby installation
19
- gemdup - Clone source implementation version gems to currently used version
20
- (expiramental)
21
- install - Install a ruby version, default is from source
22
- debug - Emit environment and configuration information for debugging
14
+ * usage - Show this usage information
15
+ use - Switch to using a specific ruby versio (new login shell)
16
+ info - Show information for current ruby
17
+ gemdir - Switch to gem directory for installation (new login shell)
18
+ srcdir - Switch to src directory for the current ruby installation
19
+ gemdup - Clone source implementation version gems to currently used version
20
+ (expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
21
+ install - Install a ruby version, default is from source
22
+ uninstall - Uninstall a ruby version
23
+ debug - Emit environment and configuration information for debugging
23
24
 
24
25
  Implementation:
25
26
 
26
- * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
27
- jruby - jRuby
28
- ree - Ruby Enterprise Edition
29
- default - Resets to the default system ruby
30
- all - Used with install, installs all latest known versions
27
+ * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
28
+ jruby - jRuby
29
+ ree - Ruby Enterprise Edition
30
+ default - Resets to the default system ruby
31
+ all - Used with install, installs all latest known versions
31
32
 
32
33
  Options:
33
34
 
@@ -50,17 +51,20 @@
50
51
 
51
52
  Examples:
52
53
 
53
- $ gem install rvm # Install the rvm gem
54
- $ rvm-install # Install rvm, adds source hooks for bash & zsh
55
- $ rvm install jruby # Install jRuby (default version is 1.3.1)
56
- $ rvm use ruby -v 1.9.1 # Use Ruby 1.9.1, installs if necessary
57
- $ rvm use 1.9 # Equivalent to above, due to defaults
58
- $ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
59
- $ rvm use default # Use the system default (as if no rvm)
54
+ $ gem install rvm # Install the rvm gem
55
+ $ rvm-install # Install rvm, adds hooks for bash & zsh
56
+ $ rvm install jruby # Install jRuby (default version is 1.3.1)
57
+ $ rvm use ruby -v 1.9.1 # Use Ruby 1.9.1, installs if necessary
58
+ $ rvm use 1.9 # Equivalent to above, due to defaults
59
+ $ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
60
+ $ rvm use default # Use the system default (as if no rvm)
61
+ $ rvm gemdup ~/.gem/ruby/1.8/ # Install gems from ~/.gem/ruby/1.8/
60
62
 
61
63
  TODO: (in order)
62
64
 
63
65
  * rvm gemdir default
66
+ * root support
67
+ * Settings file, user overridable
64
68
 
65
69
  Credits:
66
70
 
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.8"
6
+ rvm_version="0.0.9"
7
7
  rvm_updated="2009.08.25"
8
8
 
9
9
  #
@@ -32,6 +32,7 @@ function rvm-usage {
32
32
  * usage - Show this usage information
33
33
  use - Switch to using a specific ruby versio (new login shell)
34
34
  info - Show information for current ruby
35
+ list - Show currently installed versions
35
36
  gemdir - Switch to gem directory for installation (new login shell)
36
37
  srcdir - Switch to src directory for the current ruby installation
37
38
  gemdup - Clone source implementation version gems to currently used version
@@ -81,6 +82,9 @@ function rvm-usage {
81
82
  TODO: (in order)
82
83
 
83
84
  * rvm gemdir default
85
+ * root support
86
+ * Settings file, user overridable
87
+ * Show current in rvm list, if applicable
84
88
 
85
89
  Credits:
86
90
 
@@ -292,16 +296,78 @@ function rvm-install-ruby {
292
296
 
293
297
  }
294
298
 
299
+ function rvm-uninstall {
300
+
301
+ implementation="${1-$implementation}"
302
+ case "$implementation" in
303
+
304
+ jruby)
305
+ version="${version-1.3.1}"
306
+ if [ "$version" = "1.2.0" -o "$version" = "1.3.1" ] ; then
307
+ package_name="jruby*-$version"
308
+ else
309
+ fail "Unknown jRuby version: $version"
310
+ fi
311
+ ;;
312
+
313
+ ree)
314
+ version=${version-1.8.6}
315
+ if [ "$version" = "1.8.6" ] ; then
316
+ package_name="$install_path/ruby-enterprise-$version-${3-20090610}"
317
+ else
318
+ fail "Unknown Ruby Enterprise Edition version: $version"
319
+ fi
320
+ ;;
321
+
322
+ ruby)
323
+ if [ "$version" = "1.8.7" ] ; then
324
+ package_name="ruby-1.8.7-p${patchlevel-174}"
325
+
326
+ elif [ "$version" = "1.8.6" -o "$version" = "1.8" ] ; then
327
+ package_name="ruby-1.8.6-p${patchlevel-369}"
328
+
329
+ elif [ "$version" = "1.9.2" ] ; then
330
+ package_name="ruby-1.9.2-p${patchlevel-review1}"
331
+
332
+ elif [ "$version" = "1.9.1" -o "$version" = "1.9" ] ; then
333
+ package_name="ruby-1.9.1-p${patchlevel-243}"
334
+
335
+ else
336
+ fail "Unknown ruby version: $version"
337
+ fi
338
+ ;;
339
+
340
+ *)
341
+ fail "Ruby implementation '$implementation' is not known."
342
+
343
+ esac
344
+
345
+ if [ ! -z "$package_name" ] ; then
346
+ for path in $source_path $install_path ; do
347
+ if [ -d $path/$package_name ] ; then
348
+ info "Removing $path/$package_name"
349
+ rm -rf $path/$package_name
350
+ fi
351
+ done
352
+ else
353
+ fail "Cannot uninstall unknown package '$package_name'"
354
+ fi
355
+
356
+ }
357
+
295
358
  function rvm-use {
296
359
 
297
360
  implementation="${1-$implementation}"
298
361
  case "$implementation" in
299
362
 
300
363
  default)
364
+ # TODO: There is a reproducible bug here when switching off of 1.8.7...
365
+ # Seems that the path is not reset properly.
301
366
  rm -f ~/.rvm/current
302
367
  unset MY_RUBY_HOME
303
368
  unset GEM_HOME
304
369
  unset RUBY_VERSION
370
+ PATH=$original_path ; export PATH
305
371
  ;;
306
372
  #leopard) MY_RUBY_HOME="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr"; GEM_HOME="$HOME/.gem/ruby/1.8" ;;
307
373
 
@@ -388,6 +454,18 @@ function rvm-use {
388
454
  fail "Your shell is not supported bash and zsh are currently supported."
389
455
  fi
390
456
  }
457
+
458
+ function rvm-list {
459
+ echo -e "\nruby:"
460
+ ls -l ~/.rvm/ | awk '/ ruby-[1-2].*/ { print " - " $NF }'
461
+ echo
462
+ echo "jruby:"
463
+ ls -l ~/.rvm/ | awk '/jruby-.*/ { print " - " $NF }'
464
+ echo
465
+ echo "ree:"
466
+ ls ~/.rvm/ | awk '/ruby-enterprise-.*/ { print " - " $NF }'
467
+ echo
468
+ }
391
469
 
392
470
  function rvm-gem-dir {
393
471
 
@@ -503,7 +581,7 @@ function rvm {
503
581
  while [ $# -gt 0 ] ; do
504
582
  token="$1" ; shift
505
583
  case "$token" in
506
- install|use|path|info|gemdir|setup|version|debug|srcdir)
584
+ install|uninstall|use|path|info|gemdir|setup|version|debug|srcdir|list)
507
585
  action=$token ;;
508
586
  ruby|jruby|ree|default|all)
509
587
  implementation="$token" ;;
@@ -573,28 +651,30 @@ function rvm {
573
651
  rvm-install-ruby $implementation $version $patchlevel
574
652
  fi
575
653
  ;;
576
- use) rvm-use $implementation $version $patchlevel ;;
577
- gemdir) rvm-gem-dir $implementation $version $patchlevel ;;
578
- srcdir) rvm-src-dir $implementation $version $patchlevel ;;
579
- gemdup) rvm-gem-dup $implementation $version $patchlevel ;;
580
- info) rvm-info $implementation $version $patchlevel ;;
581
- version) rvm-version ;;
582
- debug)
583
- rvm-version
584
- info "GEM_HOME: $GEM_HOME\nMY_RUBY_HOME: $MY_RUBY_HOME"
585
- info "ruby: `which ruby`\ngem: `which gem`\nirb: `which irb`"
586
- info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"%5}')"
587
- info "\n.bash_profile: \n$(cat ~/.bash_profile | tail -n 5)\n"
588
- info "\n.rvm/current: \n$(cat ~/.rvm/current)\n"
589
- return 0
654
+ uninstall) rvm-uninstall $implementation $version $patchlevel ;;
655
+ use) rvm-use $implementation $version $patchlevel ;;
656
+ list) rvm-list ;;
657
+ gemdir) rvm-gem-dir $implementation $version $patchlevel ;;
658
+ srcdir) rvm-src-dir $implementation $version $patchlevel ;;
659
+ gemdup) rvm-gem-dup $implementation $version $patchlevel ;;
660
+ info) rvm-info $implementation $version $patchlevel ;;
661
+ version) rvm-version ;;
662
+ debug)
663
+ rvm-version
664
+ info "GEM_HOME: $GEM_HOME\nMY_RUBY_HOME: $MY_RUBY_HOME"
665
+ info "ruby: `which ruby`\ngem: `which gem`\nirb: `which irb`"
666
+ info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"%5}')"
667
+ info "\n.bash_profile: \n$(cat ~/.bash_profile | tail -n 5)\n"
668
+ info "\n.rvm/current: \n$(cat ~/.rvm/current)\n"
669
+ return 0
590
670
  ;;
591
671
  *)
592
- if [ ! -z "$action" ] ; then
593
- fail "unknown action '$action'"
594
- else
595
- rvm-usage
596
- fi
597
- return 1
672
+ if [ ! -z "$action" ] ; then
673
+ fail "unknown action '$action'"
674
+ else
675
+ rvm-usage
676
+ fi
677
+ return 1
598
678
  esac
599
679
 
600
680
  set +x
data/bash/rvm-install CHANGED
@@ -1,5 +1,11 @@
1
1
  #!/bin/bash
2
2
 
3
+ user=`whoami`
4
+ if [ "$user" = "root" ] ; then
5
+ echo -e "\e[0;31m <e> \e[0mroot user support is not yet implemented."
6
+ exit 1
7
+ fi
8
+
3
9
  mkdir -p ~/.rvm/src ~/.rvm/bin
4
10
 
5
11
  cp $(pwd)/bash/rvm ~/.rvm/bin/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wayneeseguin-rvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin