rvm 0.1.41 → 0.1.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/binscripts/rvm +1 -1
  2. data/binscripts/rvm-shell +32 -0
  3. data/binscripts/rvmsudo +1 -6
  4. data/config/db +2 -2
  5. data/config/known +2 -2
  6. data/config/md5 +6 -5
  7. data/contrib/install-system-wide +81 -0
  8. data/install +23 -24
  9. data/lib/VERSION.yml +1 -1
  10. data/lib/rvm.rb +156 -1
  11. data/lib/rvm/capistrano.rb +45 -0
  12. data/lib/rvm/environment.rb +62 -0
  13. data/lib/rvm/environment/alias.rb +69 -0
  14. data/lib/rvm/environment/cleanup.rb +54 -0
  15. data/lib/rvm/environment/configuration.rb +60 -0
  16. data/lib/rvm/environment/env.rb +52 -0
  17. data/lib/rvm/environment/gemset.rb +222 -0
  18. data/lib/rvm/environment/info.rb +13 -0
  19. data/lib/rvm/environment/list.rb +124 -0
  20. data/lib/rvm/environment/rubies.rb +50 -0
  21. data/lib/rvm/environment/sets.rb +123 -0
  22. data/lib/rvm/environment/tools.rb +41 -0
  23. data/lib/rvm/environment/utility.rb +167 -0
  24. data/lib/rvm/environment/wrapper.rb +23 -0
  25. data/lib/rvm/errors.rb +28 -0
  26. data/lib/rvm/shell.rb +21 -10
  27. data/lib/rvm/shell/abstract_wrapper.rb +145 -0
  28. data/lib/rvm/shell/result.rb +42 -0
  29. data/lib/rvm/shell/shell_wrapper.sh +10 -0
  30. data/lib/rvm/shell/single_shot_wrapper.rb +56 -0
  31. data/lib/rvm/shell/utility.rb +37 -0
  32. data/lib/rvm/version.rb +12 -8
  33. data/rvm.gemspec +27 -4
  34. data/scripts/cd +17 -32
  35. data/scripts/cli +46 -16
  36. data/scripts/completion +1 -1
  37. data/scripts/disk-usage +52 -0
  38. data/scripts/fetch +8 -2
  39. data/scripts/gemsets +15 -4
  40. data/scripts/initialize +3 -3
  41. data/scripts/install +23 -24
  42. data/scripts/list +16 -8
  43. data/scripts/log +4 -1
  44. data/scripts/man +0 -0
  45. data/scripts/manage +51 -34
  46. data/scripts/md5 +4 -5
  47. data/scripts/package +28 -6
  48. data/scripts/rubygems +2 -2
  49. data/scripts/rvm +2 -2
  50. data/scripts/rvm-install +23 -24
  51. data/scripts/selector +2 -2
  52. data/scripts/tools +34 -0
  53. data/scripts/update +23 -24
  54. data/scripts/utility +54 -12
  55. data/scripts/wrapper +21 -18
  56. metadata +29 -6
  57. data/lib/rvm/open4.rb +0 -395
  58. data/lib/rvm/rvm.rb +0 -14
data/scripts/cd CHANGED
@@ -3,36 +3,21 @@
3
3
  # Source a .rvmrc file in a directory after changing to it, if it exists.
4
4
  # To disable this fature, set rvm_project_rvmrc=0 in $HOME/.rvmrc
5
5
  if [[ "$rvm_project_rvmrc" -ne 0 ]] ; then
6
- cd() {
7
- builtin cd "$@"
8
- local cwd ; cwd=$(pwd)
9
- while : ; do
10
- if [[ -z "$cwd" ]] || [[ "$HOME" = "$cwd" ]] || [[ "/" = "$cwd" ]] ; then
11
- if [[ ! -z "$rvm_rvmrc_cwd" ]] ; then
12
- if [[ -z "$rvm_previous_environment" ]] ; then
13
- rvm default 1>/dev/null 2>&1
14
- else
15
- rvm "$rvm_previous_environment" 1>/dev/null 2>&1
16
- fi
17
- unset rvm_rvmrc_cwd rvm_previous_environment
18
- fi
19
- break
20
- else
21
- if [[ -f "$cwd/.rvmrc" ]] ; then
22
- if [[ "$rvm_rvmrc_cwd" != "$cwd" ]] ; then
23
- if [[ -z "$rvm_previous_environment" ]] ; then
24
- rvm_previous_environment="$(__rvm_environment_identifier)"
25
- fi
26
- rvm_rvmrc_cwd="$cwd"
27
- source "$cwd/.rvmrc"
28
- cwd=$(dirname "$cwd")
29
- fi
30
- break
31
- else
32
- cwd=$(dirname "$cwd")
33
- fi
34
- fi
35
- done
36
-
37
- }
6
+ if [[ -n "$ZSH_VERSION" ]]; then
7
+ autoload is-at-least
8
+ if is-at-least 4.3.4 >/dev/null 2>&1; then
9
+ # On zsh, use chpwd_functions
10
+ chpwd_functions=( "${chpwd_functions[@]}" __rvm_project_rvmrc )
11
+ else
12
+ cd() {
13
+ builtin cd "$@"
14
+ __rvm_project_rvmrc
15
+ }
16
+ fi
17
+ else
18
+ cd() {
19
+ builtin cd "$@"
20
+ __rvm_project_rvmrc
21
+ }
22
+ fi
38
23
  fi
@@ -22,7 +22,7 @@ __rvm_parse_args() {
22
22
  while [[ $# -gt 0 ]] ; do
23
23
  rvm_token="$1" ; shift
24
24
  case "$rvm_token" in
25
- fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer)
25
+ fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer|env)
26
26
  rvm_action=$rvm_token
27
27
  ;;
28
28
 
@@ -41,10 +41,6 @@ __rvm_parse_args() {
41
41
  if [[ "ruby" = "$1" ]] ; then shift ; fi
42
42
  ;;
43
43
 
44
- env)
45
- rvm_action=$rvm_token
46
- ;;
47
-
48
44
  install|uninstall)
49
45
  export ${rvm_token}_flag=1
50
46
  rvm_action=$rvm_token
@@ -119,22 +115,29 @@ __rvm_parse_args() {
119
115
 
120
116
  -S)
121
117
  rvm_action="ruby"
122
- rvm_ruby_args="$rvm_token $@"
118
+ rvm_ruby_args="$rvm_token $(__rvm_quote_args "$@")"
123
119
  rvm_parse_break=1
124
120
  ;;
125
121
 
126
122
  -e)
127
123
  rvm_action="ruby"
128
- rvm_ruby_args="$rvm_token \"$@\""
124
+ rvm_ruby_args="$rvm_token $(__rvm_quote_args "$@")"
129
125
  rvm_parse_break=1
130
126
  ;;
131
127
 
132
- exec|cleanup)
128
+ exec|cleanup|tools|disk-usage)
133
129
  rvm_action="$rvm_token"
134
130
  rvm_ruby_args="$(__rvm_quote_args "$@")"
135
131
  rvm_parse_break=1
136
132
  ;;
137
133
 
134
+ load-rvmrc)
135
+ rvm_action="$rvm_token"
136
+ rvm_ruby_args="$1"
137
+ rvm_parse_break=1
138
+ ;;
139
+
140
+
138
141
  do|ruby|rake|gem|rubydo|rakedo|gemdo)
139
142
  if [[ "do" = "$rvm_action" ]] ; then rvm_action="ruby" ; fi
140
143
  rvm_action=$(echo $rvm_token | sed 's#do##g')
@@ -154,14 +157,14 @@ __rvm_parse_args() {
154
157
  fi
155
158
  elif [[ "-S" = "$1" ]] ; then
156
159
  rvm_action="ruby"
157
- rvm_ruby_args="$flag $@"
160
+ rvm_ruby_args="$flag $(__rvm_quote_args "$@")"
158
161
  rvm_parse_break=1
159
162
  elif [[ "-e" = "$1" ]] ; then
160
163
  rvm_action="ruby"
161
- rvm_ruby_args="$flag '$@'"
164
+ rvm_ruby_args="$flag $(__rvm_quote_args "$@")"
162
165
  rvm_parse_break=1
163
166
  else
164
- rvm_ruby_args="$*"
167
+ rvm_ruby_args="$(__rvm_quote_args "$@")"
165
168
  rvm_parse_break=1
166
169
  fi
167
170
  else
@@ -318,6 +321,12 @@ __rvm_parse_args() {
318
321
  export rvm_$(echo $rvm_token | sed 's#-##g')_flag=1
319
322
  ;;
320
323
 
324
+ --clang)
325
+ export rvm_clang_flag=1
326
+ export rvm_prior_cc="$CC"
327
+ export CC="clang"
328
+ ;;
329
+
321
330
  -j)
322
331
  if [[ ! -z "$1" ]] ; then
323
332
  rvm_make_flags="$rvm_make_flags -j$1"
@@ -382,6 +391,11 @@ __rvm_parse_args() {
382
391
  if [[ -z "$rvm_action" ]] ; then
383
392
  rvm_action="ruby" # Not sure if we really want to do this but we'll try it out.
384
393
  fi
394
+ elif $rvm_scripts_path/match "$rvm_token" "^${rvm_gemset_separator}" ; then
395
+ rvm_action="use"
396
+ rvm_gemset_name="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $2}')"
397
+ rvm_ruby_string="$(__rvm_environment_identifier | awk -F${rvm_gemset_separator} '{print $1}')"
398
+ rvm_ruby_strings="${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
385
399
  elif $rvm_scripts_path/match "$rvm_token" "^.+${rvm_gemset_separator}.+$" ; then
386
400
  rvm_gemset_name="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $2}')"
387
401
  rvm_ruby_string="$(echo "$rvm_token" | awk -F${rvm_gemset_separator} '{print $1}')"
@@ -452,7 +466,7 @@ rvm() {
452
466
  __rvm_initialize
453
467
  __rvm_parse_args "$@"
454
468
 
455
- export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_patch_names rvm_patch_original_pwd
469
+ export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_patch_names rvm_patch_original_pwd rvm_clang_flag
456
470
  export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_patches_path rvm_patches_path rvm_patchsets_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
457
471
 
458
472
  result=0
@@ -521,6 +535,22 @@ rvm() {
521
535
  result=$?
522
536
  ;;
523
537
 
538
+ tools)
539
+ eval "$rvm_scripts_path/tools $rvm_ruby_args"
540
+ result=$?
541
+ ;;
542
+
543
+ disk-usage)
544
+ eval "$rvm_scripts_path/disk-usage $rvm_ruby_args"
545
+ result=$?
546
+ ;;
547
+
548
+
549
+ load-rvmrc)
550
+ __rvm_project_rvmrc "$rvm_ruby_args"
551
+ result=$?
552
+ ;;
553
+
524
554
  gemset)
525
555
  #if $rvm_scripts_path/match $rvm_ruby_args use ; then
526
556
  if [[ "$rvm_use_flag" -eq 1 ]] ; then
@@ -553,13 +583,13 @@ rvm() {
553
583
  $rvm_scripts_path/monitor ; result=$?
554
584
  ;;
555
585
  notes) $rvm_scripts_path/notes ; result=$? ;;
556
- reload) unset rvm_loaded_flag ; rvm_reload_flag=1 ;;
586
+ reload) unset rvm_loaded_flag ; rvm_reload_flag=1 ;;
557
587
 
558
588
  fetch|install|uninstall|remove)
559
- if [[ ! -z "$rvm_ruby_string" ]] ; then
560
- $rvm_scripts_path/manage "$rvm_action" "$rvm_ruby_string"
561
- elif $rvm_scripts_path/match "$rvm_ruby_strings" "," ; then
589
+ if [[ -n "$rvm_ruby_strings" ]] && $rvm_scripts_path/match "$rvm_ruby_strings" "," ; then
562
590
  $rvm_scripts_path/manage "$rvm_action" "$rvm_ruby_strings"
591
+ elif [[ -n "$rvm_ruby_string" ]]; then
592
+ $rvm_scripts_path/manage "$rvm_action" "$rvm_ruby_string"
563
593
  else
564
594
  $rvm_scripts_path/manage "$rvm_action"
565
595
  fi
@@ -38,7 +38,7 @@ _rvm_commands ()
38
38
  local cur=${COMP_WORDS[COMP_CWORD]}
39
39
 
40
40
  COMMANDS='\
41
- version use reload impload update reset info debug\
41
+ version use reload implode update reset info debug\
42
42
  install uninstall remove\
43
43
  ruby gem rake tests specs monitor gemset\
44
44
  gemdir srcdir fetch list package notes'
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bash
2
+
3
+ #!/usr/bin/env bash
4
+ rvm_base_except="selector"
5
+ source "$rvm_scripts_path/base"
6
+
7
+ usage() {
8
+ printf "Usage: 'rvm disk-usage {all,archives,repos,sources,logs,packages}'\n"
9
+ printf " Lists the space rvm uses for a given item.\n"
10
+ exit 1
11
+ }
12
+
13
+ disk_usage_for_directory() {
14
+ du -hs "$1" | awk '{print $1}'
15
+ }
16
+
17
+ disk_usage() {
18
+ eval "local current_path=\"\$rvm_${2}_path\""
19
+ if [[ -n "$current_path" && -d "$current_path" && "$current_path" != "/" ]]; then
20
+ echo "$1 Usage: $(disk_usage_for_directory "$current_path")"
21
+ fi
22
+ unset current_path
23
+ }
24
+
25
+ all_disk_usage() {
26
+ archives_disk_usage
27
+ repos_disk_usage
28
+ sources_disk_usage
29
+ logs_disk_usage
30
+ packages_disk_usage
31
+ total_disk_usage
32
+ }
33
+
34
+ total_disk_usage() {
35
+ echo "Total Disk Usage: $(disk_usage_for_directory "$rvm_path")"
36
+ }
37
+
38
+ archives_disk_usage() { disk_usage "Downloaded Archives" "archives"; }
39
+ repos_disk_usage() { disk_usage "Repositories" "repo"; }
40
+ sources_disk_usage() { disk_usage "Extracted Source Code" "src"; }
41
+ logs_disk_usage() { disk_usage "Log Files" "log"; }
42
+ packages_disk_usage() { disk_usage "Packages" "usr"; }
43
+
44
+
45
+ # Exit when there is no argument.
46
+ [[ -z "$1" ]] && usage
47
+
48
+ case "$1" in
49
+ all|archives|repos|sources|logs|total|packages) eval "$1_disk_usage" ;;
50
+ *) usage ;;
51
+ esac
52
+
@@ -3,6 +3,13 @@
3
3
  rvm_base_except="selector"
4
4
  source "$rvm_scripts_path/base"
5
5
 
6
+ # Set it to cleanup the download on interruption.
7
+ trap 'cleanup_download' 1 2 3 15
8
+
9
+ cleanup_download() {
10
+ [[ -f "$archive" ]] && rm -rf "$archive"
11
+ }
12
+
6
13
  record_md5() {
7
14
  if [[ "Darwin" = "$(uname)" ]] || [[ "FreeBSD" = "$(uname)" ]]; then
8
15
  archive_md5="$(/sbin/md5 -q "${archive}")"
@@ -38,7 +45,7 @@ fi
38
45
  if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Fetching $archive" ; fi
39
46
 
40
47
  # Check first if we have the correct archive
41
- archive_md5="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive")"
48
+ archive_md5="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive" | head -n1)"
42
49
  if [[ -e "$archive" ]] && [[ ! -z "$archive_md5" ]] ; then
43
50
  if [[ ! -z "$rvm_debug_flag" ]] ; then $rvm_scripts_path/log "debug" "Found archive and its md5, testing correctness" ; fi
44
51
  if ! $rvm_scripts_path/md5 "${rvm_archives_path}/${archive}" "$archive_md5" ; then
@@ -87,5 +94,4 @@ if [[ $download -gt 0 ]] ; then
87
94
  record_md5
88
95
  fi
89
96
  fi
90
-
91
97
  exit $result
@@ -26,7 +26,18 @@ gemset_update() {
26
26
  }
27
27
 
28
28
  gemset_globalcache() {
29
- if [[ "$1" == "disable" ]]; then
29
+ if [[ "$1" == "enabled" ]]; then
30
+ __rvm_using_gemset_globalcache
31
+ local globalcache_enabled="$?"
32
+ local gc_status="Unknown"
33
+ if [[ "$globalcache_enabled" == "0" ]]; then
34
+ gc_status="Enabled"
35
+ else
36
+ gc_status="Disabled"
37
+ fi
38
+ $rvm_scripts_path/log "info" "Gemset global cache is currently: $gc_status"
39
+ return "$globalcache_enabled"
40
+ elif [[ "$1" == "disable" ]]; then
30
41
  $rvm_scripts_path/log "info" "Removing the global cache (note: this will empty the caches)"
31
42
  for directory_name in $(\ls "$rvm_gems_path"); do
32
43
  current_cache_path="$rvm_gems_path/$directory_name/cache"
@@ -68,8 +79,8 @@ gemset_dir() {
68
79
  gemset_create() {
69
80
  rvm_ruby_gem_prefix=$(echo $rvm_ruby_gem_home | sed 's/'${rvm_gemset_separator}'.*$//')
70
81
  for gemset in $(echo $gems_args) ; do
71
- gem_home="${rvm_ruby_gem_prefix}${rvm_gemset_separator}${gems_args/ /}"
72
- mkdir -p $gem_home
82
+ gem_home="${rvm_ruby_gem_prefix}${rvm_gemset_separator}${gemset}"
83
+ mkdir -p "$gem_home"
73
84
  # When the globalcache is enabled, we need to ensure we setup the cache directory correctly.
74
85
  if __rvm_using_gemset_globalcache; then
75
86
  if [[ -d "$gem_home/cache" && ! -L "$gem_home/cache" ]]; then
@@ -462,7 +473,7 @@ elif [[ "prune" = "$action" ]] ; then
462
473
  elif [[ "update" = "$action" ]]; then
463
474
  gemset_update
464
475
  elif [[ "globalcache" = "$action" ]]; then
465
- gemset_globalcache $2
476
+ gemset_globalcache "$2"
466
477
  elif [[ "clear" = "$action" ]] ; then
467
478
  $rvm_scripts_path/log "info" "gemset cleared."
468
479
  exit 0
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- if [[ "root" = "$(whoami)" ]] ; then
3
+ if [[ -n "$rvm_prefix" && "$rvm_prefix" != "$HOME/"* ]] || [[ "root" = "$(whoami)" ]] ; then
4
4
  rvm_rc_files="${rvm_rc_files:-"/etc/profile /etc/zshenv"}"
5
5
  else
6
6
  rvm_rc_files="${rvm_rc_files:-"$HOME/.bash_profile $HOME/.bashrc $HOME/.zshenv"}"
7
7
  fi
8
8
 
9
- if [[ ! -z "$rvm_archflags" ]] ; then rvm_make_flags_flag=1 ; fi
9
+ [[ -n "$rvm_archflags" ]] && rvm_make_flags_flag=1
10
10
 
11
11
  rvm_project_rvmrc="${rvm_project_rvmrc:-1}"
12
12
  rvm_project_rvmrc_default="${rvm_project_rvmrc_default:-0}"
13
13
 
14
- if [[ "root" = "$(whoami)" ]] ; then
14
+ if [[ -n "$rvm_prefix" && "$rvm_prefix" != "$HOME/"* ]] || [[ "root" = "$(whoami)" ]] ; then
15
15
  rvm_bin_path="${rvm_bin_path:-"/usr/local/bin"}"
16
16
  rvm_man_path="${rvm_man_path:-"/usr/local/share/man"}"
17
17
  else
@@ -44,19 +44,19 @@ if echo "$*" | grep -q 'trace' ; then echo "$*" ; env | grep '^rvm_' ; set -x ;
44
44
  while [[ $# -gt 0 ]] ; do
45
45
  token="$1" ; shift
46
46
  case "$token" in
47
- --auto) rvm_auto_flag=1 ;;
47
+ --auto) rvm_auto_flag=1 ;;
48
48
  --prefix) rvm_prefix="$1" ; shift ;;
49
49
  --version) rvm_path="$(pwd)" ; __rvm_version ; unset rvm_path ; exit ;;
50
- --help|*) usage ;;
50
+ --help|*) usage ;;
51
51
  esac
52
52
  done
53
53
 
54
54
  if [[ -z "$rvm_prefix" ]] ; then
55
55
  __rvm_load_rvmrc
56
56
  if [[ "root" = "$(whoami)" ]] ; then
57
- rvm_prefix="/usr/local/"
57
+ rvm_prefix="${rvm_prefix:-"/usr/local/"}"
58
58
  else
59
- rvm_prefix="$HOME/."
59
+ rvm_prefix="${rvm_prefix:-"$HOME/."}"
60
60
  fi
61
61
  fi
62
62
 
@@ -87,7 +87,7 @@ rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
87
87
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
88
88
  rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
89
89
 
90
- if [[ "root" = "$(whoami)" ]] ; then
90
+ if [[ -z "$rvm_prefix" ]] && [[ "root" = "$(whoami)" ]] ; then
91
91
  rvm_bin_path="${rvm_bin_path:-"/usr/local/bin"}"
92
92
  else
93
93
  rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
@@ -114,7 +114,7 @@ fi
114
114
 
115
115
  spinner
116
116
 
117
- 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
117
+ 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_patches_path $rvm_tmp_path
118
118
 
119
119
  for file in README LICENCE ; do
120
120
  spinner
@@ -139,7 +139,7 @@ if [[ ! -s "$rvm_config_path/user" ]] ; then
139
139
  fi
140
140
 
141
141
  scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
142
- for script_name in $scripts ; do
142
+ for script_name in "${scripts[@]}" ; do
143
143
  spinner
144
144
  chmod +x $rvm_scripts_path/$script_name
145
145
  done
@@ -148,7 +148,7 @@ done
148
148
  # Bin Scripts
149
149
  #
150
150
  # Cleanse and purge...
151
- for file in rvm-prompt rvm rvmsudo ; do
151
+ for file in rvm-prompt rvm rvmsudo rvm-shell ; do
152
152
  spinner && perl -e 'sleep 0.2'
153
153
  rm -f "$rvm_bin_path/$file"
154
154
  cp -f "$source_path/binscripts/$file" $rvm_bin_path/
@@ -160,7 +160,7 @@ chmod +x $rvm_bin_path/*
160
160
  # RC Files
161
161
  #
162
162
  spinner
163
- if [[ ! -z "$rvm_auto_flag" ]] ; then
163
+ if [[ -n "$rvm_auto_flag" ]] ; then
164
164
  printf "Checking rc files... ($rvm_rc_files)"
165
165
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
166
166
  for rcfile in $(echo $rvm_rc_files) ; do
@@ -274,16 +274,16 @@ fi
274
274
  # End of gemset migration.
275
275
  #
276
276
 
277
- if [[ "root" = "$(whoami)" ]] ; then
278
- printf "\n Symlinking rvm to $rvm_bin_path/rvm ..."
279
- mkdir -p $rvm_bin_path
280
- chmod +x $rvm_bin_path/rvm
281
- chmod +x $rvm_bin_path/rvmsudo
282
- printf "\n Copying manpages into place."
283
- for man_file in $(\ls "$install_source_path/man"); do
284
- cp -f "$install_source_path/man/$man_file" "$rvm_man_path/$man_file"
285
- done
286
- fi
277
+ printf "\n Correct permissions for base binaries in $rvm_bin_path..."
278
+ mkdir -p $rvm_bin_path
279
+ for file in rvm rvmsudo rvm-shell ; do
280
+ [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
281
+ done; unset file
282
+ printf "\n Copying manpages into place."
283
+ for man_file in $(\ls "$install_source_path/man"); do
284
+ rm -rf "$rvm_man_path/$man_file"
285
+ cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
286
+ done
287
287
 
288
288
  if [[ "$upgrade_flag" -eq 0 ]] ; then
289
289
  ./scripts/notes
@@ -303,20 +303,19 @@ if [[ "$upgrade_flag" -eq 1 ]] ; then
303
303
  printf "\n$(tput setaf 6)Upgrade Notes\n"
304
304
  printf "\n * 'rvm notes' tells you OS dependency packages for installing rubies."
305
305
  printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' "
306
- printf "\n * 1.8.7 default patchlevel is p174, override ~/.rvm/config/db in ~/.rvm/config/user"
307
306
  printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
308
307
  printf "\n$(tput sgr0)\n"
309
308
  check_rubyopt_conditions
310
309
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
311
310
  else
312
- if [[ "root" != "$(whoami)" ]] ; then
311
+ if [[ -z "$rvm_prefix" ]] && [[ "root" != "$(whoami)" ]] ; then
313
312
  printf "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
314
313
  printf "\n1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:"
315
314
  printf "\n [[ -s \$HOME/.rvm/scripts/rvm ]] && source \$HOME/.rvm/scripts/rvm"
316
315
  printf "\n Please note that this must only occur once - so, you only need to add it the first time you install rvm."
317
316
  printf "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
318
- printf "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:"
319
- printf "\n if [[ ! -z "$PS1" ]] ; then"
317
+ printf "\n This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to:"
318
+ printf "\n if [[ -n "\$PS1" ]] ; then"
320
319
  printf "\n ... original content that was below the && return line ..."
321
320
  printf "\n fi # <= be sure to close the if."
322
321
  printf "\n #EOF .bashrc"
@@ -325,7 +324,7 @@ else
325
324
  printf "\n placing all non-interactive items in the .bashrc, including the 'source' line above"
326
325
  printf "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
327
326
  fi
328
- if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then
327
+ if [[ -s $HOME/.bashrc ]] && grep -q '&& return' $HOME/.bashrc ; then
329
328
  printf "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc."
330
329
  printf "\n This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to:"
331
330
  printf "\n if [[ -n "\$PS1" ]] ; then"