rvm 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/bash/rvm +351 -344
- data/bash/rvm-install +36 -40
- data/bash/rvm-update +6 -5
- data/bash/rvmrc.sample +30 -0
- data/rvm.gemspec +3 -2
- metadata +3 -2
data/bash/rvm
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
rvm_meta_author="Wayne E. Seguin"
|
4
|
+
rvm_meta_author_email="wayneeseguin@gmail.com"
|
5
|
+
rvm_meta_website="http://rvm.beginrescueend.com/"
|
6
|
+
rvm_meta_version="0.0.23"
|
7
|
+
rvm_meta_updated="2009.08.25"
|
8
8
|
|
9
9
|
#
|
10
10
|
# License: See LICENSE
|
@@ -40,12 +40,13 @@ function rvm-usage {
|
|
40
40
|
list - Show currently installed versions
|
41
41
|
gemdir - Switch to gem directory for installation (new login shell)
|
42
42
|
srcdir - Switch to src directory for the current ruby installation
|
43
|
-
gemdup - Clone source version gems to current version
|
43
|
+
gemdup - Clone source version gems to current version
|
44
44
|
(highly expiramental) Example: rvm gemdup ~/.gem/ruby/1.8/
|
45
45
|
install - Install a ruby version, default is from source
|
46
46
|
uninstall - Uninstall a ruby version
|
47
47
|
reset - Remove default and current settings, exit the shell.
|
48
48
|
(If you experience odd behavior try this first)
|
49
|
+
reload - Reload rvm source itself (useful after changing rvm source)
|
49
50
|
debug - Emit environment & configuration information for *current* ruby
|
50
51
|
|
51
52
|
Implementation:
|
@@ -55,14 +56,16 @@ function rvm-usage {
|
|
55
56
|
ree - Ruby Enterprise Edition
|
56
57
|
default - Resets to the default system ruby
|
57
58
|
all - Used with install, installs all latest known versions
|
58
|
-
|
59
|
-
Options:
|
59
|
+
|
60
|
+
Options:
|
60
61
|
|
61
62
|
-v|--version - Ruby Package Version, defaults to 'latest'
|
62
63
|
-l|--level - Patch level for the specified Ruby version
|
63
64
|
-p|--prefix - Package and source directory prefix, with trailing slash!
|
64
65
|
Default is a users home directory and /usr/local/ for root
|
65
66
|
-c|--configure - Options for source compile (default: --enable-shared)
|
67
|
+
-a|--archives - Directory to place downladed files into (~/.rvm/archives/)
|
68
|
+
-n|--nice - Niceness level (default: 0)
|
66
69
|
-d|--debug - Toggle debug mode on for extra messages (NYI)
|
67
70
|
|
68
71
|
Notes:
|
@@ -91,36 +94,11 @@ function rvm-usage {
|
|
91
94
|
|
92
95
|
TODO: (in order)
|
93
96
|
|
94
|
-
* rvm gemdup
|
97
|
+
* rvm gemdup
|
95
98
|
* root support
|
96
99
|
* Settings file, user overridable
|
97
100
|
* Show current in rvm list, if applicable
|
98
101
|
|
99
|
-
Many Thanks:
|
100
|
-
|
101
|
-
Bash Support Testing
|
102
|
-
|
103
|
-
- Daniel Neighman (dneighman@gmail.com)
|
104
|
-
irc: hassox ; github: http://github.com/hassox
|
105
|
-
|
106
|
-
- John Mettraux (jmettraux@openwfe.org)
|
107
|
-
irc: jmettraux ; github: http://github.com/jmettraux
|
108
|
-
|
109
|
-
ZSH Support Testing
|
110
|
-
|
111
|
-
- Franco Lazzarino (flazzarino@gmail.com)
|
112
|
-
irc: flazz ; github: http://github.com/flazz
|
113
|
-
|
114
|
-
Ubuntu Linux Support Testing
|
115
|
-
|
116
|
-
- Anita Kuno (anteaya@anteaya.info)
|
117
|
-
irc: anteaya ; github: http://github.com/anteaya
|
118
|
-
|
119
|
-
Website Design
|
120
|
-
|
121
|
-
- Jim Lindley (jlindley@gmail.com)
|
122
|
-
irc: jlindley ; github: http://github.com/jlindley
|
123
|
-
|
124
102
|
Usage
|
125
103
|
|
126
104
|
}
|
@@ -148,8 +126,8 @@ ruby:
|
|
148
126
|
full_version: "$(ruby -v)"
|
149
127
|
|
150
128
|
homes:
|
151
|
-
gem: "${GEM_HOME
|
152
|
-
ruby: "${MY_RUBY_HOME
|
129
|
+
gem: "${GEM_HOME:-not set}"
|
130
|
+
ruby: "${MY_RUBY_HOME:-not set}"
|
153
131
|
|
154
132
|
binaries:
|
155
133
|
ruby: "$(which ruby)"
|
@@ -160,169 +138,184 @@ Info
|
|
160
138
|
|
161
139
|
}
|
162
140
|
|
141
|
+
function rvm-curl {
|
142
|
+
pushd $rvm_archives_path > /dev/null
|
143
|
+
eval $rvm_curl "$1"
|
144
|
+
popd > /dev/null
|
145
|
+
}
|
146
|
+
|
163
147
|
function rvm-install-source {
|
164
148
|
|
165
|
-
|
166
|
-
case "$
|
167
|
-
1.9|1.9.1)
|
168
|
-
1.9.2)
|
169
|
-
1.8|1.8.6)
|
170
|
-
1.8.7)
|
171
|
-
*) rvm-log-fail "Ruby version '$
|
149
|
+
rvm_version="${1:-1.8.6}"
|
150
|
+
case "$rvm_version" in
|
151
|
+
1.9|1.9.1) rvm_major="1.9" ; rvm_minor="1" ; rvm_patch_level="${2:-243}" ;;
|
152
|
+
1.9.2) rvm_major="1.9" ; rvm_minor="2" ; rvm_patch_level="${2:-review1}" ;;
|
153
|
+
1.8|1.8.6) rvm_major="1.8" ; rvm_minor="6" ; rvm_patch_level="${2:-369}" ;;
|
154
|
+
1.8.7) rvm_major="1.8" ; rvm_minor="7" ; rvm_patch_level="${2:-174}" ;;
|
155
|
+
*) rvm-log-fail "Ruby version '$rvm_version' is unknown."
|
172
156
|
esac
|
173
157
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
rvm-log-info "Installing Ruby from source to: $
|
178
|
-
mkdir -p $
|
179
|
-
|
180
|
-
pushd $
|
181
|
-
if [ -d $
|
182
|
-
cd $
|
158
|
+
rvm_package_name="ruby-$rvm_major.$rvm_minor-p$rvm_patch_level"
|
159
|
+
rvm_url="ftp://ftp.ruby-lang.org/pub/ruby/$major/$rvm_package_name.tar.gz"
|
160
|
+
|
161
|
+
rvm-log-info "Installing Ruby from source to: $rvm_install_path/$rvm_package_name"
|
162
|
+
mkdir -p $rvm_log_path/$rvm_package_name
|
163
|
+
|
164
|
+
pushd $rvm_source_path > /dev/null
|
165
|
+
if [ -d $rvm_package_name ] ; then
|
166
|
+
cd $rvm_package_name
|
183
167
|
else
|
184
|
-
if [ ! -f "$
|
185
|
-
rvm-log-info "\tDownloading $
|
186
|
-
|
168
|
+
if [ ! -f "$rvm_archives_path/$rvm_package_name.tar.gz" ] ; then
|
169
|
+
rvm-log-info "\tDownloading $rvm_package_name, this may take a while depending on your connection..."
|
170
|
+
rvm-curl $rvm_url
|
187
171
|
fi
|
188
|
-
rvm-log-info "\tExtracting $
|
189
|
-
|
172
|
+
rvm-log-info "\tExtracting $rvm_package_name..."
|
173
|
+
mkdir -p $rvm_source_path/$rvm_package_name
|
174
|
+
nice -n $niceness tar xzf $rvm_archives_path/$rvm_package_name.tar.gz -C $rvm_source_path
|
190
175
|
fi
|
191
176
|
|
192
|
-
|
193
|
-
|
177
|
+
cd $rvm_source_path/$rvm_package_name
|
178
|
+
rvm-log-info "\tConfiguring $rvm_package_name using ${configure:-"--enable-shared"}, this may take a while depending on your cpu(s)..."
|
179
|
+
nice -n $niceness ./configure --prefix=$rvm_install_path/$rvm_package_name ${configure:-"--enable-shared"} > $rvm_log_path/$rvm_package_name/configure.log 2> $rvm_log_path/$rvm_package_name/configure.error.log
|
194
180
|
|
195
|
-
rvm-log-info "\tCompiling $
|
196
|
-
make > $
|
181
|
+
rvm-log-info "\tCompiling $rvm_package_name, this may take a while, depending on your cpu(s)..."
|
182
|
+
nice -n $niceness make > $rvm_log_path/$rvm_package_name/make.log 2> $rvm_log_path/$rvm_package_name/make.error.log
|
197
183
|
|
198
|
-
rvm-log-info "\tInstalling $
|
199
|
-
make install > $
|
200
|
-
chmod +x $
|
184
|
+
rvm-log-info "\tInstalling $rvm_package_name"
|
185
|
+
nice -n $niceness make install > $rvm_log_path/$rvm_package_name/install.log 2> $rvm_log_path/$rvm_package_name/install.error.log
|
186
|
+
chmod +x $rvm_install_path/$rvm_package_name/bin/*
|
201
187
|
|
202
|
-
|
203
|
-
ln -fs $install_path/$package_name/bin/ruby $install_path/bin/$package_name
|
188
|
+
ln -fs $rvm_install_path/$rvm_package_name/bin/ruby $rvm_install_path/bin/$rvm_package_name
|
204
189
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
cd $gem_package_name
|
190
|
+
rvm-log-info "\tInstalling rubygems dedicated to $rvm_package_name..."
|
191
|
+
rvm_gem_package_name="rubygems-1.3.5"
|
192
|
+
rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
|
193
|
+
if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
|
194
|
+
cd $rvm_source_path/$rvm_gem_package_name
|
211
195
|
else
|
212
|
-
if [ ! -f $
|
213
|
-
|
196
|
+
if [ ! -f "$rvm_archives_path/$rvm_gem_package_name.tgz" ] ; then rvm-curl $rvm_gem_url ; fi
|
197
|
+
mkdir -p $rvm_source_path/$rvm_gem_package_name
|
198
|
+
nice -n $niceness tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
|
214
199
|
fi
|
215
200
|
# Well this is fun... fix nil error on require_paths:
|
216
|
-
sed -i
|
217
|
-
|
201
|
+
sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb
|
202
|
+
|
203
|
+
nice -n $niceness $rvm_install_path/$rvm_package_name/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb > $rvm_log_path/$rvm_package_name/rubygems.install.log 2> $rvm_log_path/$rvm_package_name/rubygems.install.error.log
|
218
204
|
popd > /dev/null
|
219
|
-
rvm-log-info "Installation of $
|
205
|
+
rvm-log-info "Installation of $rvm_package_name complete."
|
220
206
|
|
221
207
|
for gem_name in rake ; do
|
222
208
|
rvm-log-info "Installing $gem_name"
|
223
|
-
$
|
209
|
+
nice -n $niceness $rvm_install_path/$rvm_package_name/bin/gem install $gem_name --no-rdoc --no-ri -q >> $rvm_log_path/$rvm_package_name/gems.install.log 2> $rvm_log_path/$rvm_package_name/gems.error.log
|
224
210
|
done
|
225
211
|
}
|
226
212
|
|
227
213
|
function rvm-install-ruby {
|
228
214
|
|
229
|
-
|
215
|
+
if [ -z "$RUBYOPT" ] ; then
|
216
|
+
ruby_options=$RUBYOPT ; unset RUBYOPT
|
217
|
+
fi
|
230
218
|
|
231
|
-
case "$
|
219
|
+
case "$rvm_implementation" in
|
232
220
|
|
233
221
|
ree)
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
rvm-log-info "Installing Ruby Enterprise Edition from source to: $
|
239
|
-
pushd $
|
240
|
-
if [ -d $
|
241
|
-
cd $
|
222
|
+
rvm_version=${rvm_version:-1.8.6}
|
223
|
+
rvm_patchlevel=${rvm_patchlevel:-20090610}
|
224
|
+
rvm_package_name="ruby-enterprise-$rvm_version-$rvm_patchlevel"
|
225
|
+
rvm_url="http://rubyforge.org/frs/download.php/58677/$rvm_package_name.tar.gz"
|
226
|
+
rvm-log-info "Installing Ruby Enterprise Edition from source to: $rvm_install_path/$rvm_package_name"
|
227
|
+
pushd $rvm_source_path > /dev/null
|
228
|
+
if [ -d $rvm_source_path/$rvm_package_name ] ; then
|
229
|
+
cd $rvm_source_path/$rvm_package_name
|
242
230
|
else
|
243
|
-
if [ ! -f "$
|
244
|
-
rvm-log-info "\tDownloading $
|
245
|
-
|
231
|
+
if [ ! -f "$rvm_archives_path/$rvm_package_name.tar.gz" ] ; then
|
232
|
+
rvm-log-info "\tDownloading $rvm_package_name, this may take a while depending on your connection..."
|
233
|
+
rvm-curl $rvm_url
|
246
234
|
fi
|
247
|
-
rvm-log-info "\tExtracting $
|
248
|
-
|
235
|
+
rvm-log-info "\tExtracting $rvm_package_name..."
|
236
|
+
mkdir -p $rvm_source_path/$rvm_package_name
|
237
|
+
nice -n $niceness tar xzf $rvm_archives_path/$rvm_package_name.tar.gz -C $rvm_source_path
|
249
238
|
fi
|
250
239
|
|
251
|
-
rvm-log-info "\tInstalling $
|
252
|
-
mkdir -p $
|
253
|
-
|
254
|
-
|
240
|
+
rvm-log-info "\tInstalling $rvm_package_name, this may take a while, depending on your cpu(s)..."
|
241
|
+
mkdir -p $rvm_log_path/$rvm_package_name
|
242
|
+
|
243
|
+
cd $rvm_source_path/$rvm_package_name
|
244
|
+
nice -n $niceness ./installer -a $rvm_install_path/ruby-enterprise-$rvm_version-$rvm_patchlevel --dont-install-useful-gems > $rvm_log_path/$rvm_package_name/install.log 2> $rvm_log_path/$rvm_package_name/install.error.log
|
245
|
+
chmod +x $rvm_install_path/$rvm_package_name/bin/*
|
255
246
|
|
256
|
-
ln -fs $
|
247
|
+
ln -fs $rvm_install_path/$rvm_package_name/bin/ruby $rvm_install_path/bin/$rvm_package_name
|
257
248
|
|
258
|
-
rvm-log-info "\tInstalling rubygems dedicated to $
|
259
|
-
|
260
|
-
|
261
|
-
if [ -d $
|
262
|
-
cd $
|
249
|
+
rvm-log-info "\tInstalling rubygems dedicated to $rvm_package_name..."
|
250
|
+
rvm_gem_package_name="rubygems-1.3.5"
|
251
|
+
rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
|
252
|
+
if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then
|
253
|
+
cd $rvm_source_path/$rvm_gem_package_name
|
263
254
|
else
|
264
|
-
if [ ! -f $
|
265
|
-
|
255
|
+
if [ ! -f "$rvm_archives_path/$rvm_gem_package_name.tgz" ] ; then rvm-curl $rvm_gem_url ; fi
|
256
|
+
mkdir -p $rvm_source_path/$rvm_gem_package_name
|
257
|
+
nice -n $niceness tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path
|
266
258
|
fi
|
267
259
|
# Well this is fun... fix nil error on require_paths:
|
268
|
-
sed -i
|
269
|
-
|
270
|
-
|
260
|
+
sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb > $rvm_log_path/$rvm_package_name/rubygems.install.log 2> $rvm_log_path/$rvm_package_name/rubygems.install.error.log
|
261
|
+
|
262
|
+
nice -n $niceness $rvm_install_path/$rvm_package_name/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb > $rvm_log_path/$rvm_package_name/rubygems.install.log 2> $rvm_log_path/$rvm_package_name/rubygems.install.error.log
|
263
|
+
rvm-log-info "Installation of $rvm_package_name complete."
|
271
264
|
popd > /dev/null
|
272
|
-
|
265
|
+
|
273
266
|
for gem_name in rake ; do
|
274
267
|
rvm-log-info "Installing $gem_name"
|
275
|
-
$
|
268
|
+
nice -n $niceness $rvm_install_path/$rvm_package_name/bin/gem install $gem_name --no-rdoc --no-ri -q >> $rvm_log_path/$rvm_package_name/gems.install.log 2> $rvm_log_path/$rvm_package_name/gems.error.log
|
276
269
|
done
|
277
270
|
;;
|
278
271
|
|
279
272
|
jruby)
|
280
|
-
|
281
|
-
unset
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
rvm-log-info "Installing jRuby to: $
|
287
|
-
mkdir -p $
|
288
|
-
pushd $
|
289
|
-
if [ -d $
|
290
|
-
cd $
|
273
|
+
rvm_version=${rvm_version:-1.3.1} # 1.2.0, 1.3.1
|
274
|
+
unset rvm_patchlevel # No patchlevel for jRuby
|
275
|
+
rvm_package_file="$rvm_implementation-bin-$rvm_version"
|
276
|
+
rvm_package_name="$rvm_implementation-$rvm_version"
|
277
|
+
rvm_url="http://dist.codehaus.org/$rvm_implementation/$rvm_version/$rvm_package_file.zip"
|
278
|
+
|
279
|
+
rvm-log-info "Installing jRuby to: $rvm_install_path/$rvm_package_name"
|
280
|
+
mkdir -p $rvm_log_path/$rvm_package_name
|
281
|
+
pushd $rvm_source_path > /dev/null
|
282
|
+
if [ -d $rvm_package_name ] ; then
|
283
|
+
cd $rvm_source_path/$rvm_package_name
|
291
284
|
else
|
292
|
-
if [ ! -f "$
|
293
|
-
rvm-log-info "\tDownloading $
|
294
|
-
|
285
|
+
if [ ! -f "$rvm_archives_path/$rvm_package_file.zip" ] ; then
|
286
|
+
rvm-log-info "\tDownloading $rvm_package_file, this may take a while depending on your connection..."
|
287
|
+
rvm-curl $rvm_url
|
295
288
|
fi
|
296
|
-
rvm-log-info "\tExtracting $
|
297
|
-
|
289
|
+
rvm-log-info "\tExtracting $rvm_package_file..."
|
290
|
+
nice -n $niceness unzip -q $rvm_archives_path/$rvm_package_file.zip -d $rvm_source_path
|
298
291
|
fi
|
299
292
|
|
300
|
-
rvm-log-info "\tInstalling $
|
301
|
-
mkdir -p $
|
302
|
-
rsync -ag $
|
303
|
-
cd $
|
293
|
+
rvm-log-info "\tInstalling $rvm_package_name..."
|
294
|
+
mkdir -p $rvm_install_path/$rvm_package_name/bin/
|
295
|
+
rsync -ag $rvm_source_path/$rvm_package_name/ $rvm_install_path/$rvm_package_name/
|
296
|
+
cd $rvm_source_path/$rvm_package_name/tool/nailgun && make > $rvm_log_path/$rvm_package_name/install.nailgun.log 2> $rvm_log_path/$rvm_package_name/install.error.nailgun.log
|
304
297
|
popd > /dev/null
|
305
|
-
chmod +x $
|
298
|
+
chmod +x $rvm_install_path/$rvm_package_name/bin/*
|
306
299
|
for binary in jruby jgem jirb ; do
|
307
|
-
ln -fs $
|
300
|
+
ln -fs $rvm_install_path/$rvm_package_name/bin/$binary $rvm_install_path/$rvm_package_name/bin/${binary#j}
|
308
301
|
done
|
309
302
|
|
310
|
-
ln -fs $
|
303
|
+
ln -fs $rvm_install_path/$rvm_package_name/bin/ruby $rvm_install_path/bin/$rvm_package_name
|
311
304
|
|
312
305
|
for gem_name in rake jruby-openssl ; do
|
313
306
|
rvm-log-info "Installing $gem_name"
|
314
|
-
$
|
307
|
+
nice -n $niceness $rvm_install_path/$rvm_package_name/bin/jgem install $gem_name --no-rdoc --no-ri -q >> $rvm_log_path/$rvm_package_name/gems.install.log 2> $rvm_log_path/$rvm_package_name/gems.error.log
|
315
308
|
done
|
316
309
|
;;
|
317
310
|
|
318
311
|
ruby)
|
319
|
-
rvm-install-source ${
|
312
|
+
rvm-install-source ${rvm_version:-1.8.6} ${rvm_patchlevel:-$3}
|
320
313
|
;;
|
321
314
|
|
322
315
|
default)
|
323
316
|
rvm-log-fail "please specify a ruby implementation to install."
|
324
317
|
;;
|
325
|
-
*) rvm-log-fail "Ruby implementation '$
|
318
|
+
*) rvm-log-fail "Ruby implementation '$rvm_implementation' is not known."
|
326
319
|
|
327
320
|
esac
|
328
321
|
|
@@ -334,150 +327,150 @@ function rvm-install-ruby {
|
|
334
327
|
|
335
328
|
function rvm-uninstall {
|
336
329
|
|
337
|
-
|
338
|
-
case "$
|
330
|
+
rvm_implementation="${1:-$rvm_implementation}"
|
331
|
+
case "$rvm_implementation" in
|
339
332
|
|
340
333
|
jruby)
|
341
|
-
|
342
|
-
if [ "$
|
343
|
-
|
334
|
+
rvm_version="${rvm_version:-1.3.1}"
|
335
|
+
if [ "$rvm_version" = "1.2.0" -o "$rvm_version" = "1.3.1" ] ; then
|
336
|
+
rvm_package_name="jruby*-$rvm_version"
|
344
337
|
else
|
345
|
-
rvm-log-fail "Unknown jRuby version: $
|
338
|
+
rvm-log-fail "Unknown jRuby version: $rvm_version"
|
346
339
|
fi
|
347
340
|
;;
|
348
341
|
|
349
342
|
ree)
|
350
|
-
|
351
|
-
if [ "$
|
352
|
-
|
343
|
+
rvm_version=${rvm_version:-1.8.6}
|
344
|
+
if [ "$rvm_version" = "1.8.6" ] ; then
|
345
|
+
rvm_package_name="ruby-enterprise-$rvm_version-${3:-20090610}"
|
353
346
|
else
|
354
|
-
rvm-log-fail "Unknown Ruby Enterprise Edition version: $
|
347
|
+
rvm-log-fail "Unknown Ruby Enterprise Edition version: $rvm_version"
|
355
348
|
fi
|
356
349
|
;;
|
357
350
|
|
358
351
|
ruby)
|
359
|
-
if [ "$
|
360
|
-
|
352
|
+
if [ "$rvm_version" = "1.8.7" ] ; then
|
353
|
+
rvm_package_name="ruby-1.8.7-p${rvm_patchlevel:-174}"
|
361
354
|
|
362
|
-
elif [ "$
|
363
|
-
|
355
|
+
elif [ "$rvm_version" = "1.8.6" -o "$rvm_version" = "1.8" ] ; then
|
356
|
+
rvm_package_name="ruby-1.8.6-p${rvm_patchlevel:-369}"
|
364
357
|
|
365
|
-
elif [ "$
|
366
|
-
|
358
|
+
elif [ "$rvm_version" = "1.9.2" ] ; then
|
359
|
+
rvm_package_name="ruby-1.9.2-p${rvm_patchlevel:-review1}"
|
367
360
|
|
368
|
-
elif [ "$
|
369
|
-
|
361
|
+
elif [ "$rvm_version" = "1.9.1" -o "$rvm_version" = "1.9" ] ; then
|
362
|
+
rvm_package_name="ruby-1.9.1-p${rvm_patchlevel:-243}"
|
370
363
|
|
371
364
|
else
|
372
|
-
rvm-log-fail "Unknown ruby version: $
|
365
|
+
rvm-log-fail "Unknown ruby version: $rvm_version"
|
373
366
|
fi
|
374
367
|
;;
|
375
368
|
|
376
369
|
*)
|
377
|
-
rvm-log-fail "Ruby implementation '$
|
370
|
+
rvm-log-fail "Ruby implementation '$rvm_implementation' is not known."
|
378
371
|
|
379
372
|
esac
|
380
373
|
|
381
|
-
if [ ! -z "$
|
382
|
-
for path in $
|
383
|
-
if [ -d $path/$
|
384
|
-
rvm-log-info "Removing $path/$
|
385
|
-
rm -rf $path/$
|
374
|
+
if [ ! -z "$rvm_package_name" ] ; then
|
375
|
+
for path in $rvm_source_path $rvm_install_path ; do
|
376
|
+
if [ -d $path/$rvm_package_name ] ; then
|
377
|
+
rvm-log-info "Removing $path/$rvm_package_name..."
|
378
|
+
rm -rf $path/$rvm_package_name
|
386
379
|
fi
|
387
380
|
done
|
388
381
|
else
|
389
|
-
rvm-log-fail "Cannot uninstall unknown package '$
|
382
|
+
rvm-log-fail "Cannot uninstall unknown package '$rvm_package_name'"
|
390
383
|
fi
|
391
384
|
|
392
385
|
}
|
393
386
|
|
394
387
|
function rvm-use {
|
395
388
|
|
396
|
-
|
397
|
-
case "$
|
389
|
+
rvm_implementation="${1:-$rvm_implementation}"
|
390
|
+
case "$rvm_implementation" in
|
398
391
|
|
399
392
|
default)
|
400
|
-
rm -f $
|
401
|
-
source $install_path/default
|
393
|
+
rm -f $rvm_install_path/current
|
402
394
|
unset GEM_HOME MY_RUBY_HOME
|
395
|
+
source $rvm_install_path/default
|
403
396
|
PATH="$default_path" ; export PATH
|
404
397
|
;;
|
405
398
|
|
406
399
|
jruby)
|
407
|
-
|
408
|
-
if [ "$
|
409
|
-
MY_RUBY_HOME="$
|
400
|
+
rvm_version="${rvm_version:-1.3.1}"
|
401
|
+
if [ "$rvm_version" = "1.2.0" -o "$rvm_version" = "1.3.1" ] ; then
|
402
|
+
MY_RUBY_HOME="$rvm_install_path/jruby-$rvm_version"
|
410
403
|
GEM_HOME="$HOME/.gem/jruby/1.8"
|
411
404
|
alias ruby_ng="jruby --ng"
|
412
405
|
alias ruby_ng_server="jruby --ng-server"
|
413
406
|
else
|
414
|
-
rvm-log-fail "Unknown jRuby version: $
|
407
|
+
rvm-log-fail "Unknown jRuby version: $rvm_version"
|
415
408
|
fi
|
416
409
|
;;
|
417
410
|
|
418
411
|
ree)
|
419
|
-
|
420
|
-
if [ "$
|
421
|
-
|
422
|
-
MY_RUBY_HOME="$
|
412
|
+
rvm_version=${rvm_version:-1.8.6}
|
413
|
+
if [ "$rvm_version" = "1.8.6" ] ; then
|
414
|
+
rvm_patchlevel="${3:-20090610}"
|
415
|
+
MY_RUBY_HOME="$rvm_install_path/ruby-enterprise-$rvm_version-$rvm_patchlevel"
|
423
416
|
GEM_HOME="$HOME/.gem/ruby-enterprise/1.8"
|
424
417
|
else
|
425
|
-
rvm-log-fail "Unknown Ruby Enterprise Edition version: $
|
418
|
+
rvm-log-fail "Unknown Ruby Enterprise Edition version: $rvm_version"
|
426
419
|
fi
|
427
420
|
;;
|
428
421
|
|
429
422
|
ruby)
|
430
|
-
if [ "$
|
431
|
-
level="${
|
432
|
-
MY_RUBY_HOME="$
|
433
|
-
GEM_HOME="$HOME/.gem/ruby/1.8"
|
434
|
-
|
435
|
-
elif [ "$
|
436
|
-
level="${
|
437
|
-
MY_RUBY_HOME="$
|
438
|
-
GEM_HOME="$HOME/.gem/ruby/1.8"
|
439
|
-
|
440
|
-
elif [ "$
|
441
|
-
level="${
|
442
|
-
MY_RUBY_HOME="$
|
423
|
+
if [ "$rvm_version" = "1.8.7" ] ; then
|
424
|
+
level="${rvm_patchlevel:-174}"
|
425
|
+
MY_RUBY_HOME="$rvm_install_path/ruby-1.8.7-p$level"
|
426
|
+
GEM_HOME="$HOME/.gem/ruby/1.8.7"
|
427
|
+
|
428
|
+
elif [ "$rvm_version" = "1.8.6" -o "$rvm_version" = "1.8" ] ; then
|
429
|
+
level="${rvm_patchlevel:-369}"
|
430
|
+
MY_RUBY_HOME="$rvm_install_path/ruby-1.8.6-p$level"
|
431
|
+
GEM_HOME="$HOME/.gem/ruby/1.8.6"
|
432
|
+
|
433
|
+
elif [ "$rvm_version" = "1.9.2" ] ; then
|
434
|
+
level="${rvm_patchlevel:-review1}"
|
435
|
+
MY_RUBY_HOME="$rvm_install_path/ruby-1.9.2-p$level"
|
443
436
|
GEM_HOME="$HOME/.gem/ruby/1.9.2"
|
444
437
|
|
445
|
-
elif [ "$
|
446
|
-
level="${
|
447
|
-
MY_RUBY_HOME="$
|
438
|
+
elif [ "$rvm_version" = "1.9.1" -o "$rvm_version" = "1.9" ] ; then
|
439
|
+
level="${rvm_patchlevel:-243}"
|
440
|
+
MY_RUBY_HOME="$rvm_install_path/ruby-1.9.1-p$level"
|
448
441
|
GEM_HOME="$HOME/.gem/ruby/1.9.1"
|
449
442
|
|
450
443
|
else
|
451
|
-
rvm-log-fail "Unknown ruby version: $
|
444
|
+
rvm-log-fail "Unknown ruby version: $rvm_version"
|
452
445
|
fi
|
453
446
|
;;
|
454
447
|
|
455
448
|
*)
|
456
|
-
rvm-log-fail "Ruby implementation '$
|
449
|
+
rvm-log-fail "Ruby implementation '$rvm_implementation' is not known."
|
457
450
|
|
458
451
|
esac
|
459
452
|
|
460
453
|
# Now actually use it.
|
461
|
-
if [ ! "$
|
454
|
+
if [ ! "$rvm_implementation" = "default" ] ; then
|
462
455
|
# Install if not installed
|
463
456
|
if [ ! -d $MY_RUBY_HOME ] ; then
|
464
|
-
rvm-log-warn "$
|
465
|
-
rvm-install-ruby $
|
457
|
+
rvm-log-warn "$rvm_implementation $rvm_version is not installed."
|
458
|
+
rvm-install-ruby $rvm_implementation $rvm_version $level
|
466
459
|
fi
|
467
460
|
|
468
461
|
# Set as 'current'
|
469
462
|
RUBY_VERSION="$($MY_RUBY_HOME/bin/ruby -v | sed 's/^\(.*\) (.*$/\1/')"
|
470
463
|
export GEM_HOME MY_RUBY_HOME RUBY_VERSION
|
471
464
|
|
472
|
-
echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$default_path ; export PATH" > $
|
465
|
+
echo "PATH=$MY_RUBY_HOME/bin:$GEM_HOME/bin:$default_path ; export PATH" > $rvm_install_path/current
|
473
466
|
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
|
474
467
|
eval "export $variable"
|
475
468
|
eval value=\$${variable}
|
476
|
-
echo "${variable}='$value' ; export ${variable}" >> $
|
469
|
+
echo "${variable}='$value' ; export ${variable}" >> $rvm_install_path/current
|
477
470
|
done
|
478
471
|
fi
|
479
472
|
|
480
|
-
rvm-log-info "Switching to $
|
473
|
+
rvm-log-info "Switching to $rvm_implementation $rvm_version $rvm_patchlevel ...\n"
|
481
474
|
if [ ! -z "$BASH_VERSION" ] ; then
|
482
475
|
exec bash -l
|
483
476
|
elif [ ! -z "$ZSH_VERSION" ] ; then
|
@@ -489,29 +482,24 @@ function rvm-use {
|
|
489
482
|
}
|
490
483
|
|
491
484
|
function rvm-symlinks {
|
492
|
-
|
493
|
-
|
485
|
+
|
486
|
+
mkdir -p ${rvm_install_path}/bin
|
487
|
+
for release in `ls $rvm_install_path | grep 'ruby-'` ; do
|
494
488
|
for binary in ruby irb gem rdoc ri erb ; do
|
495
|
-
if [ -x $
|
496
|
-
ln -fs $
|
489
|
+
if [ -x $rvm_install_path/$release/bin/$binary ] ; then
|
490
|
+
ln -fs $rvm_install_path/$release/bin/$binary $rvm_install_path/bin/$binary-${release#ruby-}
|
497
491
|
fi
|
498
492
|
done
|
499
493
|
done
|
494
|
+
|
500
495
|
}
|
501
496
|
|
502
497
|
function rvm-list {
|
503
498
|
|
504
|
-
echo -e "\nruby
|
505
|
-
ls -l $
|
506
|
-
echo
|
507
|
-
echo "
|
508
|
-
ls -l $install_path/ | awk '/jruby-.*/ { print " - " $NF }'
|
509
|
-
echo
|
510
|
-
echo "ree:"
|
511
|
-
ls $install_path/ | awk '/ruby-enterprise-.*/ { print " - " $NF }'
|
512
|
-
echo
|
513
|
-
echo "default:"
|
514
|
-
echo " - system (`$default_system_ruby -v`)"
|
499
|
+
echo -e "\nruby:\n$(ls -l $rvm_install_path/ | awk '/ ruby-[1-2].*/ { print " - " $NF }')\n"
|
500
|
+
echo -e "jruby:\n$(ls -l $rvm_install_path/ | awk '/jruby-.*/ { print " - " $NF }')\n"
|
501
|
+
echo -e "ree:\n$(ls $rvm_install_path/ | awk '/ruby-enterprise-.*/ { print " - " $NF }')\n"
|
502
|
+
echo -e "system:\n - ($($default_system_ruby -v))\n"
|
515
503
|
|
516
504
|
}
|
517
505
|
|
@@ -521,7 +509,7 @@ function rvm-reset {
|
|
521
509
|
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME ; do
|
522
510
|
unset $variable
|
523
511
|
done
|
524
|
-
rm -f $
|
512
|
+
rm -f $rvm_install_path/default* $rvm_install_path/current
|
525
513
|
if [ ! -z "$BASH_VERSION" ] ; then
|
526
514
|
exec bash -l
|
527
515
|
elif [ ! -z "$ZSH_VERSION" ] ; then
|
@@ -529,29 +517,29 @@ function rvm-reset {
|
|
529
517
|
else
|
530
518
|
rvm-log-fail "Your shell is not supported bash and zsh are currently supported."
|
531
519
|
fi
|
532
|
-
|
520
|
+
|
533
521
|
}
|
534
|
-
|
522
|
+
|
535
523
|
function rvm-gem-dir {
|
536
524
|
|
537
|
-
|
538
|
-
if [ "$
|
525
|
+
rvm_implementation=${1:-$rvm_implementation}
|
526
|
+
if [ -z "$rvm_implementation" ] ; then rvm_implementation="current" ; fi
|
539
527
|
|
540
|
-
case "$
|
528
|
+
case "$rvm_implementation" in
|
541
529
|
jruby) GEM_HOME="$HOME/.gem/jruby/1.8" ;;
|
542
530
|
ree) GEM_HOME="$HOME/.gem/ruby-enterprise/1.8" ;;
|
543
531
|
ruby)
|
544
|
-
if [ "${2
|
532
|
+
if [ "${2:-$rvm_version}" = "1.8" -o "${2:-$rvm_version}" = "1.8.6" ] ; then
|
545
533
|
GEM_HOME="$HOME/.gem/ruby/1.8"
|
546
534
|
|
547
|
-
elif [ "${2
|
535
|
+
elif [ "${2:-$rvm_version}" = "1.9.2" ] ; then
|
548
536
|
GEM_HOME="$HOME/.gem/ruby/1.9.2"
|
549
537
|
|
550
|
-
elif [ "${2
|
538
|
+
elif [ "${2:-$rvm_version}" = "1.9" -o "${2:-$rvm_version}" = "1.9.1" ] ; then
|
551
539
|
GEM_HOME="$HOME/.gem/ruby/1.9.1"
|
552
540
|
|
553
541
|
else
|
554
|
-
rvm-log-fail "Unknown Version: ${2
|
542
|
+
rvm-log-fail "Unknown Version: ${2:-$rvm_version}"
|
555
543
|
fi
|
556
544
|
;;
|
557
545
|
current)
|
@@ -561,56 +549,56 @@ function rvm-gem-dir {
|
|
561
549
|
GEM_HOME=$default_system_gem_path
|
562
550
|
;;
|
563
551
|
user)
|
564
|
-
GEM_HOME=$
|
552
|
+
GEM_HOME=$default_user_gem_path
|
565
553
|
;;
|
566
554
|
*)
|
567
|
-
rvm-log-fail "Ruby implementation '$
|
555
|
+
rvm-log-fail "Ruby implementation '$rvm_implementation' is not known."
|
568
556
|
esac
|
569
557
|
|
570
558
|
if [ -d $GEM_HOME ] ; then
|
571
559
|
echo $GEM_HOME && cd $GEM_HOME
|
572
560
|
else
|
573
|
-
rvm-log-fail "$
|
561
|
+
rvm-log-fail "$rvm_implementation $rvm_version GEM directory does not exist."
|
574
562
|
fi
|
575
563
|
|
576
564
|
}
|
577
565
|
|
578
566
|
function rvm-src-dir {
|
579
|
-
case "${1
|
567
|
+
case "${1:-$rvm_implementation}" in
|
580
568
|
|
581
569
|
jruby)
|
582
|
-
|
583
|
-
if [ "${2
|
584
|
-
src_dir="$
|
570
|
+
rvm_version=${rvm_version:-1.3.1}
|
571
|
+
if [ "${2:-$rvm_version}" = "1.2.0" -o "${2:-$rvm_version}" = "1.3.1" ] ; then
|
572
|
+
src_dir="$rvm_source_path/$rvm_implementation-$rvm_version"
|
585
573
|
else
|
586
|
-
rvm-log-fail "Unknown jRuby version: $
|
574
|
+
rvm-log-fail "Unknown jRuby version: $rvm_version"
|
587
575
|
fi
|
588
576
|
;;
|
589
577
|
|
590
578
|
ree)
|
591
|
-
|
592
|
-
if [ "${2
|
593
|
-
src_dir="$
|
579
|
+
rvm_version=${rvm_version:-1.8.6}
|
580
|
+
if [ "${2:-$rvm_version}" = "1.8.6" -o "${2:-$rvm_version}" = "1.8" ] ; then
|
581
|
+
src_dir="$rvm_source_path/ruby-enterprise-${2:-$rvm_version}-"${3:-20090610}""
|
594
582
|
else
|
595
|
-
rvm-log-fail "Unknown Ruby Enterprise Edition version: ${2
|
583
|
+
rvm-log-fail "Unknown Ruby Enterprise Edition version: ${2:-$rvm_version}"
|
596
584
|
fi
|
597
585
|
;;
|
598
586
|
|
599
587
|
ruby)
|
600
|
-
if [ "${2
|
601
|
-
src_dir="$
|
588
|
+
if [ "${2:-$rvm_version}" = "1.8.7" ] ; then
|
589
|
+
src_dir="$rvm_source_path/ruby-1.8.7-p${rvm_patchlevel:-174}"
|
602
590
|
|
603
|
-
elif [ "${2
|
604
|
-
src_dir="$
|
591
|
+
elif [ "${2:-$rvm_version}" = "1.8" -o "${2:-$rvm_version}" = "1.8.6" ] ; then
|
592
|
+
src_dir="$rvm_source_path/ruby-1.8.6-p${rvm_patchlevel:-369}"
|
605
593
|
|
606
|
-
elif [ "${2
|
607
|
-
src_dir="$
|
594
|
+
elif [ "${2:-$rvm_version}" = "1.9.2" ] ; then
|
595
|
+
src_dir="$rvm_source_path/ruby-1.9.2-p${rvm_patchlevel:-review1}"
|
608
596
|
|
609
|
-
elif [ "${2
|
610
|
-
src_dir="$
|
597
|
+
elif [ "${2:-$rvm_version}" = "1.9" -o "${2:-$rvm_version}" = "1.9.1" ] ; then
|
598
|
+
src_dir="$rvm_source_path/ruby-1.9.1-p${rvm_patchlevel:-243}"
|
611
599
|
|
612
600
|
else
|
613
|
-
rvm-log-fail "unknown Ruby version: ${2
|
601
|
+
rvm-log-fail "unknown Ruby version: ${2:-$rvm_version}"
|
614
602
|
fi
|
615
603
|
;;
|
616
604
|
|
@@ -619,14 +607,14 @@ function rvm-src-dir {
|
|
619
607
|
;;
|
620
608
|
|
621
609
|
*)
|
622
|
-
rvm-log-fail "Ruby implementation '$
|
610
|
+
rvm-log-fail "Ruby implementation '$rvm_implementation' is not known."
|
623
611
|
return 1
|
624
612
|
esac
|
625
613
|
|
626
614
|
if [ -d $src_dir ] ; then
|
627
615
|
cd $src_dir
|
628
616
|
else
|
629
|
-
rvm-log-fail "$
|
617
|
+
rvm-log-fail "$rvm_implementation $rvm_version source directory does not exist."
|
630
618
|
fi
|
631
619
|
|
632
620
|
}
|
@@ -635,11 +623,11 @@ function rvm-src-dir {
|
|
635
623
|
function rvm-gem-dup {
|
636
624
|
|
637
625
|
if [ "$1" = "default" ] ; then
|
638
|
-
gem_dir="$
|
626
|
+
gem_dir="$default_user_gem_path"
|
639
627
|
elif [ "$1" = "system" ] ; then
|
640
628
|
gem_dir="$default_system_gem_path"
|
641
629
|
else
|
642
|
-
gem_dir=${1
|
630
|
+
gem_dir=${1:-$default_user_gem_path} # TODO: check for and remove trailing /gems
|
643
631
|
fi
|
644
632
|
|
645
633
|
if [ ! -z "$gem_dir" ] ; then
|
@@ -653,172 +641,188 @@ function rvm-gem-dup {
|
|
653
641
|
fi
|
654
642
|
done
|
655
643
|
else
|
656
|
-
rvm-log-fail "Unknown $
|
644
|
+
rvm-log-fail "Unknown $rvm_implementation version: $rvm_version"
|
657
645
|
fi
|
658
646
|
|
659
647
|
}
|
660
648
|
|
661
|
-
function rvm-version { echo "rvm $
|
649
|
+
function rvm-version { echo "rvm $rvm_meta_version ($rvm_meta_updated) [$rvm_meta_website]" ; }
|
662
650
|
|
663
651
|
function rvm {
|
664
652
|
|
665
653
|
# Cleanup, aisle 3
|
666
|
-
for variable in
|
667
|
-
eval "unset $variable"
|
668
|
-
done
|
669
|
-
|
654
|
+
for variable in rvm_action rvm_implementation rvm_patchlevel rvm_version rvm_source_path rvm_install_path rvm_debug rvm_prefix_path rvm_package_name; do
|
655
|
+
eval "unset $variable"
|
656
|
+
done ; unset variable
|
657
|
+
|
658
|
+
# NOW load defaults settings. TODO: root user loads /etc/rvmrc
|
659
|
+
if [ -f ~/.rvmrc ] ; then source ~/.rvmrc ; fi
|
660
|
+
|
670
661
|
while [ $# -gt 0 ] ; do
|
671
|
-
|
672
|
-
case "$
|
673
|
-
install|uninstall|use|path|info|setup|version|srcdir|list|symlinks|reset|debug)
|
674
|
-
|
662
|
+
rvm_token="$1" ; shift
|
663
|
+
case "$rvm_token" in
|
664
|
+
install|uninstall|use|path|info|setup|version|srcdir|list|symlinks|reset|debug|reload)
|
665
|
+
rvm_action=$rvm_token
|
675
666
|
;;
|
676
667
|
|
677
668
|
ruby|jruby|ree|default|all)
|
678
|
-
|
679
|
-
|
669
|
+
rvm_implementation="$rvm_token"
|
670
|
+
rvm_action="${rvm_action:-use}"
|
680
671
|
;;
|
681
672
|
|
682
673
|
gemdir)
|
683
|
-
|
674
|
+
rvm_action=$rvm_token
|
684
675
|
if [ "$1" = "system" ] ; then
|
685
|
-
|
676
|
+
rvm_implementation="system" ; shift
|
686
677
|
fi
|
687
|
-
if [ "$1" = "user" ] ; then
|
688
|
-
|
678
|
+
if [ "$1" = "user" ] ; then
|
679
|
+
rvm_implementation="user" ; shift
|
689
680
|
fi
|
690
681
|
|
691
|
-
|
682
|
+
rvm_implementation="${rvm_implementation:-current}"
|
692
683
|
;;
|
693
684
|
|
694
685
|
gemdup)
|
695
|
-
|
686
|
+
rvm_action=$rvm_token
|
696
687
|
if [ -z "$1" ] ; then
|
697
|
-
|
688
|
+
rvm_implementation="default"
|
698
689
|
elif [ "$1" = "system" ] ; then
|
699
|
-
|
690
|
+
rvm_implementation=$1 ; shift
|
700
691
|
elif [ "$1" = "default" ] ; then
|
701
|
-
|
692
|
+
rvm_implementation=$1 ; shift
|
702
693
|
else
|
703
|
-
|
704
|
-
|
694
|
+
rvm_implementation=$1 ; shift
|
695
|
+
rvm_version=$2 ; shift
|
705
696
|
fi
|
706
697
|
;;
|
707
698
|
|
708
699
|
1.8|1.8.6|1.8.7|1.9|1.9.1|1.9.2|1.2.0|1.3.1)
|
709
|
-
|
710
|
-
|
700
|
+
rvm_version="$rvm_token"
|
701
|
+
rvm_action="${rvm_action:-use}"
|
711
702
|
;;
|
712
703
|
|
713
|
-
-v|--version)
|
714
|
-
if [ -z "$1" ] ; then
|
715
|
-
|
716
|
-
else
|
717
|
-
|
704
|
+
-v|--version)
|
705
|
+
if [ -z "$1" ] ; then
|
706
|
+
rvm_action="version"
|
707
|
+
else
|
708
|
+
rvm_version="$1"
|
718
709
|
fi
|
719
710
|
shift
|
720
711
|
;;
|
721
712
|
|
722
|
-
-l|--level)
|
723
|
-
-p|--prefix)
|
724
|
-
-
|
725
|
-
-
|
726
|
-
-
|
713
|
+
-l|--level) rvm_patchlevel="$1" ; shift ;;
|
714
|
+
-p|--prefix) rvm_prefix_path="$1" ; shift ;;
|
715
|
+
-b|--bin) rvm_bin_path="$1" ; shift ;; # Undocumented / untested "feature"
|
716
|
+
-s|--source) rvm_source_path="$1" ; shift ;; # Undocumented / untested "feature"
|
717
|
+
-a|--archive) rvm_archives_path="$1" ; shift ;;
|
718
|
+
-c|--configure) configure="$1" ; shift ;;
|
719
|
+
-n|--nice) niceness="$1" ; shift ;;
|
720
|
+
-d|--debug) rvm_debug=1 ;;
|
727
721
|
*) rvm-usage ; return 1
|
728
|
-
esac
|
729
|
-
done
|
730
|
-
|
731
|
-
|
722
|
+
esac
|
723
|
+
done
|
724
|
+
|
725
|
+
if [ "$rvm_debug" = "1" ] ; then set -x ; fi
|
726
|
+
|
727
|
+
rvm_curl=`which curl`
|
732
728
|
if [ $? -ne 0 ] ; then
|
733
729
|
rvm-log-fail "rvm expects that curl is available, which curl shows no curl :("
|
734
730
|
else
|
735
|
-
|
731
|
+
rvm_curl="$rvm_curl -O -L -s"
|
736
732
|
fi
|
737
733
|
|
738
|
-
if [ -z "$
|
739
|
-
|
734
|
+
if [ -z "$rvm_implementation" -a -z "$rvm_version" ] ; then
|
735
|
+
rvm_implementation="default"
|
740
736
|
else
|
741
|
-
|
737
|
+
rvm_implementation=${rvm_implementation:-ruby}
|
742
738
|
fi
|
743
739
|
|
740
|
+
niceness=${niceness:-0}
|
741
|
+
|
744
742
|
# TODO: Sanitize user input, ensure that there is a / a the end...
|
745
|
-
if [ "`whoami`" = "root" ] ; then
|
743
|
+
if [ "`whoami`" = "root" ] ; then
|
746
744
|
rvm-log-fail "root user support is not yet implemented."
|
747
|
-
#
|
745
|
+
#rvm_prefix_path=${rvm_prefix_path:-/usr/local/}
|
746
|
+
else
|
747
|
+
rvm_prefix_path=${rvm_prefix_path:-"$HOME/."}
|
748
|
+
fi
|
749
|
+
if [ "${rvm_prefix_path#${rvm_prefix_path%?}}" = '.' -o "${rvm_prefix_path#${rvm_prefix_path%?}}" = '/' ] ; then
|
750
|
+
rvm_install_path="${rvm_prefix_path}rvm"
|
748
751
|
else
|
749
|
-
|
752
|
+
rvm_install_path="${rvm_prefix_path}/rvm"
|
750
753
|
fi
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
754
|
+
rvm_archives_path="${rvm_archives_path:-"${rvm_install_path}/archives"}"
|
755
|
+
rvm_source_path="${rvm_source_path:-"${rvm_install_path}/src"}"
|
756
|
+
rvm_log_path=${rvm_log_path:-"${rvm_install_path}/log"}
|
757
|
+
rvm_bin_path=${rvm_bin_path:-"${rvm_install_path}/bin"}
|
755
758
|
|
756
|
-
|
759
|
+
PATH=$rvm_bin_path:$PATH ; export PATH
|
760
|
+
|
761
|
+
mkdir -p $rvm_source_path $rvm_install_path/bin $rvm_archives_path
|
762
|
+
|
763
|
+
if [ ! -f $rvm_install_path/default ] ; then
|
757
764
|
for variable in RUBY_VERSION GEM_HOME MY_RUBY_HOME PATH ; do
|
758
765
|
eval "export $variable"
|
759
766
|
eval value=\$${variable}
|
760
|
-
echo "${variable}='$value' ; export ${variable}" >> $
|
767
|
+
echo "${variable}='$value' ; export ${variable}" >> $rvm_install_path/default
|
761
768
|
done
|
762
769
|
fi
|
763
770
|
|
764
|
-
if [ -s $
|
765
|
-
default_path=`cat $
|
771
|
+
if [ -s $rvm_install_path/default_path ] ; then
|
772
|
+
default_path=`cat $rvm_install_path/default_path`
|
766
773
|
else
|
767
|
-
echo $PATH > $
|
774
|
+
echo $PATH > $rvm_install_path/default_path
|
768
775
|
default_path=$PATH
|
769
776
|
fi
|
770
777
|
|
771
|
-
|
772
|
-
|
773
|
-
default_gem_path=`cat $install_path/default_gem_path`
|
778
|
+
if [ -s $rvm_install_path/default_user_gem_path ] ; then
|
779
|
+
default_user_gem_path=`cat $rvm_install_path/default_user_gem_path`
|
774
780
|
else
|
775
|
-
ruby -r rubygems -e "puts Gem::default_path.compact.first" > $
|
781
|
+
ruby -r rubygems -e "puts Gem::default_path.compact.first" > $rvm_install_path/default_user_gem_path
|
776
782
|
fi
|
777
783
|
|
778
|
-
|
779
|
-
|
780
|
-
default_system_gem_path=`cat $install_path/default_system_gem_path`
|
784
|
+
if [ -s $rvm_install_path/default_system_gem_path ] ; then
|
785
|
+
default_system_gem_path=`cat $rvm_install_path/default_system_gem_path`
|
781
786
|
else
|
782
|
-
ruby -r rubygems -e "puts Gem::default_path.compact[1] || Gem::default_path.compact.first" > $
|
787
|
+
ruby -r rubygems -e "puts Gem::default_path.compact[1] || Gem::default_path.compact.first" > $rvm_install_path/default_system_gem_path
|
783
788
|
fi
|
784
789
|
|
785
|
-
|
786
|
-
|
787
|
-
default_system_ruby=`cat $install_path/default_system_ruby`
|
790
|
+
if [ -s $rvm_install_path/default_system_ruby ] ; then
|
791
|
+
default_system_ruby=`cat $rvm_install_path/default_system_ruby`
|
788
792
|
else
|
789
793
|
default_system_ruby=`which ruby`
|
790
|
-
echo $default_system_ruby > $
|
794
|
+
echo $default_system_ruby > $rvm_install_path/default_system_ruby
|
791
795
|
fi
|
792
796
|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
for version in 1.8.6 1.8.7 1.9.1 1.9.2 ; do
|
801
|
-
rvm-install-ruby $implementation $version $patchlevel
|
797
|
+
case "$rvm_action" in
|
798
|
+
install)
|
799
|
+
if [ "$rvm_implementation" = "all" ] ; then
|
800
|
+
for rvm_implementation in ruby jruby ree ; do
|
801
|
+
if [ "$rvm_implementation" = "ruby" ] ; then
|
802
|
+
for rvm_version in 1.8.6 1.8.7 1.9.1 1.9.2 ; do
|
803
|
+
rvm-install-ruby $rvm_implementation $rvm_version
|
802
804
|
done
|
805
|
+
unset rvm_version
|
803
806
|
else
|
804
|
-
|
807
|
+
rvm-install-ruby $rvm_implementation $rvm_version
|
805
808
|
fi
|
806
809
|
done
|
807
810
|
else
|
808
|
-
rvm-install-ruby $
|
811
|
+
rvm-install-ruby $rvm_implementation $rvm_version $rvm_patchlevel
|
809
812
|
fi
|
810
813
|
;;
|
811
|
-
uninstall) rvm-uninstall $
|
812
|
-
use) rvm-use $
|
813
|
-
list) rvm-list
|
814
|
-
gemdir) rvm-gem-dir $
|
815
|
-
srcdir) rvm-src-dir $
|
816
|
-
gemdup) rvm-gem-dup $
|
817
|
-
info) rvm-info $
|
818
|
-
symlinks) rvm-symlinks
|
819
|
-
version) rvm-version
|
820
|
-
reset) rvm-reset
|
821
|
-
|
814
|
+
uninstall) rvm-uninstall $rvm_implementation $rvm_version $rvm_patchlevel ;;
|
815
|
+
use) rvm-use $rvm_implementation $rvm_version $rvm_patchlevel ;;
|
816
|
+
list) rvm-list ;;
|
817
|
+
gemdir) rvm-gem-dir $rvm_implementation $rvm_version $rvm_patchlevel ;;
|
818
|
+
srcdir) rvm-src-dir $rvm_implementation $rvm_version $rvm_patchlevel ;;
|
819
|
+
gemdup) rvm-gem-dup $rvm_implementation $rvm_version $rvm_patchlevel ;;
|
820
|
+
info) rvm-info $rvm_implementation $rvm_version $rvm_patchlevel ;;
|
821
|
+
symlinks) rvm-symlinks ;;
|
822
|
+
version) rvm-version ;;
|
823
|
+
reset) rvm-reset ;;
|
824
|
+
reload) source ~/.rvm/bin/rvm ;; # TODO: how can we use bin_path here, default file?
|
825
|
+
debug)
|
822
826
|
rvm-version
|
823
827
|
rvm-info
|
824
828
|
rvm-log-info "PATH:$(echo $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}')"
|
@@ -827,19 +831,22 @@ function rvm {
|
|
827
831
|
rvm-log-info "~/$file: \n$(cat ~/$file| tail -n 5)\n"
|
828
832
|
fi
|
829
833
|
done
|
830
|
-
rvm-log-info "$
|
834
|
+
rvm-log-info "$rvm_install_path/current: \n$(cat $rvm_install_path/current)\n"
|
831
835
|
return 0
|
832
836
|
;;
|
833
|
-
*)
|
834
|
-
if [ ! -z "$
|
835
|
-
rvm-log-fail "unknown action '$
|
837
|
+
*)
|
838
|
+
if [ ! -z "$rvm_action" ] ; then
|
839
|
+
rvm-log-fail "unknown action '$rvm_action'"
|
836
840
|
else
|
837
|
-
rvm-usage
|
841
|
+
rvm-usage
|
838
842
|
fi
|
839
843
|
return 1
|
840
844
|
esac
|
841
845
|
|
842
|
-
if [ "$
|
846
|
+
if [ "$rvm_debug" = "1" ] ; then set +x ; unset rvm_debug ; fi
|
843
847
|
|
844
848
|
}
|
845
849
|
|
850
|
+
# TODO: Make this optional:
|
851
|
+
if [ -f ~/.rvm/current ] ; then source ~/.rvm/current ; fi # magic :)
|
852
|
+
|