wayneeseguin-rvm 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/bash/rvm +139 -69
- metadata +2 -2
data/bash/rvm
CHANGED
@@ -3,8 +3,8 @@
|
|
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.
|
7
|
-
rvm_updated="2009.08.
|
6
|
+
rvm_version="0.0.7"
|
7
|
+
rvm_updated="2009.08.25"
|
8
8
|
|
9
9
|
#
|
10
10
|
# License: See LICENSE
|
@@ -29,23 +29,24 @@ function rvm-usage {
|
|
29
29
|
|
30
30
|
Action:
|
31
31
|
|
32
|
-
* usage
|
33
|
-
use
|
34
|
-
info
|
35
|
-
gemdir
|
36
|
-
srcdir
|
37
|
-
gemdup
|
38
|
-
|
39
|
-
install
|
40
|
-
|
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) Example: rvm gemdup ~/.gem/ruby/1.8/
|
39
|
+
install - Install a ruby version, default is from source
|
40
|
+
uninstall - Uninstall a ruby version
|
41
|
+
debug - Emit environment and configuration information for debugging
|
41
42
|
|
42
43
|
Implementation:
|
43
44
|
|
44
|
-
* ruby
|
45
|
-
jruby
|
46
|
-
ree
|
47
|
-
default
|
48
|
-
all
|
45
|
+
* ruby - MRI/YARV Ruby (The Standard), defaults to 1.8.6
|
46
|
+
jruby - jRuby
|
47
|
+
ree - Ruby Enterprise Edition
|
48
|
+
default - Resets to the default system ruby
|
49
|
+
all - Used with install, installs all latest known versions
|
49
50
|
|
50
51
|
Options:
|
51
52
|
|
@@ -68,13 +69,14 @@ function rvm-usage {
|
|
68
69
|
|
69
70
|
Examples:
|
70
71
|
|
71
|
-
$ gem install rvm
|
72
|
-
$ rvm-install
|
73
|
-
$ rvm install jruby
|
74
|
-
$ rvm use ruby -v 1.9.1
|
75
|
-
$ rvm use 1.9
|
76
|
-
$ rvm use 1.8
|
77
|
-
$ rvm use default
|
72
|
+
$ gem install rvm # Install the rvm gem
|
73
|
+
$ rvm-install # Install rvm, adds hooks for bash & zsh
|
74
|
+
$ rvm install jruby # Install jRuby (default version is 1.3.1)
|
75
|
+
$ rvm use ruby -v 1.9.1 # Use Ruby 1.9.1, installs if necessary
|
76
|
+
$ rvm use 1.9 # Equivalent to above, due to defaults
|
77
|
+
$ rvm use 1.8 # Use Ruby 1.8.6, installs if necessary
|
78
|
+
$ rvm use default # Use the system default (as if no rvm)
|
79
|
+
$ rvm gemdup ~/.gem/ruby/1.8/ # Install gems from ~/.gem/ruby/1.8/
|
78
80
|
|
79
81
|
TODO: (in order)
|
80
82
|
|
@@ -100,12 +102,12 @@ Usage
|
|
100
102
|
}
|
101
103
|
|
102
104
|
# Logging functions based on level
|
103
|
-
function log { echo -e "\n $* \e[0m
|
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 ; }
|
105
|
+
function log { echo -e "\n $* \e[0m" ; }
|
106
|
+
function debug { log "\e[4;34m <d> \e[0m$*" ; }
|
107
|
+
function info { log "\e[0;32m <i> \e[0m$*" ; }
|
108
|
+
function warn { log "\e[0;33m <w> \e[0m$*" ; }
|
109
|
+
function error { log "\e[0;31m <e> \e[0m$*" ; }
|
110
|
+
function fail { log "\e[0;31m <e> \e[0m$*" ; return 1 ; }
|
109
111
|
|
110
112
|
function rvm-gi { gem install -q --no-rdoc --no-ri $* ; }
|
111
113
|
|
@@ -143,20 +145,37 @@ function rvm-install-source {
|
|
143
145
|
*) fail "Ruby version '$version' is unknown."
|
144
146
|
esac
|
145
147
|
|
148
|
+
set -x
|
146
149
|
package_name="ruby-$major.$minor-p$level"
|
147
150
|
url="ftp://ftp.ruby-lang.org/pub/ruby/$major/$package_name.tar.gz"
|
148
151
|
|
149
|
-
|
152
|
+
info "Installing Ruby from source to: $install_path/$package_name"
|
153
|
+
mkdir -p $install_path/$package_name
|
154
|
+
|
155
|
+
pushd $source_path > /dev/null
|
150
156
|
if [ -d $package_name ] ; then
|
151
157
|
cd $package_name
|
152
158
|
else
|
153
|
-
if [ ! -f "$package_name.tar.gz" ] ; then
|
154
|
-
|
159
|
+
if [ ! -f "$package_name.tar.gz" ] ; then
|
160
|
+
info "\tDownloading $package_name, this may take a while depending on your connection..."
|
161
|
+
curl -O -L -s $url
|
162
|
+
fi
|
163
|
+
info "\tExtracting $package_name..."
|
164
|
+
tar xzf $package_name.tar.gz && cd $package_name
|
155
165
|
fi
|
156
|
-
|
166
|
+
|
167
|
+
info "\tConfiguring $package_name using ${configure-'--enable-shared'}, this may take a while depending on your cpu(s)..."
|
168
|
+
./configure --prefix=$install_path/$package_name ${configure-'--enable-shared'} > $install_path/$package_name/configure.log 2> $install_path/$package_name/configure.error.log
|
169
|
+
|
170
|
+
info "\tCompiling $package_name, this may take a while, depending on your cpu(s)..."
|
171
|
+
make > $install_path/$package_name/make.log 2> $install_path/$package_name/make.error.log
|
172
|
+
|
173
|
+
info "\tInstalling $package_name"
|
174
|
+
make install > $install_path/$package_name/install.log 2> $install_path/$package_name/install.error.log
|
157
175
|
chmod +x $install_path/$package_name/bin/*
|
158
176
|
|
159
177
|
# Now install rubygems for this ruby version.
|
178
|
+
info "\tInstalling rubygems dedicated to $package_name..."
|
160
179
|
gem_package_name="rubygems-1.3.5"
|
161
180
|
gem_url="http://rubyforge.org/frs/download.php/60718/$gem_package_name.tgz"
|
162
181
|
if [ -d $gem_package_name ] ; then
|
@@ -167,9 +186,16 @@ function rvm-install-source {
|
|
167
186
|
fi
|
168
187
|
# Well this is fun... fix nil error on require_paths:
|
169
188
|
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
|
189
|
+
$install_path/$package_name/bin/ruby ./setup.rb > $install_path/$package_name/rubygems.install.log 2> $install_path/$package_name/rubygems.install.error.log
|
190
|
+
popd > /dev/null
|
191
|
+
info "Installation of $package_name complete."
|
192
|
+
|
193
|
+
for gem_name in rake ; do
|
194
|
+
info "Installing $gem_name"
|
195
|
+
$install_path/$package_name/bin/gem install $gem_name --no-rdoc --no-ri -q >> $install_path/$package_name/gems.install.log
|
196
|
+
done
|
172
197
|
|
198
|
+
set +x
|
173
199
|
}
|
174
200
|
|
175
201
|
function rvm-install-ruby {
|
@@ -181,40 +207,79 @@ function rvm-install-ruby {
|
|
181
207
|
patchlevel=${patchlevel-20090610}
|
182
208
|
package_name="ruby-enterprise-$version-$patchlevel"
|
183
209
|
url="http://rubyforge.org/frs/download.php/58677/$package_name.tar.gz"
|
184
|
-
|
210
|
+
info "Installing Ruby Enterprise Edition from source to: $install_path/$package_name"
|
211
|
+
pushd $source_path > /dev/null
|
185
212
|
if [ -d $package_name ] ; then
|
186
213
|
cd $package_name
|
187
214
|
else
|
188
|
-
if [ ! -f "$package_name.tar.gz" ] ; then
|
189
|
-
|
215
|
+
if [ ! -f "$package_name.tar.gz" ] ; then
|
216
|
+
info "\tDownloading $package_name, this may take a while depending on your connection..."
|
217
|
+
curl -O -L -s $url
|
218
|
+
fi
|
219
|
+
info "\tExtracting $package_name..."
|
220
|
+
tar xzf $package_name.tar.gz && cd $package_name
|
190
221
|
fi
|
191
|
-
|
192
|
-
|
222
|
+
|
223
|
+
info "\tInstalling $package_name, this may take a while, depending on your cpu(s)..."
|
224
|
+
mkdir -p $install_path/$package_name
|
225
|
+
./installer -a $install_path/ruby-enterprise-$version-$patchlevel --dont-install-useful-gems > $install_path/$package_name/install.log 2> $install_path/$package_name/install.error.log
|
193
226
|
chmod +x $install_path/$package_name/bin/*
|
227
|
+
|
228
|
+
info "\tInstalling rubygems dedicated to $package_name..."
|
229
|
+
gem_package_name="rubygems-1.3.5"
|
230
|
+
gem_url="http://rubyforge.org/frs/download.php/60718/$gem_package_name.tgz"
|
231
|
+
if [ -d $gem_package_name ] ; then
|
232
|
+
cd $gem_package_name
|
233
|
+
else
|
234
|
+
if [ ! -f $gem_package_name.tgz ] ; then curl -O -L -s $gem_url ; fi
|
235
|
+
tar zxf $gem_package_name.tgz && cd $gem_package_name
|
236
|
+
fi
|
237
|
+
# Well this is fun... fix nil error on require_paths:
|
238
|
+
sed -i '' "s/require_paths\.join/require_paths.to_a.join/" $source_path/$package_name/$gem_package_name/lib/rubygems/gem_path_searcher.rb
|
239
|
+
$install_path/$package_name/bin/ruby ./setup.rb > $install_path/$package_name/rubygems.install.log 2> $install_path/$package_name/rubygems.install.error.log
|
240
|
+
info "Installation of $package_name complete."
|
241
|
+
popd > /dev/null
|
242
|
+
|
243
|
+
for gem_name in rake ; do
|
244
|
+
info "Installing $gem_name"
|
245
|
+
$install_path/$package_name/bin/gem install $gem_name --no-rdoc --no-ri -q >> $install_path/$package_name/gems.install.log
|
246
|
+
done
|
194
247
|
;;
|
195
248
|
|
196
249
|
jruby)
|
197
250
|
version=${version-1.3.1} # 1.2.0, 1.3.1
|
198
251
|
unset patchlevel # No patchlevel for jRuby
|
199
|
-
|
200
|
-
|
201
|
-
url="http://dist.codehaus.org/$implementation/$version/$
|
202
|
-
|
203
|
-
|
204
|
-
|
252
|
+
zipfile="$implementation-bin-$version"
|
253
|
+
package_name="$implementation-$version"
|
254
|
+
url="http://dist.codehaus.org/$implementation/$version/$zipfile.zip"
|
255
|
+
|
256
|
+
info "Installing jRuby to: $install_path/$package_name"
|
257
|
+
mkdir -p $install_path/$package_name
|
258
|
+
pushd $source_path > /dev/null
|
259
|
+
if [ -d $zipfile ] ; then
|
260
|
+
cd $zipfile
|
205
261
|
else
|
206
|
-
if [ ! -f "$
|
207
|
-
|
262
|
+
if [ ! -f "$zipfile.zip" ] ; then
|
263
|
+
info "\tDownloading $zipfile, this may take a while depending on your connection..."
|
264
|
+
curl -O -L -s $url
|
265
|
+
fi
|
266
|
+
info "\tExtracting $zipfile..."
|
267
|
+
jar xf $zipfile.zip
|
208
268
|
fi
|
209
|
-
|
269
|
+
|
270
|
+
info "\tInstalling $package_name..."
|
271
|
+
mkdir -p $install_path/$package_name/bin/
|
272
|
+
rsync -ag $source_path/$package_name/ $install_path/$package_name/
|
273
|
+
cd $source_path/$package_name/tool/nailgun && make > $install_path/$package_name/install.nailgun.log 2> $install_path/$package_name/install.error.nailgun.log
|
274
|
+
popd > /dev/null
|
275
|
+
chmod +x $install_path/$package_name/bin/*
|
210
276
|
for binary in jruby jgem jirb ; do
|
211
|
-
ln -sf $
|
277
|
+
ln -sf $install_path/$package_name/bin/$binary $install_path/$package_name/bin/${binary#j}
|
278
|
+
done
|
279
|
+
for gem_name in rake jruby-openssl ; do
|
280
|
+
info "Installing $gem_name"
|
281
|
+
$install_path/$package_name/bin/jgem install $gem_name --no-rdoc --no-ri -q >> $install_path/$package_name/gems.install.log
|
212
282
|
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
283
|
;;
|
219
284
|
|
220
285
|
ruby)
|
@@ -228,8 +293,6 @@ function rvm-install-ruby {
|
|
228
293
|
|
229
294
|
esac
|
230
295
|
|
231
|
-
rvm-gi rake
|
232
|
-
|
233
296
|
}
|
234
297
|
|
235
298
|
function rvm-use {
|
@@ -298,14 +361,14 @@ function rvm-use {
|
|
298
361
|
esac
|
299
362
|
|
300
363
|
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
364
|
if [ ! -d $MY_RUBY_HOME ] ; then
|
305
|
-
warn "$implementation $version is not installed
|
365
|
+
warn "$implementation $version is not installed."
|
306
366
|
rvm-install-ruby $implementation $version $level
|
307
367
|
fi
|
308
368
|
|
369
|
+
RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
|
370
|
+
export GEM_HOME MY_RUBY_HOME RUBY_VERSION
|
371
|
+
|
309
372
|
# Setup ~/.rvm/current
|
310
373
|
echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:\$PATH ; export PATH" > ~/.rvm/current
|
311
374
|
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
|
@@ -323,27 +386,27 @@ function rvm-use {
|
|
323
386
|
elif [ ! -z "$ZSH_VERSION" ] ; then
|
324
387
|
exec zsh -l
|
325
388
|
else
|
326
|
-
fail "Your shell
|
389
|
+
fail "Your shell is not supported bash and zsh are currently supported."
|
327
390
|
fi
|
328
391
|
}
|
329
392
|
|
330
393
|
function rvm-gem-dir {
|
331
394
|
|
332
|
-
case "$implementation" in
|
395
|
+
case "${1-implementation}" in
|
333
396
|
jruby) GEM_HOME="$HOME/.gem/jruby/1.8" ;;
|
334
397
|
ree) GEM_HOME="$HOME/.gem/ruby-enterprise/1.8" ;;
|
335
398
|
ruby)
|
336
|
-
if [ "$version" = "1.8" -o "$version" = "1.8.6" ] ; then
|
399
|
+
if [ "${2-version}" = "1.8" -o "${2-version}" = "1.8.6" ] ; then
|
337
400
|
GEM_HOME="$HOME/.gem/ruby/1.8"
|
338
401
|
|
339
|
-
elif [ "$version" = "1.9.2" ] ; then
|
402
|
+
elif [ "${2-version}" = "1.9.2" ] ; then
|
340
403
|
GEM_HOME="$HOME/.gem/ruby/1.9.2"
|
341
404
|
|
342
|
-
elif [ "$version" = "1.9" -o "$version" = "1.9.1" ] ; then
|
405
|
+
elif [ "${2-version}" = "1.9" -o "${2-version}" = "1.9.1" ] ; then
|
343
406
|
GEM_HOME="$HOME/.gem/ruby/1.9.1"
|
344
407
|
|
345
408
|
else
|
346
|
-
fail "Unknown
|
409
|
+
fail "Unknown Version: ${2-version}"
|
347
410
|
fi
|
348
411
|
;;
|
349
412
|
*)
|
@@ -430,7 +493,7 @@ function rvm-gem-dup {
|
|
430
493
|
|
431
494
|
}
|
432
495
|
|
433
|
-
function rvm-version {
|
496
|
+
function rvm-version { echo "rvm $rvm_version ($rvm_updated) [$rvm_website]" ; }
|
434
497
|
|
435
498
|
function rvm {
|
436
499
|
|
@@ -447,7 +510,14 @@ function rvm {
|
|
447
510
|
implementation="$token" ;;
|
448
511
|
1.8|1.8.6|1.8.7|1.9|1.9.1|1.9.2|1.2.0|1.3.1)
|
449
512
|
version="$token" ;;
|
450
|
-
-v|--version)
|
513
|
+
-v|--version)
|
514
|
+
if [ -z "$1" ] ; then
|
515
|
+
action="version"
|
516
|
+
else
|
517
|
+
version="$1"
|
518
|
+
fi
|
519
|
+
shift
|
520
|
+
;;
|
451
521
|
-l|--level) patchlevel="$1" ; shift ;;
|
452
522
|
-p|--prefix) install_path="$1" ; shift ;;
|
453
523
|
-s|--source) source_path="$1" ; shift ;; # Undocumented / untested "feature"
|
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.
|
4
|
+
version: 0.0.6
|
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-
|
12
|
+
date: 2009-08-25 00:00:00 -07:00
|
13
13
|
default_executable: rvm-install
|
14
14
|
dependencies: []
|
15
15
|
|