rvm 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  rvm_base_except="selector"
3
- source "$rvm_scripts_path/base"
3
+ source "$rvm_path/scripts/base"
4
4
 
5
5
  rvm_help_path="${rvm_help_path:-"$rvm_path/help"}"
6
6
 
@@ -17,10 +17,14 @@ if [[ ! -z "$command" ]] && [[ -s "${rvm_help_path}/${command}" ]] ; then
17
17
  fi
18
18
  else
19
19
  less "${rvm_path:-$HOME/.rvm}/README"
20
- "$rvm_scripts_path/log" "info" "Commands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ; find * -type f -maxdepth 0 -print | \tr "\n" ' ')"
20
+ "$rvm_path/scripts/log" "info" \
21
+ "Commands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ; find . -maxdepth 1 -mindepth 1 -type f -print | \tr "\n" ' ' | sed -e 's#./##g')"
21
22
  fi
22
23
 
23
- "$rvm_scripts_path/log" "info" "For additional information please visit RVM's documentation website:\n\n http://rvm.beginrescueend.com/"
24
- "$rvm_scripts_path/log" "info" "If you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:\n\n http://webchat.freenode.net/?channels=rvm\n"
24
+ "$rvm_path/scripts/log" "info" \
25
+ "For additional information please visit RVM's documentation website:\n\n http://rvm.beginrescueend.com/"
26
+
27
+ "$rvm_path/scripts/log" "info" \
28
+ "If you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:\n\n http://webchat.freenode.net/?channels=rvm\n"
25
29
 
26
30
  exit $?
@@ -6,7 +6,7 @@ declare rvm_hook=${rvm_hook:-""}
6
6
  if [[ -n "$rvm_hook" ]] ; then
7
7
  if [[ -s "$rvm_hooks_path/$rvm_hook" ]] ; then
8
8
  if [[ ${rvm_verbose_flag:-0} -gt 0 || ${rvm_debug_flag:-0} -gt 0 ]] ; then
9
- "$rvm_scripts_path/log" "info" "running hook $rvm_hook"
9
+ "$rvm_path/scripts/log" "info" "running hook $rvm_hook"
10
10
  fi
11
11
  source "$rvm_hooks_path/$rvm_hook"
12
12
  fi
@@ -2,8 +2,8 @@
2
2
 
3
3
  if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
4
4
 
5
- source "$rvm_scripts_path/base"
6
- source "$rvm_scripts_path/version"
5
+ source "$rvm_path/scripts/base"
6
+ source "$rvm_path/scripts/version"
7
7
 
8
8
  rvm_ruby_gem_home="${rvm_ruby_gem_home:-${GEM_HOME:-""}}"
9
9
 
@@ -86,7 +86,7 @@ info_environment() {
86
86
  MY_RUBY_HOME: \"${MY_RUBY_HOME:-""}\"
87
87
  IRBRC: \"${IRBRC:-""}\"
88
88
  RUBYOPT: \"${RUBYOPT:-""}\"
89
- gemset: \"$(printf "${GEM_HOME:-""}" | awk -F${rvm_gemset_separator:-'@'} '{print $2}')\"\n
89
+ gemset: \"$(printf "${GEM_HOME:-""}" | awk -F${rvm_gemset_separator:-"@"} '{print $2}')\"\n
90
90
  "
91
91
 
92
92
  if [[ -n "${MAGLEV_HOME:-""}" ]] ; then
@@ -100,7 +100,7 @@ info_debug() {
100
100
  rvm_info="
101
101
 
102
102
  $(__rvm_version)
103
- $("$rvm_scripts_path/info" "$rvm_ruby_string" "" )
103
+ $("$rvm_path/scripts/info" "$rvm_ruby_string" "" )
104
104
  PATH:\n$(printf "$PATH" | awk -F":" '{print $1":"$2":"$3":"$4":"$5}' )
105
105
  uname -a: $(uname -a)
106
106
  permissions: $(\ls -la $rvm_path{,/rubies})
@@ -151,7 +151,7 @@ args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
151
151
  sections="${args// /}"
152
152
  all_sections="system rvm ruby homes binaries environment"
153
153
 
154
- if "$rvm_scripts_path/match" "$all_sections debug" "${ruby_strings/,*/}" ; then
154
+ if "$rvm_path/scripts/match" "$all_sections debug" "${ruby_strings/,*/}" ; then
155
155
  sections="$ruby_strings"
156
156
  ruby_strings=""
157
157
  fi
@@ -1,5 +1,16 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ # Ensure that the extended globs feature is turned on.
4
+ if [[ -n "${ZSH_VERSION:-""}" ]] ; then
5
+ setopt extendedglob
6
+ else
7
+ if [[ -n "${BASH_VERSION:-""}" ]] ; then
8
+ shopt -s extglob # Extended globs
9
+ else
10
+ printf "%s\n" "What the heck kind of shell are you running here???"
11
+ fi
12
+ fi
13
+
3
14
  if [[ ${rvm_selfcontained:-1} -eq 0 ]] ; then
4
15
  rvm_bin_path="${rvm_bin_path:-"${rvm_prefix}bin"}"
5
16
  rvm_man_path="${rvm_man_path:-"${rvm_prefix}share/man"}"
@@ -17,22 +28,21 @@ rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
17
28
  rvm_repo_path="${rvm_repo_path:-"$rvm_path/repos"}"
18
29
  rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
19
30
  rvm_docs_path="${rvm_docs_path:-"$rvm_path/docs"}"
20
- rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
21
- rvm_gemsets_path="${rvm_gemsets_path:-"$rvm_path/gemsets"}"
31
+
32
+ rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}" # Leave this one in global, need to override for system installs (for now).
33
+
22
34
  rvm_gems_cache_path="${rvm_gems_cache_path:-"$rvm_gems_path/cache"}"
23
35
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
24
36
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
25
37
  rvm_environments_path="${rvm_environments_path:-"$rvm_path/environments"}"
26
38
  rvm_wrappers_path="${rvm_wrappers_path:-"$rvm_path/wrappers"}"
27
39
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
40
+
28
41
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
29
42
  rvm_usr_path="${rvm_usr_path:-"$rvm_path/usr"}"
30
- rvm_patches_path="${rvm_patches_path:-"$rvm_path/patches"}"
31
- rvm_patchsets_path="${rvm_patchsets_path:-"$rvm_path/patchsets"}"
32
- rvm_gemset_separator="${rvm_gemset_separator:-"@"}"
33
43
 
34
44
  rvm_project_rvmrc="${rvm_project_rvmrc:-1}"
35
45
  rvm_project_rvmrc_default="${rvm_project_rvmrc_default:-0}"
36
46
 
37
- export rvm_path rvm_patches_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_gemsets_path rvm_repo_path rvm_patchsets_path rvm_selfcontained
47
+ export rvm_path rvm_rubies_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_repo_path rvm_selfcontained
38
48
 
@@ -126,7 +126,7 @@ Be sure to get head often as rvm development happens fast,
126
126
  you can do this by running 'rvm update --head' followed by 'rvm reload'
127
127
  or opening a new shell
128
128
 
129
- w⦿‿⦿$
129
+ w⦿‿⦿t
130
130
 
131
131
  ~ Wayne
132
132
 
@@ -145,7 +145,7 @@ Upgrade Notes
145
145
  rvm remove X ; rvm install X
146
146
 
147
147
  * If you wish to have the 'pretty colors' again, set in ~/.rvmrc:
148
- export rvm_pretty_print=1
148
+ export rvm_pretty_print_flag=1
149
149
  "
150
150
  }
151
151
 
@@ -192,6 +192,7 @@ __rvm_initialize
192
192
  item="* "
193
193
  question="\n<?>"
194
194
  cwd="$PWD"
195
+
195
196
  source_path="${source_path:-$cwd}"
196
197
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
197
198
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
@@ -209,13 +210,10 @@ fi
209
210
 
210
211
  rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
211
212
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
212
- rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
213
213
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
214
214
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
215
215
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
216
216
 
217
- export rvm_gemset_separator="@" # TODO: Remove this after a while.
218
-
219
217
  printf "
220
218
  RVM: Shell scripts enabling management of multiple ruby environments.
221
219
  RTFM: http://rvm.beginrescueend.com/
@@ -223,35 +221,60 @@ printf "
223
221
  "
224
222
 
225
223
  if [[ ${upgrade_flag:-0} -eq 1 ]] ;then
224
+
226
225
  printf "\nUpgrading the RVM installation in $rvm_path/"
226
+
227
227
  else
228
- printf "\nInstalling rvm to $rvm_path/"
228
+
229
+ printf "\nInstalling RVM to $rvm_path/"
230
+
229
231
  fi
230
232
 
231
- mkdir -p "$rvm_archives_path" "$rvm_src_path" "$rvm_log_path" "$rvm_bin_path" "$rvm_gems_path" "$rvm_rubies_path" "$rvm_config_path" "$rvm_hooks_path" "$rvm_tmp_path"
233
+ for directory in "$rvm_archives_path" "$rvm_src_path" "$rvm_log_path" "$rvm_bin_path" "$rvm_gems_path" "$rvm_rubies_path" "$rvm_config_path" "$rvm_hooks_path" "$rvm_tmp_path" ; do
234
+
235
+ if [[ ! -d "$directory" ]] ; then
236
+
237
+ mkdir -p "$directory"
238
+
239
+ fi
240
+
241
+ done
232
242
 
233
243
  for file in README LICENCE ; do
244
+
234
245
  cp -f "$source_path/$file" "$rvm_path/"
246
+
235
247
  done
236
248
 
237
249
  #
238
250
  # Scripts
239
251
  #
240
252
  for dir_name in config scripts examples lib hooks help patches; do
241
- mkdir -p "$rvm_path/$dir_name"
253
+
242
254
  if [[ -d "$source_path/$dir_name" ]] ; then
255
+
256
+ if [[ ! -d "$rvm_path/$dir_name" ]] ; then
257
+
258
+ mkdir -p "$rvm_path/$dir_name"
259
+
260
+ fi
261
+
243
262
  cp -Rf "$source_path/$dir_name" "$rvm_path"
263
+
244
264
  fi
245
- done ; unset dir_name
265
+
266
+ done
246
267
 
247
268
  if [[ ! -s "$rvm_config_path/user" ]] ; then
248
- mkdir -p "$rvm_config_path/"
249
269
  echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_config_path/user"
250
270
  fi
251
271
 
252
- scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
272
+ scripts=(monitor match log install color db fetch log set package)
273
+
253
274
  for script_name in "${scripts[@]}" ; do
254
- chmod +x "$rvm_scripts_path/$script_name" 2>/dev/null # Hide errors.
275
+
276
+ chmod +x "$rvm_path/scripts/$script_name" 2>/dev/null # Hide errors.
277
+
255
278
  done
256
279
 
257
280
  #
@@ -259,29 +282,48 @@ done
259
282
  #
260
283
  # Cleanse and purge...
261
284
  for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
285
+
262
286
  rm -f "$rvm_bin_path/$file"
287
+
263
288
  cp -f "$source_path/binscripts/$file" $rvm_bin_path/
289
+
264
290
  done
265
- chmod +x "$rvm_bin_path"/*
291
+
292
+ chmod +x "$rvm_bin_path"/* # TODO: this is quite suboptimal.
266
293
 
267
294
  #
268
295
  # RC Files
269
296
  #
270
297
  if [[ -n "$rvm_auto_flag" ]] ; then
298
+
271
299
  printf "Checking rc files... ($rvm_rc_files)"
300
+
272
301
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
302
+
273
303
  for rcfile in $(printf $rvm_rc_files) ; do
304
+
274
305
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
306
+
275
307
  if [[ -s "$HOME/.profile" ]] ; then
308
+
276
309
  if ! grep -q '.profile' "$rcfile" ; then
310
+
277
311
  echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
312
+
278
313
  printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> "$rcfile"
314
+
279
315
  fi
316
+
280
317
  fi
318
+
281
319
  if ! grep -q "scripts\/rvm" "$rcfile" ; then
282
- echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
283
- printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> "$rcfile"
320
+
321
+ echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
322
+
323
+ printf "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> "$rcfile"
324
+
284
325
  fi
326
+
285
327
  done
286
328
  fi
287
329
  fi
@@ -290,47 +332,91 @@ fi
290
332
  # Initial Interpreter Gemsets.
291
333
  #
292
334
  if [[ -d gemsets/ ]] ; then
293
- mkdir -p "$rvm_gemsets_path"
335
+
336
+ if [[ ! -d "$rvm_path/gemsets" ]] ; then
337
+
338
+ mkdir -p "$rvm_path/gemsets"
339
+
340
+ fi
294
341
 
295
342
  for gemset_file in $(builtin cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
296
- destination="$rvm_gemsets_path/$gemset_file"
343
+
344
+ destination="$rvm_path/gemsets/$gemset_file"
345
+
297
346
  destination_path="$(dirname "$destination")"
347
+
298
348
  if [[ ! -s "$destination" ]] ; then
349
+
299
350
  mkdir -p "$destination_path"
351
+
300
352
  cp "gemsets/$gemset_file" "$destination"
353
+
301
354
  fi
302
- done ; unset destination destination_path gemset_file
355
+
356
+ done
357
+
358
+ unset destination destination_path gemset_file
359
+
303
360
  fi
304
361
 
305
362
  if [[ -d patchsets/ ]] ; then
306
- mkdir -p "$rvm_patchsets_path"
307
- for patchset_file in $(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
308
- destination="$rvm_patchsets_path/$patchset_file"
309
- destination_path="$(dirname "$destination")"
363
+
364
+ if [[ ! -d "$rvm_path/patchsets" ]] ; then
365
+
366
+ mkdir -p "$rvm_path/patchsets"
367
+
368
+ fi
369
+
370
+ patchsets=($(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///'))
371
+
372
+ for patchset_file in "${patchsets[@]}" ; do
373
+
374
+ destination="$rvm_path/patchsets/$patchset_file"
375
+
310
376
  if [[ ! -s "$destination" ]] ; then
377
+
378
+ destination_path="$(dirname "$destination")"
379
+
311
380
  mkdir -p "$destination_path"
381
+
312
382
  cp "patchsets/$patchset_file" "$destination"
383
+
313
384
  fi
314
- done ; unset destination destination_path patchset_file
385
+ done
386
+
315
387
  fi
316
388
 
317
389
  #
318
390
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
319
391
  #
320
392
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
393
+
321
394
  mkdir -p "$rvm_rubies_path/"
395
+
322
396
  for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do
397
+
323
398
  if [[ -d "$ruby" ]] ; then
399
+
324
400
  mv "$ruby" "$rvm_rubies_path/"
401
+
325
402
  new_path="$rvm_rubies_path/$(basename $ruby)"
403
+
326
404
  for file in gem rake ; do
405
+
327
406
  if [[ -s "$new_path/bin/$file" ]] ; then
407
+
328
408
  sed -e '1,1s=.*=#!'"${new_path}/bin/ruby=" "${new_path}/bin/${file}" > "${new_path}/bin/${file}.new"
409
+
329
410
  mv -f "$new_path/bin/$file.new" "$new_path/bin/$file"
411
+
330
412
  chmod +x "$new_path/bin/$file"
413
+
331
414
  fi
415
+
332
416
  done
417
+
333
418
  fi
419
+
334
420
  done
335
421
  #
336
422
  # End of rubies migration.
@@ -340,36 +426,60 @@ done
340
426
  # Migrate old gemset directories to new gemset pattern.
341
427
  #
342
428
  for gemset in "$rvm_path"/gems/*\%* ; do
343
- new_path=${gemset/\%/${rvm_gemset_separator}}
429
+
430
+ new_path=${gemset/\%/${rvm_gemset_separator:-"@"}}
431
+
344
432
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
433
+
345
434
  printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
435
+
346
436
  mv "$gemset" "$new_path"
437
+
347
438
  fi
439
+
348
440
  done
349
441
 
350
442
  for gemset in "$rvm_path"/gems/*\+* ; do
351
- new_path=${gemset/\+/${rvm_gemset_separator}}
443
+
444
+ new_path=${gemset/\+/${rvm_gemset_separator:-"@"}}
445
+
352
446
  if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
447
+
353
448
  printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
449
+
354
450
  mv $gemset $new_path
451
+
355
452
  fi
453
+
356
454
  done
357
455
 
358
456
  for gemset in "$rvm_path"/gems/*\@ ; do
457
+
359
458
  new_path=$(echo $gemset | sed -e 's#\@$##')
459
+
360
460
  if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
461
+
361
462
  printf "\n Fixing: $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
463
+
362
464
  mv "$gemset" "$new_path"
465
+
363
466
  fi
467
+
364
468
  done
365
469
 
366
470
  # Move from legacy defaults to the new, alias based system.
367
471
  if [[ -s "$rvm_config_path/default" ]]; then
368
- original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
472
+
473
+ original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator:-"@"}#")")"
474
+
369
475
  if [[ -n "$original_version" ]]; then
370
- "$rvm_scripts_path/alias" create default "$original_version" &> /dev/null
476
+
477
+ "$rvm_path/scripts/alias" create default "$original_version" &> /dev/null
478
+
371
479
  fi ; unset original_version
480
+
372
481
  rm -rf "$rvm_config_path/default"
482
+
373
483
  fi
374
484
 
375
485
  #
@@ -380,13 +490,21 @@ printf "\n Correct permissions for base binaries in $rvm_bin_path..."
380
490
  mkdir -p "$rvm_bin_path"
381
491
 
382
492
  for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
493
+
383
494
  [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
384
- done; unset file
495
+
496
+ done
497
+
385
498
  printf "\n Copying manpages into place."
386
499
 
387
- for man_file in $(builtin cd "$install_source_path/man" ; find * -type f -maxdepth 0 -print); do
500
+ files=($(builtin cd "$install_source_path/man" ; find . -maxdepth 1 -mindepth 1 -type f -print))
501
+
502
+ for file in "${files[@]//.\/}" ; do
503
+
388
504
  rm -rf "$rvm_man_path/$man_file"
505
+
389
506
  cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
507
+
390
508
  done
391
509
 
392
510
  [[ "$upgrade_flag" = 0 ]] && ./scripts/notes
@@ -400,13 +518,19 @@ if [[ ${upgrade_flag:-0} -eq 1 ]] ; then
400
518
  check_rubyopt_conditions
401
519
 
402
520
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
521
+
403
522
  else
523
+
404
524
  if [[ ${rvm_selfcontained:-0} -eq 1 ]] ; then
525
+
405
526
  installation_complete
527
+
406
528
  fi
407
529
 
408
530
  if [[ -s "$HOME/.bashrc" ]] && grep -q '&& return' "$HOME/.bashrc" ; then
531
+
409
532
  andand_return_warning
533
+
410
534
  fi
411
535
 
412
536
  check_rubyopt_conditions