rvm 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/lib/VERSION.yml +1 -1
  2. data/lib/rvm/environment.rb +1 -1
  3. data/lib/rvm/shell/shell_wrapper.sh +1 -1
  4. data/rvm.gemspec +3 -110
  5. metadata +4 -111
  6. data/binscripts/rvm +0 -76
  7. data/binscripts/rvm-auto-ruby +0 -24
  8. data/binscripts/rvm-prompt +0 -208
  9. data/binscripts/rvm-shell +0 -35
  10. data/binscripts/rvm-update-head +0 -58
  11. data/binscripts/rvm-update-latest +0 -27
  12. data/binscripts/rvmsudo +0 -20
  13. data/config/db +0 -71
  14. data/config/known +0 -54
  15. data/config/md5 +0 -139
  16. data/contrib/gemset_snapshot +0 -25
  17. data/contrib/install-system-wide +0 -221
  18. data/contrib/r +0 -44
  19. data/examples/rvmrc +0 -49
  20. data/gemsets/default.gems +0 -1
  21. data/gemsets/global.gems +0 -1
  22. data/help/alias +0 -46
  23. data/help/benchmark +0 -17
  24. data/help/cleanup +0 -23
  25. data/help/debug +0 -8
  26. data/help/disk-usage +0 -15
  27. data/help/docs +0 -22
  28. data/help/exec +0 -33
  29. data/help/fetch +0 -5
  30. data/help/gem +0 -0
  31. data/help/gemdir +0 -0
  32. data/help/gemset +0 -14
  33. data/help/implode +0 -0
  34. data/help/info +0 -62
  35. data/help/install +0 -0
  36. data/help/list +0 -0
  37. data/help/migrate +0 -15
  38. data/help/monitor +0 -0
  39. data/help/notes +0 -0
  40. data/help/package +0 -0
  41. data/help/rake +0 -14
  42. data/help/remove +0 -0
  43. data/help/repair +0 -23
  44. data/help/reset +0 -0
  45. data/help/ruby +0 -84
  46. data/help/rubygems +0 -11
  47. data/help/rvmrc +0 -34
  48. data/help/snapshot +0 -15
  49. data/help/specs +0 -0
  50. data/help/srcdir +0 -0
  51. data/help/tests +0 -0
  52. data/help/tools +0 -22
  53. data/help/uninstall +0 -0
  54. data/help/update +0 -0
  55. data/help/upgrade +0 -18
  56. data/help/use +0 -0
  57. data/help/wrapper +0 -41
  58. data/install +0 -667
  59. data/man/man1/rvm.1 +0 -380
  60. data/man/man1/rvm.1.gz +0 -0
  61. data/scripts/alias +0 -226
  62. data/scripts/aliases +0 -4
  63. data/scripts/array +0 -32
  64. data/scripts/base +0 -57
  65. data/scripts/cd +0 -94
  66. data/scripts/cleanup +0 -58
  67. data/scripts/cli +0 -798
  68. data/scripts/color +0 -49
  69. data/scripts/completion +0 -151
  70. data/scripts/db +0 -87
  71. data/scripts/default +0 -64
  72. data/scripts/disk-usage +0 -60
  73. data/scripts/docs +0 -115
  74. data/scripts/env +0 -46
  75. data/scripts/environment-convertor +0 -74
  76. data/scripts/fetch +0 -231
  77. data/scripts/gemsets +0 -1045
  78. data/scripts/get +0 -126
  79. data/scripts/hash +0 -37
  80. data/scripts/help +0 -46
  81. data/scripts/hook +0 -23
  82. data/scripts/info +0 -213
  83. data/scripts/initialize +0 -29
  84. data/scripts/install +0 -667
  85. data/scripts/irbrc +0 -13
  86. data/scripts/irbrc.rb +0 -64
  87. data/scripts/list +0 -315
  88. data/scripts/log +0 -38
  89. data/scripts/maglev +0 -193
  90. data/scripts/manage +0 -2157
  91. data/scripts/match +0 -6
  92. data/scripts/md5 +0 -22
  93. data/scripts/migrate +0 -175
  94. data/scripts/monitor +0 -105
  95. data/scripts/notes +0 -140
  96. data/scripts/override_gem +0 -14
  97. data/scripts/package +0 -302
  98. data/scripts/patches +0 -64
  99. data/scripts/patchsets +0 -87
  100. data/scripts/repair +0 -199
  101. data/scripts/rubygems +0 -157
  102. data/scripts/rvm +0 -128
  103. data/scripts/rvm-install +0 -667
  104. data/scripts/selector +0 -904
  105. data/scripts/set +0 -301
  106. data/scripts/snapshot +0 -262
  107. data/scripts/tools +0 -58
  108. data/scripts/update +0 -667
  109. data/scripts/upgrade +0 -144
  110. data/scripts/utility +0 -1499
  111. data/scripts/version +0 -17
  112. data/scripts/wrapper +0 -210
@@ -1,2157 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- original_ruby_version=${rvm_ruby_version:-""}
4
- original_ruby_string=${rvm_ruby_string:-""}
5
-
6
- source "$rvm_path/scripts/base"
7
- source "$rvm_path/scripts/patches"
8
-
9
- unset RUBYLIB RUBYOPT # Sanity check.
10
-
11
- __rvm_check_for_clang()
12
- {
13
- if [[ -n "${rvm_clang_flag:-""}" ]] && ! command -v clang >/dev/null ; then
14
- "$rvm_path/scripts/log" "fail" "\nYou passed the --clang option and clang is not in your path. \nPlease try again or do not use --clang.\n"
15
- return 1
16
- fi
17
- }
18
-
19
- # Checks for bison, returns zero iff it is found
20
- __rvm_check_for_bison()
21
- {
22
- if [[ ${rvm_head_flag:-0} -gt 0 ]]; then
23
- command -v bison > /dev/null
24
- result=$?
25
- if [[ $result -gt 0 ]] ; then
26
- "$rvm_path/scripts/log" "fail" \
27
- "\nbison is not available in your path. \nPlease ensure bison is installed before compiling from head.\n"
28
- fi
29
- fi
30
-
31
- return ${result:-0}
32
- }
33
-
34
- # Emits a number of patches to STDOUT, each on a new name
35
- # Expands patchsets etc.
36
- __rvm_current_patch_names()
37
- {
38
- # TODO: Lookup default patches on rvm_ruby_string heirarchy.
39
- local separator patches level name
40
-
41
- separator="%"
42
- patches="${rvm_patch_names:-""} default"
43
-
44
- for patch_name in $(echo ${patches//,/ }); do
45
-
46
- level=1
47
- name="$patch_name"
48
-
49
- if echo "$name" | grep -q "$separator"; then
50
- level="${name/*${separator}/}"
51
- name="${name//${separator}*/}"
52
- fi
53
-
54
- local expanded_name="$(__rvm_expand_patch_name "$name")"
55
-
56
- echo "${expanded_name}${separator}${level}"
57
-
58
- done
59
-
60
- return 0
61
- }
62
-
63
- __rvm_apply_patches()
64
- {
65
- local patches patch_name patch_level_separator patch_fuzziness patch_level source_directory full_patch_path
66
-
67
- result=0
68
- patch_level_separator="%"
69
- patch_fuzziness="25"
70
- patch_level=1
71
-
72
- source_directory="${1:-""}"
73
-
74
- if [[ -z "$source_directory" ]] ; then
75
- source_directory="${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
76
- fi
77
-
78
- (
79
- builtin cd "$source_directory"
80
-
81
- patches=($(__rvm_current_patch_names))
82
-
83
- for patch_name in "${patches[@]}" ; do
84
-
85
- # If set, extract the patch level from the patch name.
86
- patch_level=1
87
-
88
- if echo "$patch_name" | \grep -q "$patch_level_separator"; then
89
- patch_level=${patch_name//*${patch_level_separator}/}
90
- patch_name="${patch_name//${patch_level_separator}*/}"
91
- fi
92
-
93
- full_patch_path="$(__rvm_lookup_full_patch_path "$patch_name")"
94
-
95
- # Expand paths, and for those we found we then apply the patches.
96
- if [[ -n "${full_patch_path:-""}" ]]; then
97
-
98
- if [[ -f "$full_patch_path" ]] ; then
99
-
100
- __rvm_run "patch.apply.${patch_name/*\/}" \
101
- "patch -F$patch_fuzziness -p$patch_level -f <\"$full_patch_path\"" \
102
- "Applying patch '$patch_name' (located at $full_patch_path)"
103
-
104
- [[ $? -gt 0 ]] && result=1 # Detect failed patches
105
- fi
106
-
107
- else
108
- "$rvm_path/scripts/log" "warn" \
109
- "Patch '$patch_name' not found."
110
- result=1
111
- fi
112
- done
113
- )
114
-
115
- return ${result:-0}
116
- }
117
-
118
- __rvm_install_source()
119
- {
120
- local directory configure_parameters db_configure_flags
121
-
122
- [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] && __rvm_select
123
-
124
- case ${rvm_ruby_string:-""} in
125
- ruby-head|1.9.*-head) __rvm_ensure_has_18_compat_ruby || return 1 ;;
126
- esac
127
-
128
- "$rvm_path/scripts/log" "info" \
129
- "Installing Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)...\n"
130
-
131
- builtin cd "${rvm_src_path:-"$rvm_path/src"}"
132
-
133
- if [[ ${rvm_force_flag:-0} -eq 1 ]] ; then
134
-
135
- for directory in "$rvm_ruby_home" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" ; do
136
-
137
- if [[ -d "$directory" ]] ; then
138
- rm -rf "$directory"
139
- fi
140
-
141
- done
142
- fi
143
-
144
- result=0
145
-
146
- __rvm_fetch_ruby
147
- result=$?
148
-
149
- if [[ "$result" -gt 0 ]] ; then
150
- "$rvm_path/scripts/log" "error" \
151
- "There has been an error fetching the ruby interpreter. Halting the installation."
152
- return $result
153
- fi
154
-
155
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
156
-
157
- result=$? ; if [[ "$result" -gt 0 ]] ; then
158
- "$rvm_path/scripts/log" "error" \
159
- "Source directory is missing. Did the download or extraction fail? Halting the installation."
160
- return $result
161
- fi
162
-
163
- if [[ -d "${rvm_path}/usr" ]] ; then
164
- export PATH="${rvm_path}/usr/bin:${PATH}"
165
-
166
- builtin hash -r
167
- fi
168
-
169
- __rvm_apply_patches
170
- result="$?"
171
-
172
- if [[ $result -gt 0 ]]; then
173
- "$rvm_path/scripts/log" "fail" \
174
- "There has been an error applying the specified patches. Halting the installation."
175
- return $result
176
- fi
177
-
178
- if [[ -z "${rvm_ruby_configure:-""}" \
179
- && ! -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/configure" ]] ; then
180
-
181
- if command -v autoconf > /dev/null ; then
182
-
183
- __rvm_run "autoconf" "autoconf" "Running autoconf"
184
-
185
- else
186
- "$rvm_path/scripts/log" "fail" \
187
- "rvm requires autoconf to install the selected ruby interpreter however autoconf was not found in the PATH."
188
- return 1
189
- fi
190
- fi
191
-
192
- if [[ -n "${rvm_ruby_configure:-""}" ]] ; then
193
-
194
- __rvm_run "configure" "$rvm_ruby_configure"
195
- result=$?
196
-
197
- if [[ $result -gt 0 ]] ; then
198
- "$rvm_path/scripts/log" "error" \
199
- "There has been an error while configuring. Halting the installation."
200
- return $result
201
- fi
202
-
203
- elif [[ -s ./configure ]] ; then
204
-
205
- # REE stores configure flags differently for head vs. the distributed release.
206
- if [[ "ree" != "${rvm_ruby_interpreter:-""}" ]]; then
207
- __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
208
- fi
209
-
210
- # On 1.9.2, we manually set the --with-baseruby option
211
- # to point to an expanded path.
212
- if [[ "${rvm_ruby_string:-""}" = "ruby-1.9.2-head" ]] ; then
213
-
214
- local compatible_baseruby="$rvm_path/wrappers/$(__rvm_18_compat_ruby)/ruby"
215
-
216
- if [[ -x "$compatible_baseruby" ]] ; then
217
- configure_parameters="--with-baseruby=$compatible_baseruby"
218
- fi
219
- fi
220
-
221
- local configure_command="./configure --prefix=$rvm_ruby_home ${db_configure_flags:-""} ${rvm_configure_flags:-""} ${configure_parameters:-""}"
222
-
223
- __rvm_run "configure" "$configure_command" "$rvm_ruby_string - #configuring "
224
- result=$?
225
-
226
- if [[ $result -gt 0 ]] ; then
227
- "$rvm_path/scripts/log" "error" \
228
- "There has been an error while running configure. Halting the installation."
229
- return $result
230
- fi
231
-
232
- else
233
- "$rvm_path/scripts/log" "error" \
234
- "Skipping configure step, 'configure' does not exist, did autoconf not run successfully?"
235
- fi
236
-
237
- rvm_ruby_make=${rvm_ruby_make:-"make"}
238
-
239
- __rvm_run "make" "$rvm_ruby_make ${rvm_make_flags:-""}" "$rvm_ruby_string - #compiling "
240
- result=$?
241
-
242
- if [[ $result -gt 0 ]] ; then
243
- "$rvm_path/scripts/log" "error" \
244
- "There has been an error while running make. Halting the installation."
245
- return $result
246
- fi
247
-
248
- if [[ -d .ext/rdoc ]] ; then
249
- rm -rf .ext/rdoc
250
- fi
251
-
252
- rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
253
-
254
- __rvm_run "install" "$rvm_ruby_make_install" "$rvm_ruby_string - #installing "
255
- result=$?
256
-
257
- if [[ $result -gt 0 ]] ; then
258
- "$rvm_path/scripts/log" "error" \
259
- "There has been an error while running make install. Halting the installation."
260
- return $result
261
- fi
262
-
263
- export GEM_HOME="$rvm_ruby_gem_home"
264
- export GEM_PATH="$rvm_ruby_gem_path"
265
-
266
- __rvm_rubygems_setup
267
- result=$?
268
-
269
- __rvm_bin_script
270
-
271
- __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*"
272
-
273
- __rvm_post_install
274
- result=$?
275
-
276
- "$rvm_path/scripts/log" "info" \
277
- "Install of $rvm_ruby_string - #complete "
278
-
279
- return ${result:-0}
280
- }
281
-
282
- __rvm_install_ruby()
283
- {
284
- if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
285
-
286
- if [[ -n "${RUBYOPT:-""}" ]] ; then ruby_options="$RUBYOPT" ; fi
287
-
288
- unset RUBYOPT
289
-
290
- # Check for clang if the flag is set
291
- __rvm_check_for_clang
292
- result=$?
293
-
294
- [[ $result -gt 0 ]] && return $result
295
-
296
- case "$rvm_ruby_interpreter" in
297
- macruby)
298
- if [[ "Darwin" = "$(uname)" ]] ; then
299
-
300
- if [[ "$rvm_head_flag" = 1 ]] ; then
301
-
302
- if [[ -n "$rvm_llvm_flag" ]] ; then
303
- "$rvm_path/scripts/package" llvm install
304
- fi
305
-
306
- macruby_path="/usr/local/bin"
307
- # TODO: configure & make variables should be set here.
308
- rvm_ruby_configure=" true "
309
- rvm_ruby_make="rake"
310
- rvm_ruby_make_install="$rvm_path/bin/rvmsudo rake install"
311
-
312
- __rvm_db "${rvm_ruby_interpreter}_repo_url" "rvm_ruby_url"
313
-
314
- rvm_ruby_repo_url=$rvm_ruby_url
315
-
316
- __rvm_install_source $*
317
- result=$?
318
-
319
- if [[ "$result" -gt 0 ]] ; then
320
- "$rvm_path/scripts/log" "error" \
321
- "There has been an error while trying to install from source. \
322
- \nHalting the installation."
323
- return $result
324
- fi
325
-
326
- elif [[ "nightly" = "$rvm_ruby_version" ]] ; then
327
- macruby_path="/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/bin"
328
- # TODO: Separated nightly from head.
329
-
330
- "$rvm_path/scripts/log" "info" "Retrieving the latest nightly macruby build..."
331
-
332
- "$rvm_path/scripts/fetch" "$rvm_ruby_url"
333
- result=$?
334
-
335
- if [[ "$result" -gt 0 ]] ; then
336
- "$rvm_path/scripts/log" "error" \
337
- "There has been an error while trying to fetch the source. \
338
- \nHalting the installation."
339
- return $result
340
- fi
341
-
342
- mv "${rvm_archives_path:-"$rvm_path/archives"}/macruby_nightly-latest.pkg" \
343
- "${rvm_archives_path:-"$rvm_path/archives"}/macruby_nightly.pkg"
344
-
345
- __rvm_run "macruby/extract" \
346
- "sudo /usr/sbin/installer -pkg '${rvm_archives_path:-"$rvm_path/archives"}/macruby_nightly.pkg' -target '/'"
347
-
348
- mkdir -p "$rvm_ruby_home/bin"
349
-
350
- else
351
- macruby_path="/Library/Frameworks/MacRuby.framework/Versions/${rvm_ruby_version}/usr/bin"
352
-
353
- # TODO: Separated nightly from head.
354
- "$rvm_path/scripts/log" "info" "Retrieving MacRuby ${rvm_ruby_version} ..."
355
-
356
- "$rvm_path/scripts/fetch" "$rvm_ruby_url"
357
-
358
- result=$?
359
-
360
- if [[ "$result" -gt 0 ]] ; then
361
- "$rvm_path/scripts/log" "error" \
362
- "There has been an error while trying to fetch the source. Halting the installation."
363
- return $result
364
- fi
365
-
366
- mkdir -p ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string
367
-
368
- unzip -o -j "${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file" \
369
- "MacRuby ${rvm_ruby_version}/MacRuby ${rvm_ruby_version}.pkg" \
370
- -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
371
-
372
- mv "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/MacRuby ${rvm_ruby_version}.pkg" \
373
- "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/$rvm_ruby_string.pkg"
374
-
375
- __rvm_run "macruby/extract" \
376
- "sudo /usr/sbin/installer -pkg '${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/$rvm_ruby_string.pkg' -target '/'"
377
-
378
- mkdir -p "$rvm_ruby_home/bin"
379
- fi
380
-
381
- binaries=(erb gem irb rake rdoc ri ruby testrb)
382
- for binary_name in ${binaries[@]}; do
383
- # TODO: This should be generated via an external script.
384
- ruby_wrapper=$(cat <<RubyWrapper
385
- #!/usr/bin/env bash
386
-
387
- export GEM_HOME="$rvm_ruby_gem_home"
388
- export GEM_PATH="$rvm_ruby_gem_path"
389
- export MY_RUBY_HOME="$rvm_ruby_home"
390
- export PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH"
391
-
392
- exec "$macruby_path/mac$binary_name" "\$@"
393
- RubyWrapper
394
- )
395
-
396
- file_name="$rvm_ruby_home/bin/$binary_name"
397
-
398
- if [[ -f "$file_name" ]] ; then
399
- rm -f "$file_name"
400
- fi
401
-
402
- echo "$ruby_wrapper" > "$file_name"
403
-
404
- if [[ -f "$file_name" ]] ; then
405
- chmod +x $file_name
406
- fi
407
-
408
- if [[ "$binary_name" = "ruby" ]] ; then
409
- echo "$ruby_wrapper" \
410
- > "${rvm_bin_path:-"$rvm_bin_path/bin"}/$rvm_ruby_string"
411
- fi
412
- done ; unset binaries
413
-
414
- __rvm_irbrc
415
-
416
- else
417
- "$rvm_path/scripts/log" "fail" \
418
- "MacRuby can only be installed on a Darwin OS."
419
- fi
420
- ;;
421
-
422
- ree)
423
- if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.8/')" \
424
- && $rvm_head_flag -eq 0 ]] ; then
425
-
426
- rvm_ruby_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
427
-
428
- "$rvm_path/scripts/log" "info" \
429
- "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
430
-
431
- builtin cd "${rvm_src_path:-"$rvm_path/src"}"
432
-
433
- if [[ ${rvm_force_flag:-0} -eq 0 \
434
- && -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" \
435
- && ! -x "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/installer" ]] ; then
436
-
437
- "$rvm_path/scripts/log" \
438
- "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
439
-
440
- else
441
- "$rvm_path/scripts/log" \
442
- "$rvm_ruby_string - #fetching ($rvm_ruby_package_file)"
443
-
444
- "$rvm_path/scripts/fetch" \
445
- "$rvm_ruby_url"
446
- result=$?
447
-
448
- if [[ "$result" -gt 0 ]] ; then
449
- "$rvm_path/scripts/log" "error" \
450
- "There has been an error while trying to fetch the source. \
451
- \nHalting the installation."
452
- return $result
453
- fi
454
-
455
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
456
-
457
- __rvm_run "extract" \
458
- "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}" \
459
- "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
460
- result=$?
461
-
462
- if [[ "$result" -gt 0 ]] ; then
463
- "$rvm_path/scripts/log" "error" \
464
- "There has been an error while trying to extract the source. Halting the installation."
465
- return $result
466
- fi
467
-
468
- mv "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_package_file" \
469
- "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
470
- fi
471
-
472
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
473
-
474
- # wait, what? v v v TODO: Investigate line smell.
475
- mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
476
-
477
- if [[ -n "$rvm_configure_flags" ]] ; then
478
- rvm_configure_flags="${rvm_configure_flags//--/-c --}"
479
- fi
480
-
481
- if [[ "Darwin" = "$(uname)" && "1.8.6" = "$rvm_ruby_version" \
482
- && -z "$rvm_ree_options" ]] ; then
483
- rvm_ree_options="${rvm_ree_options} --no-tcmalloc"
484
- fi
485
-
486
- __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
487
-
488
- __rvm_apply_patches "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/source"
489
- result=$?
490
-
491
- if [[ "$result" -gt 0 ]] ; then
492
- "$rvm_path/scripts/log" "error" \
493
- "There has been an error while trying to apply patches to ree. \
494
- \nHalting the installation."
495
- return $result
496
- fi
497
-
498
- __rvm_run "install" \
499
- "./installer -a $rvm_path/rubies/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_configure_flags" "$rvm_ruby_string - #installing "
500
-
501
- result=$?
502
-
503
- if [[ "$result" -gt 0 ]] ; then
504
- "$rvm_path/scripts/log" "error" \
505
- "There has been an error while trying to run the ree installer. Halting the installation."
506
- return $result
507
- fi
508
-
509
- chmod +x "$rvm_ruby_home"/bin/*
510
-
511
- __rvm_rubygems_setup
512
- __rvm_irbrc
513
- __rvm_bin_script
514
- __rvm_post_install
515
- else
516
-
517
- __rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_repo_url" "rvm_ruby_url"
518
-
519
- if [[ -z "$rvm_ruby_url" ]] ; then
520
- "$rvm_path/scripts/log" "fail" \
521
- "rvm does not know the rvm repo url for '${rvm_ruby_interpreter}_${rvm_ruby_version}'"
522
- result=1
523
-
524
- else
525
- rvm_ruby_repo_url="$rvm_ruby_url"
526
- if [[ ${rvm_make_flags_flag:-0} -eq 1 ]] ; then __rvm_make_flags ; fi
527
- __rvm_install_source $*
528
- fi
529
- fi
530
- ;;
531
-
532
- rbx|rubinius)
533
-
534
- "$rvm_path/scripts/log" "info" "$rvm_ruby_string installing #dependencies "
535
-
536
- # Ensure we have a 1.8.7 compatible ruby installed.
537
- __rvm_ensure_has_18_compat_ruby || return 1
538
-
539
- # TODO: use 'rvm gems load' here:
540
- unset CFLAGS LDFLAGS ARCHFLAGS # Important.
541
-
542
- unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
543
-
544
- __rvm_remove_rvm_from_path
545
-
546
- __rvm_conditionally_add_bin_path ; export PATH
547
-
548
- builtin hash -r
549
-
550
- if [[ -n "$(printf "${rvm_ruby_version:-""}" | awk '/^1\./')" \
551
- && ${rvm_head_flag:-0} -eq 0 ]] ; then
552
-
553
- "$rvm_path/scripts/log" "info" \
554
- "$rvm_ruby_string #downloading ($rvm_ruby_package_file), this may take a while depending on your connection..."
555
-
556
- "$rvm_path/scripts/fetch" "$rvm_ruby_url"
557
- result=$?
558
-
559
- if [[ "$result" -gt 0 ]] ; then
560
- "$rvm_path/scripts/log" "error" \
561
- "There has been an error while trying to fetch the source. Halting the installation."
562
- return $result
563
- fi
564
- __rvm_run "extract" \
565
- "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$(basename $rvm_ruby_package_file)\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}" \
566
- "$rvm_ruby_string - #extracting"
567
- result=$?
568
-
569
- if [[ "$result" -gt 0 ]] ; then
570
- "$rvm_path/scripts/log" "error" \
571
- "There has been an error while trying to extract the source. \
572
- \nHalting the installation."
573
- return $result
574
- fi
575
-
576
- # Remove the left over folder first.
577
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
578
-
579
- mv "${rvm_src_path:-"$rvm_path/src"}/rubinius-${rvm_ruby_version}" \
580
- "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
581
- else
582
- __rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
583
- #rvm_ruby_home="$rvm_path/rubies/$rvm_ruby_interpreter-$rvm_ruby_version"
584
- __rvm_fetch_from_github "rbx"
585
- result=$?
586
-
587
- if [[ "$result" -gt 0 ]] ; then
588
- "$rvm_path/scripts/log" "error" \
589
- "There has been an error while fetching the rbx git repo. \
590
- \nHalting the installation."
591
- return $result
592
- fi
593
- fi
594
-
595
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
596
-
597
- chmod +x ./configure
598
-
599
- __rvm_apply_patches
600
- result=$?
601
-
602
- if [[ "$result" -gt 0 ]] ; then
603
- "$rvm_path/scripts/log" "error" \
604
- "There has been an error while trying to apply patches to rubinius. \
605
- \nHalting the installation."
606
- return $result
607
- fi
608
-
609
- __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
610
-
611
- export ruby="$(__rvm_18_compat_ruby)"
612
-
613
- rvm_configure_flags="${rvm_configure_flags:-"--skip-system"}"
614
-
615
- rvm_ruby_configure="$rvm_path/wrappers/$ruby/ruby ./configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_configure_flags"
616
- message="$rvm_ruby_string - #configuring"
617
-
618
- if [[ "$rvm_llvm_flag" = "0" ]] ; then
619
- rvm_ruby_configure="$rvm_ruby_configure --disable-llvm"
620
-
621
- else
622
- if [[ "$rvm_ruby_patch_level" = "rc1" ]] ; then
623
- rvm_ruby_configure="$rvm_ruby_configure --enable-llvm"
624
- fi
625
- fi
626
-
627
- __rvm_run "configure" "$rvm_ruby_configure" "$message"
628
- result=$?
629
-
630
- if [[ "$result" -gt 0 ]] ; then
631
- "$rvm_path/scripts/log" "error" \
632
- "There has been an error while running '$rvm_ruby_configure'. \
633
- \nHalting the installation."
634
- return $result
635
- fi
636
-
637
- if [[ "$rvm_trace_flag" -eq 1 ]] ; then
638
- rvm_ruby_make="$rvm_path/wrappers/$ruby/rake install --trace"
639
- message="$rvm_ruby_string - #compiling (with --trace)"
640
- else
641
- rvm_ruby_make="$rvm_path/wrappers/$ruby/rake install"
642
- message="$rvm_ruby_string - #compiling"
643
- fi
644
-
645
- __rvm_run "rake" "$rvm_ruby_make" "$message"
646
- result=$?
647
-
648
- if [[ "$result" -gt 0 ]] ; then
649
- "$rvm_path/scripts/log" "error" \
650
- "There has been an error while running '$rvm_ruby_configure'.\nHalting the installation."
651
- return $result
652
- fi ; unset ruby
653
-
654
- # Symlink rubinius wrappers
655
- ln -fs "$rvm_ruby_home/bin/rbx" "$rvm_ruby_home/bin/ruby"
656
-
657
- # Install IRB Wrapper on Rubinius.
658
- file_name="$rvm_ruby_home/bin/irb"
659
-
660
- rm -f "$file_name"
661
-
662
- printf '#!/usr/bin/env bash\n' > "$file_name"
663
-
664
- printf "exec '$rvm_ruby_home/bin/rbx' 'irb' \"\$@\"\n" >> "$file_name"
665
-
666
- [[ -f "$file_name" ]] && chmod +x "$file_name"
667
-
668
- # Install Gem Wrapper on Rubinius.
669
- file_name="$rvm_ruby_home/bin/gem"
670
-
671
- cp -f "$rvm_ruby_home/lib/bin/gem.rb" "$file_name"
672
-
673
- __rvm_inject_ruby_shebang "$file_name"
674
-
675
- if [[ -f "$file_name" ]] ; then
676
- chmod +x "$file_name"
677
- fi
678
-
679
- unset file_name
680
-
681
- binaries=(erb ri rdoc)
682
-
683
- __rvm_post_install
684
-
685
- __rvm_irbrc
686
-
687
- __rvm_bin_script
688
- ;;
689
-
690
- jruby)
691
-
692
- if ! command -v java > /dev/null; then
693
- printf "java must be installed and in PATH in order to install JRuby."
694
- return 1
695
- fi
696
-
697
- builtin cd "${rvm_src_path:-"$rvm_path/src"}"
698
-
699
- __rvm_fetch_ruby
700
- result=$?
701
-
702
- if [[ "$result" -gt 0 ]] ; then
703
- "$rvm_path/scripts/log" "error" \
704
- "There has been an error while trying to fetch the source. \
705
- \nHalting the installation."
706
- return $result
707
- fi
708
-
709
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
710
-
711
- if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
712
-
713
- __rvm_apply_patches
714
-
715
- __rvm_run "ant.dist" "ant dist" "$rvm_ruby_string - #ant dist"
716
-
717
- fi
718
-
719
- mkdir -p "$rvm_ruby_home/bin/"
720
-
721
- case "$rvm_ruby_version" in
722
- 1.3|1.2)
723
- __rvm_run "nailgun" \
724
- "builtin cd \"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/tool/nailgun\" && make $rvm_make_flags" \
725
- "Building Nailgun"
726
- ;;
727
- *)
728
- __rvm_run "nailgun" \
729
- "builtin cd \"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/tool/nailgun\" && ./configure --prefix=$rvm_ruby_home && make $rvm_make_flags" \
730
- "Building Nailgun"
731
- ;;
732
- esac
733
-
734
- if [[ -z "${rvm_ruby_home:-""}" || "$rvm_ruby_home" = "/" ]] ; then
735
- echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000
736
- fi
737
-
738
- rm -rf "$rvm_ruby_home"
739
-
740
- __rvm_run "install" \
741
- "/bin/cp -Rf ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string $rvm_ruby_home" "$rvm_ruby_string - #installing to $rvm_ruby_home"
742
-
743
- (
744
- builtin cd "$rvm_ruby_home/bin/"
745
- for binary in jirb jruby jgem ; do
746
- ln -nfs "$binary" "${binary#j}"
747
- done ; unset binary
748
- )
749
-
750
- # -server is "a lot slower for short-lived scripts like rake tasks, and takes longer to load"
751
- #sed -e 's#^JAVA_VM=-client#JAVA_VM=-server#' $rvm_ruby_home/bin/jruby > $rvm_ruby_home/bin/jruby.new &&
752
- # mv $rvm_ruby_home/bin/jruby.new $rvm_ruby_home/bin/jruby
753
- chmod +x "$rvm_ruby_home/bin/jruby"
754
-
755
- binaries=(jrubyc jirb_swing jirb jgem rdoc ri spec autospec testrb ast generate_yaml_index.rb)
756
-
757
- for binary in "${binaries[@]}" ; do
758
- __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
759
- done
760
-
761
- __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/rake"
762
-
763
- __rvm_rubygems_setup
764
-
765
- __rvm_irbrc
766
-
767
- __rvm_bin_script
768
-
769
- __rvm_use
770
-
771
- __rvm_post_install
772
-
773
- # jruby ships with some built in gems, copy them in to place.
774
- if [[ -d "$rvm_ruby_home/lib/ruby/gems/1.8" ]]; then
775
-
776
- "$rvm_path/scripts/log" "info" "Copying across included gems"
777
-
778
- cp -R "$rvm_ruby_home/lib/ruby/gems/1.8/" "$rvm_ruby_gem_home/"
779
- fi
780
-
781
- "$rvm_ruby_home/bin/gem" install jruby-launcher
782
- ;;
783
-
784
- maglev)
785
- __rvm_ensure_has_18_compat_ruby
786
-
787
- "$rvm_path/scripts/log" "info" \
788
- "Running MagLev prereqs checking script."
789
-
790
- "$rvm_path/scripts/maglev"
791
- result=$?
792
-
793
- if [[ "$result" -gt 0 ]] ; then
794
- "$rvm_path/scripts/log" "error" \
795
- "Prerequisite checks have failed. Halting the installation."
796
- return $result
797
- fi
798
-
799
- builtin cd "${rvm_src_path:-"$rvm_path/src"}"
800
-
801
- if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" \
802
- || ${rvm_force_flag:-0} -eq 1 ]] ; then
803
-
804
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/" \
805
- "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/"
806
-
807
- __rvm_fetch_ruby
808
- result=$?
809
-
810
- if [[ "$result" -gt 0 ]] ; then
811
- "$rvm_path/scripts/log" "error" \
812
- "There has been an error while trying to fetch the source. \
813
- \nHalting the installation."
814
- return $result
815
- fi
816
- fi
817
-
818
- if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
819
-
820
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
821
-
822
- rvm_gemstone_package_file="GemStone-$(\grep ^GEMSTONE version.txt | cut -f2 -d-).$(uname -sm | \tr ' ' '-')"
823
-
824
- rvm_gemstone_url="${rvm_gemstone_url:-"$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"}"
825
- fi
826
-
827
- "$rvm_path/scripts/log" "info" \
828
- "Downloading the GemStone package, this may take a while depending on your connection..."
829
-
830
- "$rvm_path/scripts/fetch" "$rvm_gemstone_url"
831
- result=$?
832
-
833
- if [[ "$result" -gt 0 ]] ; then
834
- "$rvm_path/scripts/log" "error" \
835
- "There has been an error while trying to fetch the GemStone package. \
836
- \nHalting the installation."
837
- return $result
838
- fi
839
-
840
- builtin cd "${rvm_src_path:-"$rvm_path/src"}"
841
-
842
- if [[ -s "$rvm_ruby_package_file" ]] ; then
843
- mv "$rvm_ruby_package_file" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
844
- fi
845
-
846
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
847
-
848
- __rvm_run "gemstone.extract" \
849
- "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/${rvm_gemstone_package_file}.${rvm_archive_extension}\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
850
- result=$?
851
-
852
- if [[ "$result" -gt 0 ]] ; then
853
- "$rvm_path/scripts/log" "error" \
854
- "There has been an error while trying to extract the GemStone package. \
855
- \nHalting the installation."
856
- return $result
857
- fi
858
-
859
- chmod -R 777 "$rvm_gemstone_package_file" # for now. # WTF?! Crack.smoke!(:huff)
860
-
861
- ln -nfs "$rvm_gemstone_package_file" "gemstone"
862
-
863
- if [[ -z "${rvm_ruby_home:-""}" || "$rvm_ruby_home" = "/" ]] ; then
864
- echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000
865
- else
866
- rm -rf $rvm_ruby_home
867
- fi
868
-
869
- __rvm_run "install" \
870
- "/bin/cp -Rf ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string $rvm_ruby_home" \
871
- "Installing maglev to $rvm_ruby_home"
872
-
873
- (
874
- builtin cd "$rvm_ruby_home/bin/"
875
-
876
- for binary in maglev-irb maglev-ruby maglev-gem ; do
877
-
878
- ln -nfs "$binary" "${binary#maglev-}"
879
-
880
- done ; unset binary
881
- )
882
-
883
- binaries=(maglev-ruby maglev-irb maglev-gem)
884
-
885
- for binary in "${binaries[@]}" ; do
886
-
887
- __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
888
-
889
- done
890
-
891
- builtin cd "$rvm_ruby_home"
892
-
893
- if [[ $rvm_head_flag -eq 1 ]] ; then
894
-
895
- git submodule update --init
896
-
897
- "$rvm_ruby_home/bin/maglev" force-reload
898
-
899
- ln -sf maglev.demo.key-$(uname -sm | \tr ' ' '-') etc/maglev.demo.key
900
- fi
901
-
902
- #ln -fs "$rvm_ruby_home/$(echo $rvm_gemstone_package_file | awk -F'.' '{print $1}')" "$rvm_ruby_home/gemstone"
903
-
904
- compatible_ruby="$(__rvm_18_compat_ruby)"
905
-
906
- if [[ ! -e ${rvm_ruby_home}/etc/conf.d/maglev.conf ]] ; then
907
- "$rvm_path/scripts/log" "info" "Creating default 'maglev' repository."
908
- "$rvm_path/wrappers/$compatible_ruby/rake" "stone:create[maglev]" >/dev/null 2>&1
909
- fi
910
-
911
- "$rvm_path/scripts/log" "info" "Generating maglev HTML documentation"
912
- "$rvm_path/wrappers/$compatible_ruby/rake" rdoc >/dev/null 2>&1
913
-
914
- "$rvm_path/scripts/log" "info" "Generating smalltalk FFI."
915
- "$rvm_path/wrappers/$compatible_ruby/rake" stwrappers >/dev/null 2>&1
916
-
917
- unset compatible_ruby
918
-
919
- # TODO: Figure out if anything needs to be done with rubygems.
920
- #__rvm_rubygems_setup
921
- __rvm_irbrc
922
-
923
- __rvm_bin_script
924
-
925
- __rvm_use
926
- ;;
927
-
928
- ironruby|ir)
929
- if ! command -v mono > /dev/null ; then
930
- printf "mono must be installed and in your path in order to install IronRuby." ; return 1
931
- fi
932
-
933
- if [[ $rvm_head_flag -eq 1 ]] ; then
934
-
935
- mono_version="$(mono -V | head -n 1 | cut -d ' ' -f5)"
936
-
937
- if "$rvm_path/scripts/match" "$mono_version" "([0-9]+)\.([0-9]+)\.?([0-9]+)?" ; then
938
-
939
- mono_major_ver="$(echo "$mono_version" | cut -d '.' -f1)"
940
-
941
- mono_minor_ver="$(echo "$mono_version" | cut -d '.' -f2)"
942
-
943
- if [[ $mono_major_ver -lt 2 ]] \
944
- || ( [[ $mono_major_ver -eq 2 && $mono_minor_ver -lt 6 ]] ) ; then
945
- printf "Mono 2.6 (or greater) must be installed and in your path in order to build IronRuby from the repository."
946
- printf "Version detected: ${mono_version}"
947
- return 1
948
- fi
949
- else
950
- printf "Cannot recognize mono version."
951
- return 1
952
- fi
953
-
954
- __rvm_ensure_has_18_compat_ruby
955
-
956
- __rvm_fetch_ruby
957
-
958
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
959
-
960
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
961
-
962
- compatible_ruby="$(__rvm_18_compat_ruby)"
963
-
964
- "$rvm_path/wrappers/$compatible_ruby/gem" install pathname2 --no-rdoc --no-ri
965
-
966
- # MONO_LIB=/Library/Frameworks/Mono.framework/Versions/current/lib/
967
- rvm_ruby_make="$rvm_path/wrappers/$compatible_ruby/rake MERLIN_ROOT=\"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main\" compile mono=1 configuration=release --trace"
968
- __rvm_run "rake" "$rvm_ruby_make" "Building IronRuby..."
969
- unset compatible_ruby
970
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
971
-
972
- rm -rf "$rvm_ruby_home"/*
973
- mkdir -p "$rvm_ruby_home/bin" "$rvm_ruby_home/lib" \
974
- "$rvm_ruby_home/lib/ruby" "$rvm_ruby_home/lib/IronRuby"
975
-
976
- cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main/Bin/mono_release"/* "$rvm_ruby_home/bin/"
977
- cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main/Languages/Ruby/Scripts/bin"/* "$rvm_ruby_home/bin/"
978
- cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby"/* "$rvm_ruby_home/lib/ruby"
979
- cp -r "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/Merlin/Main/Languages/Ruby/Libs"/* "$rvm_ruby_home/lib/IronRuby"
980
- else
981
- "$rvm_path/scripts/log" "info" \
982
- "Retrieving IronRuby"
983
-
984
- "$rvm_path/scripts/fetch" "$rvm_ruby_url" \
985
- "$rvm_ruby_package_file"
986
- result=$?
987
-
988
- if [[ "$result" -gt 0 ]] ; then
989
- "$rvm_path/scripts/log" "error" \
990
- "There has been an error while trying to fetch the source. Halting the installation."
991
- return $result
992
- fi
993
-
994
- mkdir -p "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" "$rvm_ruby_home"
995
-
996
- unzip -o -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" \
997
- "${rvm_archives_path:-"$rvm_path/archives"}/${rvm_ruby_package_file}" >> \
998
- "${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/extract.log" 2>&1
999
- result=$?
1000
-
1001
- if [[ "$result" -gt 1 ]] ; then
1002
-
1003
- "$rvm_path/scripts/log" "error" \
1004
- "There has been an error while trying to extract $rvm_ruby_package_file.\n${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/extract.log might have more details.\nHalting the installation."
1005
- return $result
1006
-
1007
- fi
1008
-
1009
- for dir in bin lib silverlight ; do
1010
- cp -Rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/$dir" "$rvm_ruby_home/$dir"
1011
- done
1012
- fi
1013
-
1014
- binaries=(gem irb rdoc rake ri ruby)
1015
-
1016
- for binary_name in "${binaries[@]}" ; do
1017
-
1018
- if [[ -s "$rvm_ruby_home/bin/$binary_name" ]] ; then
1019
-
1020
- tr -d '\r' < "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
1021
-
1022
- #sed -e '1,1s=.*=#!'"/usr/bin/env ir=" "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
1023
- mv -f "$rvm_ruby_home/bin/$binary_name.new" "$rvm_ruby_home/bin/$binary_name"
1024
-
1025
- chmod +x "$rvm_ruby_home/bin/$binary_name"
1026
-
1027
- fi
1028
- done ; unset binaries
1029
-
1030
- sed -e '1,1s=.*=#!'"/usr/bin/env bash=" "$rvm_ruby_home/bin/ir" \
1031
- | \tr -d '\r' > "$rvm_ruby_home/bin/ir.new"
1032
-
1033
- mv -f "$rvm_ruby_home/bin/ir.new" "$rvm_ruby_home/bin/ir"
1034
-
1035
- chmod +x "$rvm_ruby_home/bin/ir"
1036
-
1037
- ln -fs "$rvm_ruby_home/bin/ir" "$rvm_ruby_home/bin/ruby"
1038
-
1039
- builtin hash -r
1040
-
1041
- __rvm_run "gems.install" \
1042
- "PATH=\"$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:$PATH\" GEM_HOME=\"$rvm_ruby_gem_home\" GEM_PATH=\"$rvm_ruby_gem_home:$rvm_ruby_global_gems_path\" $rvm_ruby_home/bin/gem install --no-rdoc --no-ri rake $rvm_gem_options" \
1043
- "Installing $rvm_gem_name to $dir"
1044
- ;;
1045
-
1046
- goruby)
1047
-
1048
- if [[ ${rvm_make_flags_flag:-0} -eq 1 ]] ; then __rvm_make_flags ; fi
1049
-
1050
- unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
1051
-
1052
- __rvm_remove_rvm_from_path
1053
-
1054
- __rvm_conditionally_add_bin_path ; export PATH
1055
-
1056
- builtin hash -r
1057
-
1058
- rvm_ruby_home="$rvm_path/rubies/$rvm_ruby_interpreter"
1059
-
1060
- __rvm_fetch_from_github "ruby" "trunk"
1061
-
1062
- __rvm_apply_patches ; result=$?
1063
-
1064
- if [[ "$result" -gt 0 ]] ; then
1065
- "$rvm_path/scripts/log" "error" \
1066
- "There has been an error while trying to apply patches to goruby. \
1067
- \nHalting the installation."
1068
- return $result
1069
- fi
1070
-
1071
- if [[ ! -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/configure" ]] ; then
1072
-
1073
- if command -v autoconf &> /dev/null ; then
1074
-
1075
- __rvm_run "autoconf" "autoconf" "Running autoconf"
1076
-
1077
- else
1078
- "$rvm_path/scripts/log" "fail" \
1079
- "rvm expects autoconf to install this ruby interpreter, autoconf was not found in PATH. \
1080
- \nHalting installation."
1081
- return $result
1082
- fi
1083
- fi
1084
-
1085
- if [[ -s ./Makefile && -z "$rvm_reconfigure_flag" ]] ; then
1086
-
1087
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
1088
- "$rvm_path/scripts/log" "debug" \
1089
- "Skipping configure step, Makefile exists so configure must have already been run."
1090
- fi
1091
-
1092
- elif [[ -n "$rvm_ruby_configure" ]] ; then
1093
-
1094
- __rvm_run "configure" "$rvm_ruby_configure"
1095
- result=$?
1096
-
1097
- if [[ "$result" -gt 0 ]] ; then
1098
- "$rvm_path/scripts/log" "error" \
1099
- "There has been an error while trying to configure the source. \
1100
- \nHalting the installation."
1101
- return $result
1102
- fi
1103
-
1104
- elif [[ -s ./configure ]] ; then
1105
- local configure_command="./configure --prefix=$rvm_ruby_home $rvm_configure_flags"
1106
-
1107
- __rvm_run "configure" "$configure_command" \
1108
- "Configuring $rvm_ruby_string using $rvm_configure_flags, this may take a while depending on your cpu(s)..."
1109
- result=$?
1110
-
1111
- if [[ "$result" -gt 0 ]] ; then
1112
- "$rvm_path/scripts/log" "error" \
1113
- "There has been an error while trying to configure the source.\
1114
- \nHalting the installation."
1115
- return $result
1116
- fi
1117
-
1118
- else
1119
- "$rvm_path/scripts/log" "error" \
1120
- "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
1121
- fi
1122
-
1123
- rvm_ruby_make=${rvm_ruby_make:-"make"}
1124
-
1125
- __rvm_run "make" "$rvm_ruby_make golf $rvm_make_flags" \
1126
- "Compiling $rvm_ruby_string, this may take a while depending on your cpu(s)..."
1127
- result=$?
1128
-
1129
- if [[ "$result" -gt 0 ]] ; then
1130
- "$rvm_path/scripts/log" "error" \
1131
- "There has been an error while trying to run make.\
1132
- \nHalting the installation."
1133
- return $result
1134
- fi
1135
-
1136
- rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
1137
-
1138
- __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string"
1139
- result=$?
1140
-
1141
- if [[ "$result" -gt 0 ]] ; then
1142
- "$rvm_path/scripts/log" "error" \
1143
- "There has been an error while trying to run make install. \
1144
- \nHalting the installation."
1145
- return $result
1146
- fi
1147
-
1148
- "$rvm_path/scripts/log" "info" \
1149
- "Installation of $rvm_ruby_string is complete."
1150
-
1151
- export GEM_HOME="$rvm_ruby_gem_home"
1152
- export GEM_PATH="$rvm_ruby_gem_path"
1153
-
1154
- __rvm_rubygems_setup
1155
-
1156
- __rvm_bin_script
1157
-
1158
- __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*"
1159
-
1160
- __rvm_post_install
1161
- rm $rvm_ruby_home/bin/ruby
1162
- ln -s $rvm_ruby_home/bin/goruby $rvm_ruby_home/bin/ruby
1163
- ;;
1164
-
1165
- ruby)
1166
-
1167
- __rvm_check_for_bison # && Run like hell...
1168
- if [[ $? -gt 0 ]] ; then return $result ; fi
1169
-
1170
- if [[ ${rvm_make_flags_flag:-0} -eq 1 ]] ; then __rvm_make_flags ; fi
1171
-
1172
- ( __rvm_install_source $* )
1173
- result=$?
1174
- ;;
1175
-
1176
- default)
1177
- "$rvm_path/scripts/log" "fail" \
1178
- "a ruby interpreter to install must be specified and not simply 'default'."
1179
- ;;
1180
-
1181
- *)
1182
- "$rvm_path/scripts/log" "fail" \
1183
- "Either the ruby interpreter is unknown or there was an error!."
1184
- ;;
1185
-
1186
- esac
1187
-
1188
- rvm_hook="after_install" ; source "$rvm_path/scripts/hook"
1189
-
1190
- if [[ -n "$ruby_options" ]] ; then
1191
- RUBYOPT="$ruby_options"
1192
- export RUBYOPT
1193
- fi
1194
-
1195
- return ${result:-0}
1196
- }
1197
-
1198
- __rvm_fetch_from_github()
1199
- {
1200
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1201
-
1202
- if [[ ! -d "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string/.git" ]] ; then
1203
-
1204
- rm -rf "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1205
-
1206
- builtin cd "$rvm_home"
1207
-
1208
- __rvm_run "$1.repo" \
1209
- "git clone --depth 1 $rvm_ruby_repo_url ${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" \
1210
- "Cloning $rvm_ruby_repo_url"
1211
- result=$?
1212
-
1213
- if [[ "$result" -gt 0 ]] ; then
1214
- rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/http:}"
1215
-
1216
- "$rvm_path/scripts/log" "info" "Could not fetch $rvm_ruby_repo_url - trying $rvm_ruby_repo_http_url"
1217
-
1218
- __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_http_url ${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" "Cloning $rvm_ruby_repo_http_url"
1219
- fi
1220
- else
1221
- local branch="${rvm_ruby_repo_branch:-"master"}"
1222
-
1223
- builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1224
-
1225
- __rvm_run "$1.repo" "git pull origin $branch" "Pulling from origin $branch"
1226
- fi
1227
-
1228
- (
1229
- remote="origin"
1230
-
1231
- cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1232
-
1233
- if [[ -z "$(git branch | awk "/$rvm_ruby_repo_branch$/")" ]] ; then
1234
-
1235
- git checkout -b "$rvm_ruby_repo_branch" --track "$remote/$rvm_ruby_repo_branch" 2>/dev/null
1236
-
1237
- elif [[ -z "$(git branch | awk "/\* $rvm_ruby_repo_branch$/")" ]] ; then
1238
-
1239
- if ! git checkout $rvm_ruby_repo_branch 2>/dev/null ; then
1240
-
1241
- "$rvm_path/scripts/log" "error" \
1242
- "Branch $remote/$rvm_ruby_repo_branch not found."
1243
-
1244
- fi
1245
-
1246
- fi
1247
- )
1248
-
1249
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1250
-
1251
- __rvm_run "$1.copy" "\\cp -R \"${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string\" \"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string\"" "Copying from repo to source..."
1252
-
1253
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1254
-
1255
- return ${result:-0}
1256
- }
1257
-
1258
- __rvm_fetch_ruby()
1259
- {
1260
- [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] && __rvm_select
1261
-
1262
- "$rvm_path/scripts/log" "info" "$rvm_ruby_string - #fetching "
1263
-
1264
- if [[ ${rvm_head_flag:-0} -eq 0 && -z "${rvm_ruby_tag:-""}" && -z "${rvm_ruby_revision:-""}" ]] ; then
1265
-
1266
- rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_string"}"
1267
-
1268
- rvm_ruby_package_file="${rvm_ruby_package_file:-"$rvm_ruby_package_name"}"
1269
-
1270
- if [[ "ruby" = "$rvm_ruby_interpreter" ]]; then
1271
- rvm_archive_extension="${rvm_archive_extension:-tar.bz2}"
1272
- else
1273
- rvm_archive_extension="${rvm_archive_extension:-tar.gz}"
1274
- fi
1275
-
1276
- if [[ ! -s "${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension" ]] ; then
1277
-
1278
- case "$rvm_ruby_interpreter" in
1279
- ruby)
1280
- rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_release_version}.${rvm_ruby_major_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
1281
- ;;
1282
- ree)
1283
- rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
1284
- ;;
1285
- jruby)
1286
- rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_version}/${rvm_ruby_package_file}.${rvm_archive_extension}"
1287
- ;;
1288
- maglev)
1289
- : # Should already be set from selector
1290
- ;;
1291
- *)
1292
- rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
1293
- ;;
1294
- esac
1295
-
1296
- "$rvm_path/scripts/log" "info" \
1297
- "$rvm_ruby_string - #downloading ${rvm_ruby_package_file}, this may take a while depending on your connection..."
1298
-
1299
- "$rvm_path/scripts/fetch" "${rvm_ruby_url}"
1300
- result=$?
1301
-
1302
- if [[ "$result" -gt 0 ]] ; then
1303
- "$rvm_path/scripts/log" "error" \
1304
- "There has been an error while trying to fetch the source. \
1305
- \nHalting the installation."
1306
- return $result
1307
- fi
1308
- fi
1309
-
1310
- if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" \
1311
- || ${rvm_force_flag:-0} -eq 1 ]] ; then
1312
-
1313
- if [[ -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" ]] ; then
1314
- # Especially when forced, we want to ensure the destination is missing.
1315
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1316
- fi
1317
-
1318
- mkdir -p "${rvm_tmp_path:-/tmp}/rvm_src_$$"
1319
-
1320
- case "$rvm_archive_extension" in
1321
- tar.gz|tgz)
1322
- __rvm_run "extract" "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1323
- result=$?
1324
-
1325
- if [[ "$result" -gt 0 ]] ; then
1326
- "$rvm_path/scripts/log" "error" \
1327
- "There has been an error while trying to extract the source. \
1328
- \nHalting the installation."
1329
- return $result
1330
- fi
1331
- ;;
1332
- zip)
1333
- __rvm_run "extract" "unzip -q -o ${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file -d ${rvm_tmp_path:-/tmp}/rvm_src_$$"
1334
- result=$?
1335
-
1336
- if [[ "$result" -gt 0 ]] ; then
1337
- "$rvm_path/scripts/log" "error" \
1338
- "There has been an error while trying to extract $rvm_ruby_package_file. \
1339
- \nHalting the installation."
1340
- return $result
1341
- fi
1342
- ;;
1343
- tar.bz2)
1344
- __rvm_run "extract" "bunzip2 < '${rvm_archives_path:-"$rvm_path/archives"}/$rvm_ruby_package_file.$rvm_archive_extension' | tar xf - -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1345
- result=$?
1346
-
1347
- if [[ "$result" -gt 0 ]] ; then
1348
- "$rvm_path/scripts/log" "error" \
1349
- "There has been an error while trying to extract the source. \
1350
- \nHalting the installation."
1351
- return $result
1352
- fi
1353
- ;;
1354
- *)
1355
- "$rvm_path/scripts/log" "error" \
1356
- "Unknown archive format extension '$rvm_archive_extension'. \
1357
- \nHalting the installation."
1358
- return 1
1359
- ;;
1360
- esac
1361
-
1362
- if [[ -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" ]] ; then
1363
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1364
- fi
1365
- mv "${rvm_tmp_path:-/tmp}/rvm_src_$$/$(builtin cd ${rvm_tmp_path:-/tmp}/rvm_src_$$ ; ls)" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" ; rm -rf "${rvm_tmp_path:-/tmp}/rvm_src_$$"
1366
-
1367
- if [[ -n "${rvm_ruby_name:-""}" && -d "${rvm_src_path:-"$rvm_path/src"}/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]] ; then
1368
- mv "${rvm_src_path:-"$rvm_path/src"}/$(echo "$rvm_ruby_string" | sed -e 's/-n.*//')" "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1369
- fi
1370
-
1371
- "$rvm_path/scripts/log" "info" \
1372
- "$rvm_ruby_string - #extracted to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1373
-
1374
- else
1375
- "$rvm_path/scripts/log" "info" \
1376
- "$rvm_ruby_string - #extracted to ${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string (already extracted)"
1377
- fi
1378
-
1379
- return 0
1380
- else
1381
-
1382
- mkdir -p "${rvm_repo_path:-"$rvm_path/repos"}"
1383
-
1384
- if [[ -n "$(echo "$rvm_ruby_url" | awk '/git/')" ]] ; then
1385
-
1386
- if [[ -d "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string/.git" ]] ; then
1387
-
1388
- builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1389
-
1390
- if [[ -z "$rvm_ruby_revision" ]] ; then
1391
-
1392
- "$rvm_path/scripts/log" "info" \
1393
- "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
1394
-
1395
- git pull origin master --force
1396
-
1397
- result=$?
1398
-
1399
- if [[ "$result" -gt 0 ]] ; then
1400
- "$rvm_path/scripts/log" "error" \
1401
- "There has been an error while trying to update the source from the remote repository. \
1402
- \nHalting the installation."
1403
- return $result
1404
- fi
1405
-
1406
- else
1407
- if [[ -z "${rvm_ruby_sha:-""}" ]] ; then
1408
- git checkout HEAD
1409
- else
1410
- git checkout $(echo "$rvm_ruby_sha" | sed 's#^s##')
1411
- fi
1412
- result=$?
1413
-
1414
- if [[ "$result" -gt 0 ]] ; then
1415
- "$rvm_path/scripts/log" "error" \
1416
- "There has been an error while trying to checkout the source branch. \
1417
- \nHalting the installation."
1418
- return $result
1419
- fi
1420
- fi
1421
-
1422
- else
1423
- rm -rf "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1424
-
1425
- rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/http:/}"
1426
-
1427
- "$rvm_path/scripts/log" "info" \
1428
- "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
1429
-
1430
- git clone --depth 1 "$rvm_ruby_repo_url" \
1431
- "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1432
- result=$?
1433
-
1434
- if [[ "$result" -gt 0 ]] ; then
1435
- "$rvm_path/scripts/log" "info" \
1436
- "cloning from $rvm_ruby_repo_url failed, now attempting to clone from $rvm_ruby_repo_http_url, this may take a while depending on your connection..."
1437
-
1438
- git clone "$rvm_ruby_repo_http_url" \
1439
- "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1440
- result=$?
1441
-
1442
- if [[ "$result" -gt 0 ]] ; then
1443
- "$rvm_path/scripts/log" "error" \
1444
- "There has been an error while trying to fetch the repository. \
1445
- \nHalting the installation."
1446
- return $result
1447
- fi
1448
- fi
1449
- fi
1450
-
1451
- if [[ -z "$rvm_ruby_repo_branch" ]]; then
1452
- rvm_ruby_repo_branch="master"
1453
- fi
1454
-
1455
- (
1456
- remote="origin"
1457
-
1458
- cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1459
-
1460
- if [[ -z "$(git branch | awk "/$rvm_ruby_repo_branch$/")" ]] ; then
1461
-
1462
- git checkout -b "$rvm_ruby_repo_branch" --track "$remote/$rvm_ruby_repo_branch" 2>/dev/null
1463
-
1464
- elif [[ -z "$(git branch | awk "/\* $rvm_ruby_repo_branch$/")" ]] ; then
1465
-
1466
- if ! git checkout $rvm_ruby_repo_branch 2>/dev/null ; then
1467
-
1468
- "$rvm_path/scripts/log" "error" \
1469
- "Branch $remote/$rvm_ruby_repo_branch not found."
1470
-
1471
- fi
1472
-
1473
- fi
1474
- )
1475
-
1476
- else
1477
- if [[ -n "${rvm_ruby_tag:-""}" ]] ; then
1478
- # TODO: Check if tag v is valid
1479
- rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/tags/$(echo "$rvm_ruby_tag" | sed 's/^t//')"}"
1480
-
1481
- elif [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 1 ]] ; then
1482
- rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/trunk"}"
1483
-
1484
- elif [[ "${rvm_ruby_major_version:-""}" = "9" ]] ; then
1485
-
1486
- if [[ -z "${rvm_ruby_minor_version:-""}" || "${rvm_ruby_minor_version:-""}" = 3 ]] ; then
1487
- rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/trunk"}"
1488
-
1489
- else
1490
- rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}_${rvm_ruby_minor_version}"}"
1491
- fi
1492
-
1493
- elif [[ -z "${rvm_ruby_minor_version:-""}" || "${rvm_ruby_major_version:-""}.${rvm_ruby_minor_version:-""}" = "8.8" ]] ; then
1494
- rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}"}"
1495
-
1496
- else
1497
- rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}_${rvm_ruby_minor_version}"}"
1498
- fi
1499
-
1500
- rvm_rev=""
1501
-
1502
- if [[ -n "${rvm_ruby_revision:-""}" ]] ; then
1503
- rvm_rev="-$rvm_ruby_revision"
1504
- fi
1505
-
1506
- if [[ -d "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string/.svn" ]] ; then
1507
-
1508
- builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1509
-
1510
- "$rvm_path/scripts/log" "info" "Updating ruby from $rvm_ruby_url"
1511
-
1512
- __rvm_run "svn.switch" "svn switch $rvm_ruby_url"
1513
-
1514
- __rvm_run "svn.update" "svn update"
1515
-
1516
- if [[ -n "${rvm_rev:-""}" ]] ; then
1517
- "$rvm_path/scripts/log" "info" "Checking out revision ${rvm_rev/-r/-r } from $rvm_ruby_url"
1518
-
1519
- __rvm_run "svn.checkout" "svn update -q ${rvm_rev/-r/-r }"
1520
- fi
1521
- else
1522
- rm -rf "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"
1523
-
1524
- __rvm_run "svn.checkout" \
1525
- "svn checkout -q ${rvm_rev/-r/-r } $rvm_ruby_url ${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" \
1526
- "Downloading source from ${rvm_ruby_url}."
1527
- fi
1528
- result=$?
1529
-
1530
- if [[ "$result" -gt 0 ]] ; then
1531
- "$rvm_path/scripts/log" "error" \
1532
- "There has been an error while trying to fetch / update the source. \
1533
- \nHalting the installation."
1534
- return $result
1535
- fi
1536
- fi
1537
-
1538
- "$rvm_path/scripts/log" "info" "Copying from repo to src path..."
1539
-
1540
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1541
-
1542
- cp -R "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" \
1543
- "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string"
1544
- fi
1545
-
1546
- return ${result:-0}
1547
- }
1548
-
1549
- __rvm_check_default()
1550
- {
1551
- local default_ruby_interpreter current_ruby_interpreter
1552
-
1553
- default_ruby_interpreter="$(rvm alias show default 2>/dev/null \
1554
- | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
1555
-
1556
- current_ruby_interpreter="$(echo "$rvm_ruby_string" \
1557
- | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
1558
-
1559
- if [[ -n "$current_ruby_interpreter" \
1560
- && "$current_ruby_interpreter" = "$default_ruby_interpreter" ]]; then
1561
-
1562
- __rvm_run_with_env 'default.restore' 'system' \
1563
- 'rvm use system --default' 'Removing default ruby interpreter'
1564
-
1565
- fi
1566
-
1567
- return $?
1568
- }
1569
-
1570
- __rvm_uninstall_ruby()
1571
- {
1572
- local dir
1573
-
1574
- if [[ ${rvm_ruby_selected_flag} -eq 0 ]] ; then __rvm_select ; fi
1575
-
1576
- if [[ -n "${rvm_ruby_string:-""}" ]] ; then
1577
-
1578
- for dir in "$rvm_path/rubies" ; do
1579
-
1580
- if [[ -d "$dir/$rvm_ruby_string" ]] ; then
1581
-
1582
- "$rvm_path/scripts/log" "info" "Removing $dir/$rvm_ruby_string..."
1583
-
1584
- rm -rf $dir/$rvm_ruby_string
1585
-
1586
- else
1587
-
1588
- "$rvm_path/scripts/log" "info" \
1589
- "$dir/$rvm_ruby_string has already been removed."
1590
-
1591
- fi
1592
-
1593
- if [[ -e "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string" ]] ; then
1594
-
1595
- rm -f "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string"
1596
-
1597
- fi
1598
-
1599
- done
1600
-
1601
- __rvm_remove_install_record "$rvm_ruby_string"
1602
-
1603
- __rvm_remove_gemsets
1604
-
1605
- __rvm_check_default
1606
-
1607
- else
1608
-
1609
- "$rvm_path/scripts/log" "fail" \
1610
- "Cannot uninstall unknown package '$rvm_ruby_string'"
1611
-
1612
- fi
1613
-
1614
- unset rvm_uninstall_flag
1615
-
1616
- return 0
1617
- }
1618
-
1619
- __rvm_remove_ruby()
1620
- {
1621
- local dir
1622
-
1623
- if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
1624
-
1625
- if [[ -n "${rvm_ruby_string:-""}" ]] ; then
1626
-
1627
- for dir in ${rvm_src_path:-"$rvm_path/src"} $rvm_path/rubies ; do
1628
-
1629
- if [[ -d $dir/$rvm_ruby_string ]] ; then
1630
-
1631
- "$rvm_path/scripts/log" "info" "Removing $dir/$rvm_ruby_string..."
1632
-
1633
- rm -rf "$dir/$rvm_ruby_string"
1634
-
1635
- else
1636
-
1637
- "$rvm_path/scripts/log" "info" \
1638
- "it seems that $dir/$rvm_ruby_string is already non existent."
1639
-
1640
- fi
1641
-
1642
- if [[ -e "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string" ]] ; then
1643
-
1644
- rm -f "${rvm_bin_path:-"$rvm_path/bin"}/$rvm_ruby_string"
1645
-
1646
- fi
1647
-
1648
- __rvm_check_default
1649
-
1650
- done
1651
-
1652
- __rvm_remove_install_record "$rvm_ruby_string"
1653
- __rvm_remove_gemsets
1654
- __rvm_remove_archives
1655
- __rvm_remove_aliases
1656
- __rvm_remove_wrappers
1657
- __rvm_remove_environments
1658
- __rvm_remove_binaries
1659
-
1660
- else
1661
-
1662
- "$rvm_path/scripts/log" "fail" \
1663
- "Cannot remove unknown package '$rvm_ruby_string'"
1664
-
1665
- return 1
1666
-
1667
- fi
1668
-
1669
- unset rvm_remove_flag
1670
-
1671
- return 0
1672
- }
1673
-
1674
- __rvm_remove_gemsets()
1675
- {
1676
- local gemset gemsets
1677
-
1678
- if [[ ${rvm_gems_flag:-0} -eq 1 ]] ; then
1679
-
1680
- "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string gemsets..."
1681
-
1682
- gemsets=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}"/ ; \
1683
- find . -maxdepth 1 -mindepth 1 -type d))
1684
-
1685
- for gemset in "${gemsets[@]//.\/}" ; do
1686
-
1687
- if [[ -d "$gemset" ]] ; then
1688
-
1689
- rm -rf "$gemset"
1690
-
1691
- fi
1692
-
1693
- done
1694
-
1695
- fi
1696
- }
1697
-
1698
- __rvm_remove_wrappers()
1699
- {
1700
- "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string wrappers..."
1701
-
1702
- local wrapper wrappers
1703
-
1704
- wrappers=($(find "$rvm_path/wrappers" -maxdepth 1 -mindepth 1 -type d -iname "*$rvm_ruby_string*" 2>/dev/null))
1705
-
1706
- for wrapper in "${wrappers[@]}" ; do
1707
-
1708
- rm -rf "$wrapper"
1709
-
1710
- done
1711
-
1712
- return 0
1713
- }
1714
-
1715
- __rvm_remove_environments()
1716
- {
1717
- "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string environments..."
1718
-
1719
- local environments environment
1720
-
1721
- environments=($(find "$rvm_path/environments" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1722
-
1723
- for environment in "${environments[@]}" ; do
1724
- if [[ -d "$environment" ]] ; then
1725
- rm -rf "$environment"
1726
- fi
1727
- done
1728
-
1729
- return 0
1730
- }
1731
-
1732
- __rvm_remove_aliases()
1733
- {
1734
- "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string aliases..."
1735
-
1736
- local alias_name aliases
1737
-
1738
- aliases=($(awk '/'$rvm_ruby_string'/' "$rvm_path/config/alias" | sed 's/=.*//'))
1739
-
1740
- for alias_name in "${aliases[@]}" ; do
1741
- # Remove from alias key-value store
1742
- "$rvm_path/scripts/alias" delete "$alias_name" >/dev/null 2>&1
1743
- done
1744
- }
1745
-
1746
- __rvm_remove_archives()
1747
- {
1748
- if [[ ${rvm_archive_flag:-0} -eq 1 ]] ; then
1749
-
1750
- "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string archives..."
1751
-
1752
- rm -f "${rvm_archives_path:-"$rvm_path/archives"}/${rvm_ruby_package_file}.${rvm_archive_extension}"
1753
- fi
1754
- }
1755
-
1756
- __rvm_remove_binaries()
1757
- {
1758
- "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string binaries..."
1759
-
1760
- # Iterate over all binaries and check for symlinked wrappers etc.
1761
- local binary_name binaries full_patch_path
1762
-
1763
- binaries=($(find "${rvm_bin_path:-"$rvm_path/bin"}" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1764
-
1765
- for binary_name in "${binaries[@]}" ; do
1766
-
1767
- full_binary_path="${rvm_bin_path:-"$rvm_path/bin"}/$binary_name"
1768
-
1769
- if [[ -L "$full_binary_path" ]] \
1770
- && "$rvm_path/scripts/match" "$(readlink "$full_binary_path")" "$rvm_ruby_string"; then
1771
- rm -f "$full_binary_path"
1772
- fi
1773
- done ; unset binaries
1774
-
1775
- return 0
1776
- }
1777
-
1778
- __rvm_post_install()
1779
- {
1780
- local rvm_ruby_aliases ruby_alias binary
1781
-
1782
- if [[ "$rvm_ruby_interpreter" != "jruby" ]] ; then
1783
-
1784
- if [[ ${#binaries[@]} -lt 1 ]] ; then
1785
- binaries=(gem irb erb ri rdoc testrb rake)
1786
- fi
1787
-
1788
- "$rvm_path/scripts/log" "info" \
1789
- "$rvm_ruby_string - adjusting #shebangs for ($binaries)."
1790
-
1791
- for binary in "${binaries[@]}" ; do
1792
-
1793
- if [[ -e "$rvm_ruby_home/bin/$binary" \
1794
- || -e "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/$binary" ]] ; then
1795
-
1796
- if [[ "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" != "$rvm_ruby_home" \
1797
- && -f "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/$binary" ]] ; then
1798
-
1799
- cp -f "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/$binary" "$rvm_ruby_home/bin/$binary"
1800
-
1801
- elif [[ -f "$rvm_ruby_gem_home/bin/$binary" ]] ; then
1802
-
1803
- cp -f "$rvm_ruby_gem_home/bin/$binary" "$rvm_ruby_home/bin/$binary"
1804
- fi
1805
-
1806
- __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
1807
-
1808
- __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
1809
-
1810
- chmod +x "$rvm_ruby_home/bin/$binary"
1811
- fi
1812
- done
1813
-
1814
- binaries=(gem irb erb ri rdoc testrb rake)
1815
- fi
1816
-
1817
- # Import the initial gemsets.
1818
- __rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" \
1819
- "'$rvm_path/scripts/gemsets' initial" \
1820
- "$rvm_ruby_string - #importing default gemsets ($rvm_path/gemsets/)"
1821
-
1822
- __rvm_irbrc
1823
-
1824
- __rvm_generate_default_docs
1825
-
1826
- if [[ -n "$rvm_ruby_aliases" ]]; then
1827
- "$rvm_path/scripts/log" "info" "Setting up aliases for $rvm_ruby_string"
1828
-
1829
- while read -r ruby_alias; do
1830
-
1831
- "$rvm_path/scripts/log" info "Aliasing $rvm_ruby_string to $ruby_alias"
1832
-
1833
- "$rvm_path/scripts/alias" delete "$ruby_alias" > /dev/null 2>&1
1834
-
1835
- "$rvm_path/scripts/alias" create "$ruby_alias" "$rvm_ruby_string" > /dev/null 2>&1
1836
-
1837
- done < <(echo "$rvm_ruby_string" | \tr ' ' '\n' | sort -u)
1838
- fi
1839
- }
1840
-
1841
- __rvm_generate_default_docs()
1842
- {
1843
- if [[ "$rvm_docs_flag" = "1" && "$rvm_ruby_interpreter" != "macruby" ]]; then
1844
-
1845
- __rvm_run_with_env "docs.generate" "$rvm_ruby_string" \
1846
- "rvm docs generate-ri" "Attempting to generate ri documentation..."
1847
- fi
1848
- }
1849
-
1850
- __rvm_rubygems_setup()
1851
- {
1852
- local home path dir directory_name version_number ruby_lib_gem_path
1853
-
1854
- if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.9/')" \
1855
- || -n "$(echo "$rvm_ruby_interpreter" | awk '/^goruby/')" ]] ; then
1856
-
1857
- install=0
1858
-
1859
- elif [[ "$rvm_ruby_string" = "ruby-head" ]] ; then
1860
- install=0
1861
-
1862
- else
1863
- install=1
1864
- fi
1865
-
1866
- __rvm_use
1867
-
1868
- if [[ "$install" -eq 0 ]] ; then
1869
- # 1.9.X has it's own built-in gem command
1870
- __rvm_inject_ruby_shebang "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/gem"
1871
-
1872
- __rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
1873
-
1874
- cp "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/gem" "$rvm_ruby_home/bin/gem"
1875
-
1876
- home="$GEM_HOME" ; path="$GEM_PATH" # Save
1877
-
1878
- for dir in $rvm_ruby_global_gems_path $rvm_ruby_gem_home ; do
1879
-
1880
- export GEM_HOME="$dir" ; export GEM_PATH="$dir"
1881
-
1882
- __rvm_run "rubygems.update" \
1883
- "$rvm_ruby_home/bin/gem update --system" "$rvm_ruby_string - updating #rubygems for $dir"
1884
-
1885
- done
1886
-
1887
- GEM_HOME="$home" ; GEM_PATH="$path"
1888
- export GEM_HOME GEM_PATH
1889
-
1890
- __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
1891
-
1892
- __rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
1893
-
1894
- directory_name="$rvm_ruby_home/lib/ruby/gems"
1895
-
1896
- version_number="${rvm_ruby_release_version}.${rvm_ruby_major_version}"
1897
-
1898
- if [[ "$version_number" == "." ]]; then
1899
-
1900
- # TODO: Investigate this if statement, something feels not quite right.
1901
- version_number="$(builtin cd "$directory_name" ; \
1902
- find . -maxdepth 1 -mindepth 1 -type f \
1903
- | \grep '^[[:digit:]].[[:digit:]]\(.[[:digit:]]\)\?' | head -n1)"
1904
- version_number="${version_number//.\/}"
1905
-
1906
- if [[ -n "$version_number" ]]; then
1907
- ruby_lib_gem_path="${directory_name}/${version_number}"
1908
- else
1909
- ruby_lib_gem_path=""
1910
- fi
1911
-
1912
- else
1913
- ruby_lib_gem_path="${directory_name}/${version_number}"
1914
- fi
1915
-
1916
- elif [[ -n "$(echo "$rvm_ruby_interpreter" | awk '/^rbx|jruby/')" ]] ; then
1917
-
1918
- # Hands off rubygems for rbx & jruby
1919
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
1920
- "$rvm_path/scripts/log" "debug" \
1921
- "Skipping rubygems update for $rvm_ruby_version"
1922
- fi
1923
-
1924
- ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/jruby"
1925
-
1926
- else
1927
-
1928
- "$rvm_path/scripts/log" "info" \
1929
- "$rvm_ruby_string - #rubygems installing to $rvm_ruby_string"
1930
-
1931
- rvm_rubygems_version="$(__rvm_db "${rvm_ruby_interpreter}_rubygems_version")"
1932
- rvm_rubygems_version="${rvm_rubygems_version:-"$(__rvm_db "rubygems_version")"}"
1933
- rvm_rubygems_url=$(__rvm_db "rubygems_${rvm_rubygems_version}_url")
1934
- rvm_gem_package_name="rubygems-$rvm_rubygems_version"
1935
- rvm_gem_url="$rvm_rubygems_url/$rvm_gem_package_name.tgz"
1936
-
1937
- # Sanity check... If setup.rb is missing from the rubygems source path,
1938
- # something went wrong. Cleanup, aisle 3!
1939
- if [[ ! -f "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name/setup.rb" ]]; then
1940
- rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name"
1941
- fi
1942
-
1943
- if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name" ]] ; then
1944
-
1945
- "$rvm_path/scripts/log" "info" "Retrieving $rvm_gem_package_name"
1946
-
1947
- "$rvm_path/scripts/fetch" "$rvm_gem_url"
1948
- result=$?
1949
-
1950
- if [[ "$result" -gt 0 ]] ; then
1951
- "$rvm_path/scripts/log" "error" \
1952
- "There has been an error while trying to fetch the source. Halting the installation." ; return $result
1953
- fi
1954
-
1955
- if [[ ! -d "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name" ]] ; then
1956
- mkdir -p "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name"
1957
- fi
1958
-
1959
- __rvm_run "rubygems.extract" \
1960
- "gunzip < \"${rvm_archives_path:-"$rvm_path/archives"}/$rvm_gem_package_name.tgz\" | tar xf - -C ${rvm_src_path:-"$rvm_path/src"}" \
1961
- "Extracting $rvm_gem_package_name ..."
1962
- fi
1963
-
1964
- builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name"
1965
-
1966
- __rvm_run "rubygems.install" \
1967
- "GEM_PATH='$rvm_ruby_gem_path:$rvm_ruby_global_gems_path' GEM_HOME='$rvm_ruby_gem_home' $rvm_ruby_home/bin/ruby ${rvm_src_path:-"$rvm_path/src"}/$rvm_gem_package_name/setup.rb"
1968
- result=$?
1969
-
1970
- if [[ $result -gt 0 ]] ; then
1971
- "$rvm_path/scripts/log" "warning" \
1972
- "$rvm_ruby_string - #warning Installation of rubygems $rvm_ruby_package_name did not complete successfully."
1973
- fi
1974
-
1975
- __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
1976
-
1977
- if [[ -n "$rvm_ruby_major_version" ]] ; then
1978
- ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/${rvm_ruby_release_version}.$rvm_ruby_major_version"
1979
- else
1980
- ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/$interpreter"
1981
- fi
1982
- fi
1983
-
1984
- if [[ -n "$ruby_lib_gem_path" ]]; then
1985
- # Add ruby's gem path to ruby's lib direcotry.
1986
-
1987
- if [[ -d "$ruby_lib_gem_path" ]] ; then
1988
- rm -rf "$ruby_lib_gem_path"
1989
- fi
1990
-
1991
- mkdir -p ${ruby_lib_gem_path%\/*}
1992
-
1993
- ln -nfs "$rvm_ruby_gem_home" "$ruby_lib_gem_path"
1994
-
1995
- fi
1996
-
1997
- if [[ -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rdoc" ]] ; then
1998
- __rvm_inject_ruby_shebang "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rdoc"
1999
- fi
2000
-
2001
- if [[ -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rake" ]] ; then
2002
- __rvm_inject_ruby_shebang "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/bin/rake"
2003
- fi
2004
-
2005
- return ${result:-0}
2006
- }
2007
-
2008
- __rvm_inject_ruby_shebang()
2009
- {
2010
- local actual_file
2011
-
2012
- __rvm_actual_file $1
2013
-
2014
- if [[ -f "$actual_file" ]] ; then
2015
- sed -e '1,1s=.*=#!'"/usr/bin/env ruby=" ${actual_file} > "${actual_file}.new"
2016
-
2017
- mv "${actual_file}.new" "${actual_file}" ; chmod +x "$actual_file"
2018
- fi
2019
- }
2020
-
2021
- __rvm_inject_gem_env()
2022
- {
2023
- local actual_file string
2024
-
2025
- __rvm_actual_file $1
2026
-
2027
- if [[ -s "$actual_file" ]] ; then
2028
-
2029
- if [[ -n "$(head -n 1 "$actual_file" | awk '/[j]*ruby/')" ]] ; then
2030
-
2031
- string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_ruby_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_ruby_gem_path'\nENV['PATH']='$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:' + ENV['PATH']\n"
2032
-
2033
- elif [[ -n "$(head -n 1 "$actual_file" | awk '/bash/')" ]] ; then
2034
-
2035
- string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_home:$rvm_ruby_global_gems_path'}\nPATH=$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH\n"
2036
-
2037
- fi
2038
-
2039
- if [[ -n "$string" ]] ; then
2040
-
2041
- awk "NR==2 {print \"$string\"} {print}" "$actual_file" \
2042
- > "$actual_file.new"
2043
-
2044
- mv $actual_file.new $actual_file ; chmod +x "$actual_file"
2045
-
2046
- fi
2047
- fi
2048
-
2049
- return 0
2050
- }
2051
-
2052
- __rvm_actual_file()
2053
- {
2054
- if [[ -L "$1" ]] ; then # If the file is a symlink,
2055
-
2056
- actual_file="$(readlink $1)" # read the link target so we can preserve it.
2057
-
2058
- else
2059
-
2060
- actual_file="$1"
2061
-
2062
- fi
2063
-
2064
- return 0
2065
- }
2066
-
2067
- __rvm_manage_rubies()
2068
- {
2069
- local manage_result bin_line
2070
-
2071
- manage_result=0
2072
-
2073
- rvm_gemset_name=""
2074
- rvm_ruby_selected_flag=0
2075
-
2076
- rvm_ruby_gem_home="${rvm_ruby_gem_home:-""//${rvm_gemset_separator:-"@"}*}"
2077
- rvm_ruby_string="${rvm_ruby_string:-""//${rvm_gemset_separator:-"@"}*}"
2078
-
2079
- # Given list of ruby strings.
2080
- if [[ -n "${rubies_string:-""}" ]] ;then
2081
-
2082
- rubies=(${rubies_string//,/ })
2083
-
2084
- for rvm_ruby_string in "${rubies[@]}" ; do
2085
-
2086
- current_ruby_string="$rvm_ruby_string"
2087
-
2088
- rvm_hook="before_install" ; source "$rvm_path/scripts/hook"
2089
-
2090
- eval "__rvm_${action}_ruby"
2091
- result="$?"
2092
-
2093
- if [[ "$result" -gt 0 && "$manage_result" = 0 ]]; then
2094
- manage_result="$result"
2095
- fi
2096
-
2097
- if [[ "$result" = 0 && "$action" = "install" ]] ; then
2098
- __rvm_record_install "$current_ruby_string"
2099
- fi
2100
-
2101
- unset current_ruby_string
2102
-
2103
- __rvm_unset_ruby_variables
2104
-
2105
- rvm_hook="after_install" ; source "$rvm_path/scripts/hook"
2106
-
2107
- done
2108
-
2109
- else # all
2110
-
2111
- if [[ "$action" != "install" && "$action" != "remove" \
2112
- && "$action" != "uninstall" ]] ; then
2113
-
2114
- local ruby_string
2115
-
2116
- while read -r ruby_string
2117
- do # Keep this on second line damnit!
2118
-
2119
- if [[ -x "$ruby_string" ]] ; then
2120
- rvm_ruby_string="$ruby_string"
2121
-
2122
- eval "__rvm_${action}_ruby"
2123
- result="$?"
2124
-
2125
- if [[ "$result" -gt 0 && "$manage_result" = 0 ]]; then
2126
- manage_result="$result"
2127
- fi
2128
-
2129
- # record as current_manage_string to prevent it being overridden.
2130
- if [[ "$result" = 0 && "$action" = "install" ]] ; then
2131
- __rvm_record_install "$ruby_string"
2132
- fi
2133
-
2134
- __rvm_unset_ruby_variables
2135
- fi
2136
- done < <(builtin cd "$rvm_path/rubies" ; \
2137
- find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | sed -e 's#./##g')
2138
-
2139
- else
2140
- "$rvm_path/scripts/log" "warn" \
2141
- 'Really? '"$action"' all? See "rvm list known" and limit the selection to something more sane please :)'
2142
- fi
2143
- fi
2144
-
2145
- # TODO: This should return the exit status of the command that got called.
2146
- return $manage_result
2147
- }
2148
-
2149
- args=($*)
2150
- action="${args[0]:-""}"
2151
- rubies_string="${args[1]:-""}"
2152
- args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
2153
- binaries=()
2154
-
2155
- __rvm_manage_rubies
2156
-
2157
- exit $?