rvm 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/LICENCE +18 -0
  2. data/bash/rvm +51 -55
  3. data/bin/rvm-install +1 -1
  4. data/lib/rvm.rb +3 -0
  5. metadata +4 -2
data/LICENCE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2009 Wayne E. Seguin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bash/rvm CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
 
3
3
  rvm_author="Wayne E. Seguin"
4
- rvm_version="0.0.1"
4
+ rvm_version="0.0.2"
5
5
  rvm_updated="2009.08.23"
6
6
 
7
7
  #
@@ -17,27 +17,26 @@ function usage {
17
17
 
18
18
  Usage:
19
19
 
20
- $0 Action [Implementation] [Options]
20
+ rvm Action [Implementation] [Options]
21
21
 
22
22
  Action:
23
23
 
24
- install - Install a ruby version, default is from source
24
+ * usage - Show this usage information
25
25
  use - Switch to using a specific ruby versio (new login shell)
26
- path - Set path for current ruby
27
26
  info - Show information for current ruby
28
27
  gemdir - Switch to gem directory for installation (new login shell)
29
28
  gemdup - Clone source implementation version gems to currently used version
30
- setup - Place rvm to in default path (~/.bin/ && .profile)
31
- * usage - Show this usage information
29
+ install - Install a ruby version, default is from source
30
+ debug - Emit environment and configuration information for debugging
32
31
 
33
32
  Implementation:
34
33
 
35
- * ruby - MRI/YARV Ruby (The Standard)
34
+ * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
36
35
  jruby - jRuby
37
36
  ree - Ruby Enterprise Edition
38
- rubinius - Rubinius (NI)
39
- leopard - Leopard's system Ruby ( Mac OS X only )
37
+ rubinius - Rubinius (NIY)
40
38
  default - Resets to the default system ruby
39
+ all - Used with install, installs all latest known versions
41
40
 
42
41
  Options:
43
42
 
@@ -45,16 +44,32 @@ function usage {
45
44
  -l|--level - Patch level for the specified Ruby version
46
45
  -p|--prefix - Package and source directory prefix, with trailing slash!
47
46
  Default is a users home directory and /usr/local/ for root
48
- -m|--manager - Package Manager to use, one of:
49
- {port,aptitude,apt-get,emerge,yum,pacman}
50
- -d|--debug - Toggle debug mode on
47
+ -d|--debug - Toggle debug mode on for extra messages (NIY)
51
48
 
52
49
  Notes:
53
50
 
54
- * Defaults are denoted with a * prefix.
51
+ * Defaults above are denoted with a '*' prefix.
52
+ * rvm is intended to be run as an individual user (not root, yet)
53
+ * All ruby installation, configuration and source files are in ~/.rvm
54
+ * To manually reset to defaults: "rm -f ~/.rvm/current", then open new shell
55
+ * To preserve previous gem installations for a particular ruby version copy,
56
+ move, symlink or copy the old gem directory to (1.8 for 1.8.X):
57
+ ~/.gem/\$interpreter/\$version
58
+
59
+ Examples:
60
+
61
+ $ gem install rvm # Install the rvm gem
62
+ $ rvm-install # Install rvm, adds source hooks to ~/.bash_profile
63
+ $ rvm install jruby # Install jRuby, default 1.3.1
64
+ $ rvm use ruby -v 1.9.1 # Use Ruby 1.9, install first if not installed
65
+ $ rvm use -v 1.9 # Equivalent to above, because of defaults
66
+ $ rvm use default # Use the system default (as if no rvm)
55
67
 
56
68
  TODO: (in order)
57
69
 
70
+ * Documentation
71
+ * Change gemdir to simply allow for a path to base gem dir to clone from
72
+ * Debug level messages
58
73
  * Rubinius (not in first revisions)
59
74
  * Shell detection instead of simply assuming bash (not in first revisions)
60
75
 
@@ -123,14 +138,6 @@ function ruby-install-source {
123
138
  function ruby-install {
124
139
 
125
140
  case "$implementation" in
126
- leopard) # no-op
127
- system_type=`uname`
128
- if [ "$system_type" = "Darwin" ] ; then
129
- echo "Leopard ruby is not installable via rvm."
130
- else
131
- fail "leopard ruby is the default ruby installed on Mac OS X (Darwin), you are on: $system_type"
132
- fi
133
- ;;
134
141
 
135
142
  ree)
136
143
  version=${version-1.8.6}
@@ -198,11 +205,7 @@ function ruby-use {
198
205
  unset ruby_home
199
206
  unset GEM_HOME
200
207
  ;;
201
-
202
- leopard)
203
- ruby_home="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr"
204
- GEM_HOME="$HOME/.gem/ruby/1.8"
205
- ;;
208
+ #leopard) ruby_home="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr"; GEM_HOME="$HOME/.gem/ruby/1.8" ;;
206
209
 
207
210
  jruby)
208
211
  version="${version-1.3.1}"
@@ -279,7 +282,6 @@ function ruby-use {
279
282
  function ruby-gem-dir {
280
283
 
281
284
  case "$implementation" in
282
- leopard) GEM_HOME="$HOME/.gem/ruby/1.8" ;;
283
285
  jruby) GEM_HOME="$HOME/.gem/jruby/1.8" ;;
284
286
  ree) GEM_HOME="$HOME/.gem/ruby-enterprise/1.8" ;;
285
287
  ruby)
@@ -308,7 +310,6 @@ function ruby-gem-dup {
308
310
 
309
311
  # TODO: use ruby-gem-dir for this once it has stabilized
310
312
  case "$source_implementation" in
311
- leopard) gemdir="$HOME/.gem/ruby/1.8" ;;
312
313
  jruby) gemdir="$HOME/.gem/jruby/1.8" ;;
313
314
  ree) gemdir="$HOME/.gem/ruby-enterprise/1.8" ;;
314
315
  ruby)
@@ -338,40 +339,23 @@ function ruby-gem-dup {
338
339
 
339
340
  }
340
341
 
341
- function rvm-setup {
342
-
343
- rm -f ~/.bin/rvm
344
- bindir=$(dirname `which rvm`)
345
- gemsdir="$(dirname $bindir)/gems"
346
- cd $gemsdir/`ls -t ~/.gem/ruby/1.8/gems | grep rvm | head -n 1`
347
- bash/rvm-setup
348
-
349
- info "~/.bin/rvm is symlinked to the gem's rvm script and ~/.bin is in your path.\n" \
350
- "You may now use rvm via the command line the next time you open a terminal shell."
351
-
352
- }
353
-
354
- function rvm-version {
355
-
356
- info "rvm $rvm_version"
357
-
358
- }
342
+ function rvm-version { info "rvm $rvm_version" ; }
359
343
 
360
344
  function rvm {
361
345
 
362
346
  while [ $# -gt 0 ] ; do
363
347
  arg="$1" ; shift
364
348
  case "$arg" in
365
- install|use|path|info|gemdir|gemdup|setup|version)
349
+ install|use|path|info|gemdir|gemdup|setup|version|debug)
366
350
  action=$arg ;;
367
- ruby|jruby|ree|leopard|default)
351
+ ruby|jruby|ree|default|all)
368
352
  implementation="$arg" ;;
369
353
  -v|--version) version="$1" ; shift ;;
370
354
  -l|--level) patchlevel="$1" ; shift ;;
371
355
  -p|--prefix) install_path="$1" ; shift ;;
372
356
  -m|--manager) manager="$1" ; shift ;;
373
357
  -d|--debug) debug=true ;;
374
- *) usage
358
+ *) usage ; return 1
375
359
  esac
376
360
  done
377
361
 
@@ -401,11 +385,11 @@ function rvm {
401
385
  if [ "$implementation" = "all" ] ; then
402
386
  for implementation in ruby jruby ree ; do
403
387
  if [ "$implementation" = "ruby" ] ; then
404
- for versions in 1.8.6 1.8.7 1.9.1 ; do
405
- ruby-install
388
+ for version in 1.8.6 1.8.7 1.9.1 ; do
389
+ ruby-install $implementation $version $patchlevel
406
390
  done
407
391
  else
408
- ruby-install
392
+ ruby-install $implementation $version $patchlevel
409
393
  fi
410
394
  done
411
395
  else
@@ -415,11 +399,23 @@ function rvm {
415
399
  use) ruby-use $implementation $version $patchlevel ;;
416
400
  gemdir) ruby-gem-dir $implementation $version $patchlevel ;;
417
401
  gemdup) ruby-gem-dup $implementation $version $patchlevel ;;
418
- path) ruby-path $implementation $version $patchlevel ;;
419
402
  info) ruby-info $implementation $version $patchlevel ;;
420
403
  version) rvm-version ;;
421
- setup) rvm-setup ;;
422
- *) usage ; fail "unknown action '$action'"
404
+ debug)
405
+ rvm-version
406
+ info "GEM_HOME: $GEM_HOME\nMY_RUBY_HOME: $MY_RUBY_HOME"
407
+ info "ruby: `which ruby`\ngem: `which gem`\nirb: `which irb`"
408
+ info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"%5}')"
409
+ info "\n.bash_profile: \n$(cat ~/.bash_profile | tail -n 5)\n"
410
+ info "\n.rvm/current: \n$(cat ~/.rvm/current)\n"
411
+ return 0
412
+ ;;
413
+ *)
414
+ usage
415
+ if [ ! -z "$action" ] ; then
416
+ fail "unknown action '$action'"
417
+ fi
418
+ return 1
423
419
  esac
424
420
 
425
421
  }
data/bin/rvm-install CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # Hot potato!!! Bash it!
4
- exec "bash -c 'cd #{File.dirname(File.dirname(__FILE__))} && ./bash/rvm-install #{ARGV.join(' ')}'"
4
+ exec "bash -c 'cd #{File.dirname(File.dirname(__FILE__))} && ./bash/rvm-install #{ARGV.join(' ')} ; source ~/.bash_profile'"
5
5
 
data/lib/rvm.rb ADDED
@@ -0,0 +1,3 @@
1
+ module RVM
2
+ VERSION = YAML.load_file("#{File.dirname(File.dirname(__FILE__))}/VERSION.yml")
3
+ end
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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-23 00:00:00 -04:00
12
+ date: 2009-08-24 00:00:00 -04:00
13
13
  default_executable: rvm-install
14
14
  dependencies: []
15
15
 
@@ -23,9 +23,11 @@ extra_rdoc_files:
23
23
  - README
24
24
  files:
25
25
  - INSTALL
26
+ - LICENCE
26
27
  - README
27
28
  - bash/rvm
28
29
  - bash/rvm-install
30
+ - lib/rvm.rb
29
31
  has_rdoc: true
30
32
  homepage: http://github.com/wayneeseguin/rvm
31
33
  licenses: []