wayneeseguin-rvm 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (8) hide show
  1. data/INSTALL +1 -0
  2. data/LICENCE +18 -0
  3. data/README +79 -0
  4. data/bash/rvm +529 -0
  5. data/bash/rvm-install +31 -0
  6. data/bin/rvm-install +5 -0
  7. data/lib/rvm.rb +3 -0
  8. metadata +60 -0
data/INSTALL ADDED
@@ -0,0 +1 @@
1
+ From the *project directory* run bin/rvm-install
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/README ADDED
@@ -0,0 +1,79 @@
1
+
2
+ About:
3
+
4
+ rvm 0.0.5 http://github.com/wayneeseguin/rvm
5
+
6
+ by Wayne E. Seguin (wayneeseguin@gmail.com)
7
+
8
+ Usage:
9
+
10
+ rvm Action [Implementation] [Options]
11
+
12
+ Action:
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
23
+
24
+ Implementation:
25
+
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
31
+
32
+ Options:
33
+
34
+ -v|--version - Ruby Package Version, defaults to 'latest'
35
+ -l|--level - Patch level for the specified Ruby version
36
+ -p|--prefix - Package and source directory prefix, with trailing slash!
37
+ Default is a users home directory and /usr/local/ for root
38
+ -c|--configure - Options for source compile (default: --enable-shared)
39
+ -d|--debug - Toggle debug mode on for extra messages (NYI)
40
+
41
+ Notes:
42
+
43
+ * Defaults above are denoted with a '*' prefix.
44
+ * rvm is intended to be run as an individual user (not root, yet)
45
+ * All ruby installation, configuration and source files are in ~/.rvm
46
+ * To manually reset to defaults: "rm -f ~/.rvm/current", then open new shell
47
+ * To preserve previous gem installations for a particular ruby version copy,
48
+ move, symlink or copy the old gem directory to (1.8 for 1.8.X):
49
+ ~/.gem/$interpreter/$version
50
+
51
+ Examples:
52
+
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)
60
+
61
+ TODO: (in order)
62
+
63
+ * rvm gemdir default
64
+
65
+ Credits:
66
+
67
+ Bash Support Testing
68
+
69
+ - Daniel Neighman (dneighman@gmail.com)
70
+ irc: hassox ; github: http://github.com/hassox
71
+
72
+ - John Mettraux (jmettraux@openwfe.org)
73
+ irc: jmettraux ; github: http://github.com/jmettraux
74
+
75
+ ZSH Support Testing
76
+
77
+ - Franco Lazzarino (flazzarino@gmail.com)
78
+ irc: flazz ; github: http://github.com/flazz
79
+
data/bash/rvm ADDED
@@ -0,0 +1,529 @@
1
+ #!/bin/bash
2
+
3
+ rvm_author="Wayne E. Seguin"
4
+ rvm_author_email="wayneeseguin@gmail.com"
5
+ rvm_website="http://github.com/wayneeseguin/rvm"
6
+ rvm_version="0.0.5"
7
+ rvm_updated="2009.08.23"
8
+
9
+ #
10
+ # License: See LICENSE
11
+ #
12
+
13
+ #
14
+ # Functions
15
+ #
16
+ function rvm-usage {
17
+
18
+ cat <<-Usage
19
+
20
+ About:
21
+
22
+ rvm ${rvm_version} ${rvm_website}
23
+
24
+ by ${rvm_author} (${rvm_author_email})
25
+
26
+ Usage:
27
+
28
+ rvm Action [Implementation] [Options]
29
+
30
+ Action:
31
+
32
+ * usage - Show this usage information
33
+ use - Switch to using a specific ruby versio (new login shell)
34
+ info - Show information for current ruby
35
+ gemdir - Switch to gem directory for installation (new login shell)
36
+ srcdir - Switch to src directory for the current ruby installation
37
+ gemdup - Clone source implementation version gems to currently used version
38
+ (expiramental)
39
+ install - Install a ruby version, default is from source
40
+ debug - Emit environment and configuration information for debugging
41
+
42
+ Implementation:
43
+
44
+ * ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
45
+ jruby - jRuby
46
+ ree - Ruby Enterprise Edition
47
+ default - Resets to the default system ruby
48
+ all - Used with install, installs all latest known versions
49
+
50
+ Options:
51
+
52
+ -v|--version - Ruby Package Version, defaults to 'latest'
53
+ -l|--level - Patch level for the specified Ruby version
54
+ -p|--prefix - Package and source directory prefix, with trailing slash!
55
+ Default is a users home directory and /usr/local/ for root
56
+ -c|--configure - Options for source compile (default: --enable-shared)
57
+ -d|--debug - Toggle debug mode on for extra messages (NYI)
58
+
59
+ Notes:
60
+
61
+ * Defaults above are denoted with a '*' prefix.
62
+ * rvm is intended to be run as an individual user (not root, yet)
63
+ * All ruby installation, configuration and source files are in ~/.rvm
64
+ * To manually reset to defaults: "rm -f ~/.rvm/current", then open new shell
65
+ * To preserve previous gem installations for a particular ruby version copy,
66
+ move, symlink or copy the old gem directory to (1.8 for 1.8.X):
67
+ ~/.gem/\$interpreter/\$version
68
+
69
+ Examples:
70
+
71
+ $ gem install rvm # Install the rvm gem
72
+ $ rvm-install # Install rvm, adds source hooks for bash & zsh
73
+ $ rvm install jruby # Install jRuby (default version is 1.3.1)
74
+ $ rvm use ruby -v 1.9.1 # Use Ruby 1.9.1, installs if necessary
75
+ $ rvm use 1.9 # Equivalent to above, due to defaults
76
+ $ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
77
+ $ rvm use default # Use the system default (as if no rvm)
78
+
79
+ TODO: (in order)
80
+
81
+ * rvm gemdir default
82
+
83
+ Credits:
84
+
85
+ Bash Support Testing
86
+
87
+ - Daniel Neighman (dneighman@gmail.com)
88
+ irc: hassox ; github: http://github.com/hassox
89
+
90
+ - John Mettraux (jmettraux@openwfe.org)
91
+ irc: jmettraux ; github: http://github.com/jmettraux
92
+
93
+ ZSH Support Testing
94
+
95
+ - Franco Lazzarino (flazzarino@gmail.com)
96
+ irc: flazz ; github: http://github.com/flazz
97
+
98
+ Usage
99
+
100
+ }
101
+
102
+ # Logging functions based on level
103
+ function log { echo -e "\n $* \e[0m\n" ; }
104
+ function debug { log "\e[4;34m <d> $*" ; }
105
+ function info { log "\e[0;32m <i> $*" ; }
106
+ function warn { log "\e[0;33m <w> $*" ; }
107
+ function error { log "\e[0;31m <e> $*" ; }
108
+ function fail { log "\e[0;31m <e> $*" ; return 1 ; }
109
+
110
+ function rvm-gi { gem install -q --no-rdoc --no-ri $* ; }
111
+
112
+ function rvm-info {
113
+
114
+ full_version=$(ruby -v)
115
+ ruby_implementation=$(echo "$full_version" | awk '{print $1}')
116
+ ruby_version=$(echo "$full_version" | awk '{print $2}')
117
+ ruby_patchlevel=$(echo "$full_version" | sed 's/^.*(//' | sed 's/).*$//')
118
+ ruby_date=$(echo "$full_version" | sed 's/^.*(\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*$/\1/')
119
+ ruby_platform=$(echo "$full_version" | sed 's/^.*\[//' | sed 's/\].*$//')
120
+
121
+ cat <<-Info
122
+ ruby:
123
+ implementation: "$ruby_implementation"
124
+ version: "$ruby_version"
125
+ date: "$ruby_date"
126
+ platform: "$ruby_platform"
127
+ patchlevel: "$ruby_patchlevel"
128
+ gem_home: "${GEM_HOME-not set}"
129
+ ruby_home: "${ruby_home-not set}"
130
+ full_version: "$full_version"
131
+ Info
132
+
133
+ }
134
+
135
+ function rvm-install-source {
136
+
137
+ version="${1:-1.8.6}"
138
+ case "$version" in
139
+ 1.9|1.9.1) major="1.9" ; minor="1" ; level="${2-243}" ;;
140
+ 1.9.2) major="1.9" ; minor="2" ; level="${2-review1}" ;;
141
+ 1.8|1.8.6) major="1.8" ; minor="6" ; level="${2-369}" ;;
142
+ 1.8.7) major="1.8" ; minor="7" ; level="${2-174}" ;;
143
+ *) fail "Ruby version '$version' is unknown."
144
+ esac
145
+
146
+ package_name="ruby-$major.$minor-p$level"
147
+ url="ftp://ftp.ruby-lang.org/pub/ruby/$major/$package_name.tar.gz"
148
+
149
+ pushd $source_path
150
+ if [ -d $package_name ] ; then
151
+ cd $package_name
152
+ else
153
+ if [ ! -f "$package_name.tar.gz" ] ; then curl -O -L -s $url ; fi
154
+ tar xzf $package_name.tar.gz && cd $package_name/
155
+ fi
156
+ ./configure --prefix=$install_path/$package_name ${configure-'--enable-shared'} && make && make install
157
+ chmod +x $install_path/$package_name/bin/*
158
+
159
+ # Now install rubygems for this ruby version.
160
+ gem_package_name="rubygems-1.3.5"
161
+ gem_url="http://rubyforge.org/frs/download.php/60718/$gem_package_name.tgz"
162
+ if [ -d $gem_package_name ] ; then
163
+ cd $gem_package_name
164
+ else
165
+ if [ ! -f $gem_package_name.tgz ] ; then curl -O -L -s $gem_url ; fi
166
+ tar zxf $gem_package_name.tgz && cd $gem_package_name
167
+ fi
168
+ # Well this is fun... fix nil error on require_paths:
169
+ sed -i '' "s/require_paths\.join/require_paths.to_a.join/" $source_path/$package_name/$gem_package_name/lib/rubygems/gem_path_searcher.rb
170
+ $install_path/$package_name/bin/ruby ./setup.rb
171
+ popd
172
+
173
+ }
174
+
175
+ function rvm-install-ruby {
176
+
177
+ case "$implementation" in
178
+
179
+ ree)
180
+ version=${version-1.8.6}
181
+ patchlevel=${patchlevel-20090610}
182
+ package_name="ruby-enterprise-$version-$patchlevel"
183
+ url="http://rubyforge.org/frs/download.php/58677/$package_name.tar.gz"
184
+ pushd $source_path
185
+ if [ -d $package_name ] ; then
186
+ cd $package_name
187
+ else
188
+ if [ ! -f "$package_name.tar.gz" ] ; then curl -O -L -s $url ; fi
189
+ tar xzf $package_name.tar.gz && cd $package_name/
190
+ fi
191
+ cd ruby-enterprise-$version-$patchlevel && ./installer -a $install_path/ruby-enterprise-$version-$patchlevel --dont-install-useful-gems
192
+ popd
193
+ chmod +x $install_path/$package_name/bin/*
194
+ ;;
195
+
196
+ jruby)
197
+ version=${version-1.3.1} # 1.2.0, 1.3.1
198
+ unset patchlevel # No patchlevel for jRuby
199
+ package_name="$implementation-bin-$version"
200
+ package_dir="$implementation-$version"
201
+ url="http://dist.codehaus.org/$implementation/$version/$package_name.zip"
202
+ pushd $source_path
203
+ if [ -d $package_name ] ; then
204
+ cd $package_name
205
+ else
206
+ if [ ! -f "$package_name.zip" ] ; then curl -O -L -s $url ; fi
207
+ jar xf $package_name.zip && cd $package_name/
208
+ fi
209
+ mkdir -p $install_path/$package_dir/bin/
210
+ for binary in jruby jgem jirb ; do
211
+ ln -sf $source_path/$package_dir/bin/$binary $source_path/$package_dir/bin/${binary#j}
212
+ done
213
+ rsync -ag $source_path/$package_dir/ $install_path/$package_dir/
214
+ cd $source_path/$package_dir/tool/nailgun && make
215
+ popd
216
+ chmod +x $install_path/$package_dir/bin/*
217
+ rvm-gi jruby-openssl
218
+ ;;
219
+
220
+ ruby)
221
+ rvm-install-source ${version-1.8.6} ${patchlevel-$3}
222
+ ;;
223
+
224
+ default)
225
+ fail "please specify a ruby implementation to install."
226
+ ;;
227
+ *) fail "Ruby implementation '$implementation' is not known."
228
+
229
+ esac
230
+
231
+ rvm-gi rake
232
+
233
+ }
234
+
235
+ function rvm-use {
236
+
237
+ case "$implementation" in
238
+
239
+ default)
240
+ rm -f ~/.rvm/current
241
+ unset MY_RUBY_HOME
242
+ unset GEM_HOME
243
+ ;;
244
+ #leopard) MY_RUBY_HOME="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr"; GEM_HOME="$HOME/.gem/ruby/1.8" ;;
245
+
246
+ jruby)
247
+ version="${version-1.3.1}"
248
+ if [ "$version" = "1.2.0" -o "$version" = "1.3.1" ] ; then
249
+ MY_RUBY_HOME="$install_path/jruby-$version"
250
+ GEM_HOME="$HOME/.gem/jruby/1.8"
251
+ alias ruby_ng="jruby --ng"
252
+ alias ruby_ng_server="jruby --ng-server"
253
+ else
254
+ fail "Unknown jRuby version: $version"
255
+ fi
256
+ ;;
257
+
258
+ ree)
259
+ version=${version-1.8.6}
260
+ if [ "$version" = "1.8.6" ] ; then
261
+ patchlevel="${3-20090610}"
262
+ MY_RUBY_HOME="$install_path/ruby-enterprise-$version-$patchlevel"
263
+ GEM_HOME="$HOME/.gem/ruby-enterprise/1.8"
264
+ else
265
+ fail "Unknown Ruby Enterprise Edition version: $version"
266
+ fi
267
+ ;;
268
+
269
+ ruby)
270
+ if [ "$version" = "1.8.7" ] ; then
271
+ level="${patchlevel-174}"
272
+ MY_RUBY_HOME="$install_path/ruby-1.8.7-p$level"
273
+ GEM_HOME="$HOME/.gem/ruby/1.8"
274
+
275
+ elif [ "$version" = "1.8.6" -o "$version" = "1.8" ] ; then
276
+ level="${patchlevel-369}"
277
+ MY_RUBY_HOME="$install_path/ruby-1.8.6-p$level"
278
+ GEM_HOME="$HOME/.gem/ruby/1.8"
279
+
280
+ elif [ "$version" = "1.9.2" ] ; then
281
+ level="${patchlevel-review1}"
282
+ MY_RUBY_HOME="$install_path/ruby-1.9.2-p$level"
283
+ GEM_HOME="$HOME/.gem/ruby/1.9.2"
284
+
285
+ elif [ "$version" = "1.9.1" -o "$version" = "1.9" ] ; then
286
+ level="${patchlevel-243}"
287
+ MY_RUBY_HOME="$install_path/ruby-1.9.1-p$level"
288
+ GEM_HOME="$HOME/.gem/ruby/1.9.1"
289
+
290
+ else
291
+ fail "Unknown ruby version: $version"
292
+ fi
293
+ ;;
294
+
295
+ *)
296
+ fail "Ruby implementation '$implementation' is not known."
297
+
298
+ esac
299
+
300
+ if [ ! "$implementation" = "default" ] ; then
301
+ RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
302
+ export GEM_HOME MY_RUBY_HOME RUBY_VERSION
303
+
304
+ if [ ! -d $MY_RUBY_HOME ] ; then
305
+ warn "$implementation $version is not installed, installing."
306
+ rvm-install-ruby $implementation $version $level
307
+ fi
308
+
309
+ # Setup ~/.rvm/current
310
+ echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:\$PATH ; export PATH" > ~/.rvm/current
311
+ for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
312
+ eval "export $variable"
313
+ eval value=\$${variable}
314
+ echo "${variable}='$value' ; export ${variable}" >> ~/.rvm/current
315
+ done
316
+ else
317
+ PATH=$original_path ; export PATH
318
+ fi
319
+
320
+ info "Switching to $implementation $version $patchlevel ..."
321
+ if [ ! -z "$BASH_VERSION" ] ; then
322
+ exec bash -l
323
+ elif [ ! -z "$ZSH_VERSION" ] ; then
324
+ exec zsh -l
325
+ else
326
+ fail "Your shell '$0' is not supported."
327
+ fi
328
+ }
329
+
330
+ function rvm-gem-dir {
331
+
332
+ case "$implementation" in
333
+ jruby) GEM_HOME="$HOME/.gem/jruby/1.8" ;;
334
+ ree) GEM_HOME="$HOME/.gem/ruby-enterprise/1.8" ;;
335
+ ruby)
336
+ if [ "$version" = "1.8" -o "$version" = "1.8.6" ] ; then
337
+ GEM_HOME="$HOME/.gem/ruby/1.8"
338
+
339
+ elif [ "$version" = "1.9.2" ] ; then
340
+ GEM_HOME="$HOME/.gem/ruby/1.9.2"
341
+
342
+ elif [ "$version" = "1.9" -o "$version" = "1.9.1" ] ; then
343
+ GEM_HOME="$HOME/.gem/ruby/1.9.1"
344
+
345
+ else
346
+ fail "Unknown ruby version: $version"
347
+ fi
348
+ ;;
349
+ *)
350
+ fail "Ruby implementation '$implementation' is not known."
351
+ esac
352
+
353
+ if [ -d $GEM_HOME ] ; then
354
+ echo $GEM_HOME && cd $GEM_HOME
355
+ else
356
+ fail "$implementation $version GEM directory does not exist."
357
+ fi
358
+
359
+ }
360
+
361
+ function rvm-src-dir {
362
+ case "$implementation" in
363
+
364
+ jruby)
365
+ version="${version-1.3.1}"
366
+ if [ "$version" = "1.2.0" -o "$version" = "1.3.1" ] ; then
367
+ src_dir="$source_path/$implementation-$version"
368
+ else
369
+ fail "Unknown jRuby version: $version"
370
+ fi
371
+ ;;
372
+
373
+ ree)
374
+ version=${version-1.8.6}
375
+ if [ "$version" = "1.8.6" ] ; then
376
+ src_dir="$source_path/ruby-enterprise-$version-"${3-20090610}""
377
+ else
378
+ fail "Unknown Ruby Enterprise Edition version: $version"
379
+ fi
380
+ ;;
381
+
382
+ ruby)
383
+ if [ "$version" = "1.8.7" ] ; then
384
+ src_dir="$source_path/ruby-1.8.7-p${patchlevel-174}"
385
+
386
+ elif [ "${version%\.*}" = "1.8" ] ; then
387
+ src_dir="$source_path/ruby-1.8.6-p${patchlevel-369}"
388
+
389
+ elif [ "$version" = "1.9.2" ] ; then
390
+ src_dir="$source_path/ruby-1.9.2-p${patchlevel-review1}"
391
+
392
+ elif [ "${version%\.*}" = "1.9" ] ; then
393
+ src_dir="$source_path/ruby-1.9.1-p${patchlevel-243}"
394
+
395
+ else
396
+ fail "Unknown ruby version: $version"
397
+ fi
398
+ ;;
399
+
400
+ *)
401
+ fail "Ruby implementation '$implementation' is not known."
402
+ return 1
403
+ esac
404
+
405
+ if [ -d $src_dir ] ; then
406
+ cd $src_dir
407
+ else
408
+ fail "$implementation $version source directory does not exist."
409
+ fi
410
+
411
+ }
412
+
413
+ # clones from source implementation/version to current
414
+ function rvm-gem-dup {
415
+
416
+ gem_dir=$1 # TODO: check for and remove trailing /gems
417
+ if [ ! -z "$gem_dir" ] ; then
418
+ for gem_name_version in `ls $gem_dir/gems` ; do
419
+ gem_name=${gem_name_version%-*}
420
+ gem_version=${gem_name_version##*-}
421
+ if [ -d $GEM_HOME/gems/$gem_name_version ] ; then
422
+ echo "$gem_name_version already installed."
423
+ else
424
+ rvm-gi $gem_dir/cache/$gem_name-$gem_version.gem
425
+ fi
426
+ done
427
+ else
428
+ fail "Unknown $implementation version: $version"
429
+ fi
430
+
431
+ }
432
+
433
+ function rvm-version { info "rvm $rvm_version" ; }
434
+
435
+ function rvm {
436
+
437
+ # Cleanup, aisle 3
438
+ for variable in action implementation patchlevel version source_path install_path manager debug prefix_path ; do
439
+ eval "unset $variable"
440
+ done
441
+ while [ $# -gt 0 ] ; do
442
+ token="$1" ; shift
443
+ case "$token" in
444
+ install|use|path|info|gemdir|setup|version|debug|srcdir)
445
+ action=$token ;;
446
+ ruby|jruby|ree|default|all)
447
+ implementation="$token" ;;
448
+ 1.8|1.8.6|1.8.7|1.9|1.9.1|1.9.2|1.2.0|1.3.1)
449
+ version="$token" ;;
450
+ -v|--version) version="$1" ; shift ;;
451
+ -l|--level) patchlevel="$1" ; shift ;;
452
+ -p|--prefix) install_path="$1" ; shift ;;
453
+ -s|--source) source_path="$1" ; shift ;; # Undocumented / untested "feature"
454
+ -c|--configure) configure="$1" ; shift ;;
455
+ -m|--manager) manager="$1" ; shift ;;
456
+ -u|--gemdup) action="gemdup" ; gem_dir="$1" ; shift ;;
457
+ -d|--debug) debug=true ;;
458
+ *) rvm-usage ; return 1
459
+ esac
460
+ done
461
+
462
+ if [ -z "$implementation" -a -z "$version" ] ; then
463
+ implementation="default"
464
+ else
465
+ implementation=${implementation-'ruby'}
466
+ fi
467
+ username=`whoami`
468
+
469
+ # TODO: Sanitize user input, ensure that there is a / a the end...
470
+ if [ "$username" = "root" ] ; then
471
+ prefix_path=${prefix-/usr/local/}
472
+ else
473
+ prefix_path=${prefix-$HOME/.}
474
+ fi
475
+ source_path="${source_path-${prefix_path}rvm/src}"
476
+ install_path="${prefix_path}rvm"
477
+
478
+ mkdir -p $source_path $install_path
479
+
480
+ if [ -f ~/.rvm/original_path ] ; then
481
+ original_path=`cat ~/.rvm/original_path`
482
+ fi
483
+ if [ -z "$original_path" ] ; then
484
+ echo $PATH > $install_path/.original_path
485
+ original_path=$PATH
486
+ fi
487
+
488
+ case "$action" in
489
+ install)
490
+ if [ "$implementation" = "all" ] ; then
491
+ for implementation in ruby jruby ree ; do
492
+ if [ "$implementation" = "ruby" ] ; then
493
+ for version in 1.8.6 1.8.7 1.9.1 1.9.2 ; do
494
+ rvm-install-ruby $implementation $version $patchlevel
495
+ done
496
+ else
497
+ rvm-install-ruby $implementation $version $patchlevel
498
+ fi
499
+ done
500
+ else
501
+ rvm-install-ruby $implementation $version $patchlevel
502
+ fi
503
+ ;;
504
+ use) rvm-use $implementation $version $patchlevel ;;
505
+ gemdir) rvm-gem-dir $implementation $version $patchlevel ;;
506
+ srcdir) rvm-src-dir $implementation $version $patchlevel ;;
507
+ gemdup) rvm-gem-dup $implementation $version $patchlevel ;;
508
+ info) rvm-info $implementation $version $patchlevel ;;
509
+ version) rvm-version ;;
510
+ debug)
511
+ rvm-version
512
+ info "GEM_HOME: $GEM_HOME\nMY_RUBY_HOME: $MY_RUBY_HOME"
513
+ info "ruby: `which ruby`\ngem: `which gem`\nirb: `which irb`"
514
+ info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"%5}')"
515
+ info "\n.bash_profile: \n$(cat ~/.bash_profile | tail -n 5)\n"
516
+ info "\n.rvm/current: \n$(cat ~/.rvm/current)\n"
517
+ return 0
518
+ ;;
519
+ *)
520
+ if [ ! -z "$action" ] ; then
521
+ fail "unknown action '$action'"
522
+ else
523
+ rvm-usage
524
+ fi
525
+ return 1
526
+ esac
527
+
528
+ }
529
+
data/bash/rvm-install ADDED
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ mkdir -p ~/.rvm/src ~/.rvm/bin
4
+
5
+ cp $(pwd)/bash/rvm ~/.rvm/bin/
6
+
7
+ touch ~/.profile
8
+ if [ -z "`grep '\.rvm/bin/rvm' ~/.profile`" ] ; then
9
+ echo "Adding 'source ~/.rvm/bin/rvm' to your ~/.profile."
10
+ echo "source ~/.rvm/bin/rvm" >> ~/.profile
11
+ fi
12
+
13
+ if [ -z "`grep '\.rvm/current' ~/.profile`" ] ; then
14
+ echo "Adding 'source ~/.rvm/current' ~/.profile."
15
+ echo "if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi" >> ~/.profile
16
+ fi
17
+
18
+ touch ~/.bash_profile
19
+ if [ -z "`grep '\.profile' ~/.bash_profile`" ] ; then
20
+ echo "Adding 'source ~/.profile' to the end of ~/.bash_profile."
21
+ echo "if [ -f ~/.profile ] ; then source ~/.profile ; fi" >> ~/.bash_profile
22
+ fi
23
+
24
+ touch ~/.zprofile
25
+ if [ -z "`grep '\.profile' ~/.zprofile`" ] ; then
26
+ echo "Adding 'source ~/.profile' to the end of ~/.zprofile."
27
+ echo "if [ -f ~/.profile ] ; then source ~/.profile ; fi" >> ~/.zprofile
28
+ fi
29
+
30
+ echo -e "\n\e[0;32mOpen a new shell and enjoy rvm: rvm usage\e[0m\n"
31
+
data/bin/rvm-install ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Hot potato!!! Bash it!
4
+ exec "bash -c 'cd #{File.dirname(File.dirname(__FILE__))} && ./bash/rvm-install #{ARGV.join(' ')} ; source ~/.bash_profile'"
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 ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wayneeseguin-rvm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ platform: ruby
6
+ authors:
7
+ - Wayne E. Seguin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-24 00:00:00 -07:00
13
+ default_executable: rvm-install
14
+ dependencies: []
15
+
16
+ description: Manages Ruby interpreter installations and switching between them.
17
+ email: wayneeseguin@gmail.com
18
+ executables:
19
+ - rvm-install
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - INSTALL
26
+ - LICENCE
27
+ - README
28
+ - bash/rvm
29
+ - bash/rvm-install
30
+ - lib/rvm.rb
31
+ has_rdoc: false
32
+ homepage: http://github.com/wayneeseguin/rvm
33
+ licenses:
34
+ post_install_message:
35
+ rdoc_options:
36
+ - --inline-source
37
+ - --charset=UTF-8
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ requirements: []
53
+
54
+ rubyforge_project: dynamicreports
55
+ rubygems_version: 1.3.5
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: Ruby Version Manager (rvm)
59
+ test_files: []
60
+