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,10 +1,8 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- rvm_pretty_print=${rvm_pretty_print:-0}
4
-
5
3
  rvm_base_except="selector"
6
4
 
7
- source "$rvm_scripts_path/base"
5
+ source "$rvm_path/scripts/base"
8
6
 
9
7
  usage() {
10
8
  printf "
@@ -34,10 +32,11 @@ list_gemsets() {
34
32
 
35
33
  printf "\nrvm gemsets\n"
36
34
 
37
- versions=($(builtin cd "$rvm_gems_path/" ; find * -type d -maxdepth 0 -print 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
38
- for version in "${versions[@]}" ; do
35
+ versions=($(builtin cd "$rvm_gems_path/" ; find . -maxdepth 1 -mindepth 1 -type d -print 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
36
+
37
+ for version in "${versions[@]//.\/}" ; do
39
38
 
40
- ruby_version_name="$(echo "$version" | awk -F"$rvm_gemset_separator" '{print $1}')"
39
+ ruby_version_name="$(echo "$version" | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
41
40
 
42
41
  [[ "$all_rubies" != *"$ruby_version_name"* ]] && continue
43
42
 
@@ -59,7 +58,7 @@ list_gemsets() {
59
58
  printf " "
60
59
  fi
61
60
 
62
- if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
61
+ if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
63
62
 
64
63
  printf "$(tput setaf 2)$version$(tput sgr0) $string"
65
64
  else
@@ -74,15 +73,15 @@ list_gemsets() {
74
73
 
75
74
  if [[ -n "$version" ]] ; then
76
75
 
77
- printf "\n\nDefault Ruby (for new shells)\n"
76
+ printf "\nDefault Ruby (for new shells)\n"
78
77
 
79
78
  string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
80
79
 
81
- if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
80
+ if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
82
81
 
83
- printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
82
+ printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
84
83
  else
85
- printf "\n $version $string"
84
+ printf "\n $version $string\n"
86
85
  fi
87
86
 
88
87
  fi
@@ -100,33 +99,37 @@ list_default() {
100
99
 
101
100
  if [[ "${args[0]:-""}" = "string" ]] ; then
102
101
 
103
- "$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --
102
+ "$rvm_path/scripts/alias" show default 2>/dev/null | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}' | xargs basename --
104
103
 
105
104
  else
106
105
  if [[ -L "$rvm_rubies_path/default" ]]; then
107
106
 
108
- version=$("$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --)
107
+ version=$("$rvm_path/scripts/alias" show default 2>/dev/null | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}' | xargs basename --)
109
108
 
110
109
  if [[ -n "$version" ]] ; then
111
110
 
112
- printf "\n\nDefault Ruby (for new shells)\n"
111
+ printf "\nDefault Ruby (for new shells)\n"
113
112
 
114
113
  string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
115
114
 
116
- if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
115
+ if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
117
116
 
118
117
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
118
+
119
119
  else
120
120
  printf "\n $version $string\n"
121
121
  fi
122
- fi ; unset version
122
+ fi
123
123
  fi
124
124
  fi
125
125
 
126
+ printf "\n"
127
+
126
128
  return 0
127
129
  }
128
130
 
129
131
  list_ruby_svn_tags() {
132
+
130
133
  local prefix tag
131
134
 
132
135
  while read -r tag
@@ -143,10 +146,11 @@ list_ruby_svn_tags() {
143
146
  # Query for valid rvm ruby strings
144
147
  # This is meant to be used with scripting.
145
148
  list_strings() {
149
+
146
150
  (
147
151
  cd "$rvm_rubies_path"
148
152
 
149
- find * -type d -maxdepth 0
153
+ find . -maxdepth 1 -mindepth 1 -type d | sed -e 's#./##g'
150
154
  )
151
155
 
152
156
  return $?
@@ -154,15 +158,16 @@ list_strings() {
154
158
 
155
159
  # This is meant to be used with scripting.
156
160
  list_gemset_strings() {
161
+
157
162
  local all_rubies ruby_name gemset gemsets
158
163
 
159
164
  all_rubies="$(list_strings)"
160
165
 
161
- gemsets=($(builtin cd "$rvm_gems_path" ; find * -type d -maxdepth 0 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort))
166
+ gemsets=($(builtin cd "$rvm_gems_path" ; find . -maxdepth 1 -mindepth 1 -type d 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort))
162
167
 
163
- for gemset in "${gemsets[@]}" ; do
168
+ for gemset in "${gemsets[@]//.\/}" ; do
164
169
 
165
- ruby_name="${gemset//${rvm_gemset_separator}*}"
170
+ ruby_name="${gemset//${rvm_gemset_separator:-"@"}*}"
166
171
 
167
172
  [[ "$all_rubies" != *"$ruby_name"* ]] && continue
168
173
 
@@ -175,7 +180,7 @@ list_gemset_strings() {
175
180
  # This is meant to be used with scripting.
176
181
  list_known_strings() {
177
182
 
178
- sed -e 's/#.*$//g' -e 's/(//g' -e 's/)//g' < "$rvm_config_path/known" | sort -r | uniq
183
+ sed -e 's/#.*$//g' -e 's#\[##g' -e 's#\]##g' < "$rvm_config_path/known" | sort -r | uniq
179
184
 
180
185
  return $?
181
186
  }
@@ -202,9 +207,10 @@ list_known() {
202
207
  return $?
203
208
  }
204
209
 
205
-
206
210
  list_rubies_strings() {
207
- ( builtin cd "$rvm_rubies_path" ; find -type d -maxdepth 0 | tail -n+2 | xargs -n1 basename -- | __rvm_strip )
211
+
212
+ ( builtin cd "$rvm_rubies_path" ; find -maxdepth 0 -type d | tail -n+2 | xargs -n1 basename -- | __rvm_strip )
213
+
208
214
  return $?
209
215
  }
210
216
 
@@ -214,17 +220,16 @@ list_rubies() {
214
220
 
215
221
  if [[ "${1:-""}" = "strings" ]]; then list_rubies_strings ; return 0 ; fi
216
222
 
217
- current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
223
+ current_ruby="$(__rvm_environment_identifier | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
218
224
 
219
225
  printf "\nrvm rubies\n"
220
226
 
221
- rubies=($(builtin cd "$rvm_rubies_path/" ; find * -type d -maxdepth 0 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
227
+ rubies=($(builtin cd "$rvm_rubies_path/" ; find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
222
228
 
223
- for version in "${rubies[@]}" ; do
229
+ for version in "${rubies[@]//.\/}" ; do
224
230
 
225
231
  [[ ! -x "$rvm_rubies_path/$version/bin/ruby" ]] && continue
226
232
 
227
- (
228
233
  if echo "$version" | grep -q '^jruby-' ; then
229
234
 
230
235
  string="[ $("$rvm_rubies_path/$version/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
@@ -247,15 +252,14 @@ list_rubies() {
247
252
  fi
248
253
 
249
254
  # TODO: Only use tput for interactive terminal sessions.
250
- if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
255
+ if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
251
256
 
252
257
  printf "$(tput setaf 2)$version$(tput sgr0) $string"
253
258
  else
254
259
  printf "$version $string"
255
260
  fi
256
- )&
257
261
 
258
- done ; wait
262
+ done
259
263
 
260
264
  if [[ -f "$rvm_config_path/default" ]] && [[ -s "$rvm_config_path/default" ]] ; then
261
265
 
@@ -263,15 +267,14 @@ list_rubies() {
263
267
 
264
268
  if [[ -n "$version" ]] ; then
265
269
 
266
- printf "\n\nDefault Ruby (for new shells)\n"
270
+ printf "Default Ruby (for new shells)\n"
267
271
 
268
272
  string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
269
273
 
270
- if [[ ${rvm_pretty_print:-0} -eq 1 ]] ; then
271
-
272
- printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
274
+ if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
275
+ printf " $(tput setaf 2)$version$(tput sgr0) $string\n"
273
276
  else
274
- printf "\n $version $string"
277
+ printf " $version $string\n"
275
278
  fi
276
279
 
277
280
  fi
@@ -9,9 +9,9 @@ if [[ ! -z "$2" ]] ; then level=$1 ; shift ; else level="info" ; fi
9
9
 
10
10
  message="${1//%/%%}"
11
11
 
12
- rvm_pretty_print=${rvm_pretty_print:-0}
13
- if [[ $rvm_pretty_print -eq 0 ]] ; then
14
- if [[ $rvm_verbose_flag -gt 0 && -n "$level" ]] ; then
12
+ if [[ ${rvm_pretty_print_flag:-0} -eq 0 ]] ; then
13
+
14
+ if [[ ${rvm_verbose_flag:-0} -gt 0 && -n "$level" ]] ; then
15
15
  message="$level: $message"
16
16
  fi
17
17
 
@@ -20,7 +20,9 @@ if [[ $rvm_pretty_print -eq 0 ]] ; then
20
20
  error|fail) printf "$message\n" >&2 ;;
21
21
  *) printf "$message"
22
22
  esac
23
+
23
24
  else
25
+
24
26
  case "$level" in
25
27
  debug) printf "$(tput setaf 5)$level$(tput sgr0): $message\n" ;;
26
28
  info) printf "$(tput setaf 2)$level$(tput sgr0): $message\n" ;;
@@ -29,6 +31,7 @@ else
29
31
  fail) printf "$(tput setaf 1)$level$(tput sgr0): $message\n" >&2 ;;
30
32
  *) printf "$message"
31
33
  esac
34
+
32
35
  fi
33
36
 
34
37
  exit 0
@@ -12,7 +12,7 @@ zipfile=${version}.zip
12
12
  case "$system" in
13
13
  Linux)
14
14
  if [[ "$(uname -sm)" != "Linux x86_64" ]]; then
15
- "$rvm_scripts_path/log" "error" "This script only works on a 64-bit Linux OS."
15
+ "$rvm_path/scripts/log" "error" "This script only works on a 64-bit Linux OS."
16
16
  echo "The result from \"uname -sm\" is \"`uname -sm`\" not \"Linux x86_64\""
17
17
  exit 1
18
18
  fi
@@ -26,19 +26,19 @@ case "$system" in
26
26
  #
27
27
  # Check the CPU and Mac OS profile.
28
28
  if [[ $CPU_TYPE != "i386" || $CPU_CAPABLE -ne 1 || $MAJOR -lt 10 || $MINOR -lt 5 ]] ; then
29
- "$rvm_scripts_path/log" "error" "This script requires Mac OS 10.5 or later on a 64-bit Intel CPU."
29
+ "$rvm_path/scripts/log" "error" "This script requires Mac OS 10.5 or later on a 64-bit Intel CPU."
30
30
  exit 1
31
31
  fi
32
32
  ;;
33
33
  Solaris-x86)
34
34
  if [[ "$(uname -sm)" != "SunOS i86pc" ]]; then
35
- "$rvm_scripts_path/log" "error" "This script only works on a 64-bit Solaris-x86 OS."
35
+ "$rvm_path/scripts/log" "error" "This script only works on a 64-bit Solaris-x86 OS."
36
36
  echo "The result from \"uname -sm\" is \"`uname -sm`\" not \"SunOS i86pc\""
37
37
  exit 1
38
38
  fi
39
39
  ;;
40
40
  *)
41
- "$rvm_scripts_path/log" "error" "This script only works on a 64-bit Linux, Mac OS X, or Solaris-x86 machine"
41
+ "$rvm_path/scripts/log" "error" "This script only works on a 64-bit Linux, Mac OS X, or Solaris-x86 machine"
42
42
  echo "The result from \"uname -sm\" is \"`uname -sm`\""
43
43
  exit 1
44
44
  ;;
@@ -46,23 +46,23 @@ esac
46
46
 
47
47
  # We should run this as a normal user, not root.
48
48
  if [[ `id | cut -f2 -d= | cut -f1 -d\(` -eq 0 ]]; then
49
- "$rvm_scripts_path/log" "error" "This script should be run as a normal user, not root."
49
+ "$rvm_path/scripts/log" "error" "This script should be run as a normal user, not root."
50
50
  exit 1
51
51
  fi
52
52
 
53
53
  # Check that the current directory is writable
54
54
  if [[ ! -w "." ]]; then
55
- "$rvm_scripts_path/log" "error" "This script requires write permission on your current directory."
55
+ "$rvm_path/scripts/log" "error" "This script requires write permission on your current directory."
56
56
  \ls -ld $PWD
57
57
  exit 1
58
58
  fi
59
59
 
60
60
  # We're good to go. Let user know.
61
61
  machine_name="`uname -n`"
62
- "$rvm_scripts_path/log" "info" "Starting installation of $version on $machine_name"
62
+ "$rvm_path/scripts/log" "info" "Starting installation of $version on $machine_name"
63
63
 
64
64
  # Figure out how much total memory is installed
65
- "$rvm_scripts_path/log" "info" "Setting up shared memory"
65
+ "$rvm_path/scripts/log" "info" "Setting up shared memory"
66
66
  #
67
67
  # Ref: http://wiki.finkproject.org/index.php/Shared_Memory_Regions_on_Darwin
68
68
  # Ref: http://developer.postgresql.org/pgdocs/postgres/kernel-resources.html
@@ -94,7 +94,7 @@ case "$system" in
94
94
  shmall=$(($shmmax / 4096))
95
95
  ;;
96
96
  *)
97
- "$rvm_scripts_path/log" "error" "Can't determine operating system. Check script."
97
+ "$rvm_path/scripts/log" "error" "Can't determine operating system. Check script."
98
98
  exit 1
99
99
  ;;
100
100
  esac
@@ -124,22 +124,22 @@ shmallNewMB=$(($shmallNew / 256))
124
124
 
125
125
  # Increase shmmax if appropriate
126
126
  if [[ $shmmaxNew -gt $shmmax ]]; then
127
- "$rvm_scripts_path/log" "info" "Increasing max shared memory segment size to $shmmaxNewMB MB"
127
+ "$rvm_path/scripts/log" "info" "Increasing max shared memory segment size to $shmmaxNewMB MB"
128
128
  [[ $system = "Darwin" ]] && sudo sysctl -w kern.sysv.shmmax=$shmmaxNew
129
129
  [[ $system = "Linux" ]] && sudo bash -c "echo $shmmaxNew > /proc/sys/kernel/shmmax"
130
130
  [[ $system = "Solaris-x86" ]] && echo "[[Warning]] shmmax must be set manually on Solaris-x86"
131
131
  else
132
- "$rvm_scripts_path/log" "info" "No need to increase max shared memory segment size"
132
+ "$rvm_path/scripts/log" "info" "No need to increase max shared memory segment size"
133
133
  fi
134
134
 
135
135
  # Increase shmall if appropriate
136
136
  if [[ $shmallNew -gt $shmall ]]; then
137
- "$rvm_scripts_path/log" "info" "Increasing max shared memory allowed to $shmallNewMB MB"
137
+ "$rvm_path/scripts/log" "info" "Increasing max shared memory allowed to $shmallNewMB MB"
138
138
  [[ $system = "Darwin" ]] && sudo sysctl -w kern.sysv.shmall=$shmallNew
139
139
  [[ $system = "Linux" ]] && sudo bash -c "echo $shmallNew > /proc/sys/kernel/shmall"
140
140
  [[ $system = "Solaris-x86" ]] && echo "[[Warning]]shmall must be set manually on Solaris-x86"
141
141
  else
142
- "$rvm_scripts_path/log" "info" "No need to increase max shared memory allowed"
142
+ "$rvm_path/scripts/log" "info" "No need to increase max shared memory allowed"
143
143
  fi
144
144
 
145
145
  # At this point, shared memory settings contain the values we want,
@@ -163,30 +163,30 @@ if [[ ! -f /etc/sysctl.conf ]] || [[ "$(\grep -sc "kern.*.shm" /etc/sysctl.conf)
163
163
  # Must configure shared memory settings manually.
164
164
  ;;
165
165
  *)
166
- "$rvm_scripts_path/log" "error" "Can't determine operating system. Check script."
166
+ "$rvm_path/scripts/log" "error" "Can't determine operating system. Check script."
167
167
  exit 1
168
168
  ;;
169
169
  esac
170
170
  # Do nothing on Solaris-x86 since /etc/sysctl.conf is ignored on Solaris 10.
171
171
  if [[ "$system" != "Solaris-x86" ]]; then
172
- "$rvm_scripts_path/log" "info" "Adding the following section to /etc/sysctl.conf"
172
+ "$rvm_path/scripts/log" "info" "Adding the following section to /etc/sysctl.conf"
173
173
  cat /tmp/sysctl.conf.$$
174
174
  sudo bash -c "cat /tmp/sysctl.conf.$$ >> /etc/sysctl.conf"
175
175
  /bin/rm -f /tmp/sysctl.conf.$$
176
176
  fi
177
177
  else
178
- "$rvm_scripts_path/log" "info" "The following shared memory settings already exist in /etc/sysctl.conf"
178
+ "$rvm_path/scripts/log" "info" "The following shared memory settings already exist in /etc/sysctl.conf"
179
179
  echo "To change them, remove the following lines from /etc/sysctl.conf and rerun this script"
180
180
  \grep "kern.*.shm" /etc/sysctl.conf
181
181
  fi
182
182
 
183
183
  # Now setup for NetLDI in case we ever need it.
184
- "$rvm_scripts_path/log" "info" "Setting up GemStone netldi service port"
184
+ "$rvm_path/scripts/log" "info" "Setting up GemStone netldi service port"
185
185
  if [[ $(\grep -sc "^gs64ldi" /etc/services) -eq 0 ]]; then
186
186
  echo '[[Info]] Adding "gs64ldi 50378/tcp" to /etc/services'
187
187
  sudo bash -c 'echo "gs64ldi 50378/tcp # Gemstone netldi" >> /etc/services'
188
188
  else
189
- "$rvm_scripts_path/log" "info" "GemStone netldi service port is already set in /etc/services"
189
+ "$rvm_path/scripts/log" "info" "GemStone netldi service port is already set in /etc/services"
190
190
  echo "To change it, remove the following line from /etc/services and rerun this script"
191
191
  \grep "^gs64ldi" /etc/services
192
192
  fi
@@ -3,12 +3,12 @@
3
3
  original_ruby_version=${rvm_ruby_version:-""}
4
4
  original_ruby_string=${rvm_ruby_string:-""}
5
5
 
6
- source "$rvm_scripts_path/base"
7
- source "$rvm_scripts_path/patches"
6
+ source "$rvm_path/scripts/base"
7
+ source "$rvm_path/scripts/patches"
8
8
 
9
9
  __rvm_check_for_clang() {
10
10
  if [[ -n "${rvm_clang_flag:-""}" ]] && ! command -v clang >/dev/null ; then
11
- "$rvm_scripts_path/log" "fail" "\nYou passed the --clang option and clang is not in your path. \nPlease try again or do not use --clang.\n"
11
+ "$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"
12
12
  return 1
13
13
  fi
14
14
  }
@@ -21,7 +21,7 @@ __rvm_check_for_bison() {
21
21
  command -v bison > /dev/null
22
22
  result=$?
23
23
  if [[ $? -gt 0 ]] ; then
24
- "$rvm_scripts_path/log" "fail" \
24
+ "$rvm_path/scripts/log" "fail" \
25
25
  "\nbison is not available in your path. \nPlease ensure bison is installed before compiling from head.\n"
26
26
  fi
27
27
  fi
@@ -95,7 +95,7 @@ __rvm_apply_patches() {
95
95
  fi
96
96
 
97
97
  else
98
- "$rvm_scripts_path/log" "warn" \
98
+ "$rvm_path/scripts/log" "warn" \
99
99
  "Patch '$patch_name' not found."
100
100
  result=1
101
101
  fi
@@ -115,7 +115,7 @@ __rvm_install_source() {
115
115
  *-head) __rvm_ensure_has_18_compat_ruby || return 1 ;;
116
116
  esac
117
117
 
118
- "$rvm_scripts_path/log" "info" "\nInstalling Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)...\n"
118
+ "$rvm_path/scripts/log" "info" "\nInstalling Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)...\n"
119
119
 
120
120
  builtin cd "$rvm_src_path"
121
121
 
@@ -136,16 +136,16 @@ __rvm_install_source() {
136
136
  result=$?
137
137
 
138
138
  if [[ "$result" -gt 0 ]] ; then
139
- "$rvm_scripts_path/log" "error" \
140
- "There has been an error fetching the ruby interpreter. Aborting the installation."
139
+ "$rvm_path/scripts/log" "error" \
140
+ "There has been an error fetching the ruby interpreter. Halting the installation."
141
141
  return $result
142
142
  fi
143
143
 
144
144
  builtin cd "$rvm_ruby_src_path"
145
145
 
146
146
  result=$? ; if [[ "$result" -gt 0 ]] ; then
147
- "$rvm_scripts_path/log" "error" \
148
- "Source directory is missing. Did the download or extraction fail? Aborting the installation."
147
+ "$rvm_path/scripts/log" "error" \
148
+ "Source directory is missing. Did the download or extraction fail? Halting the installation."
149
149
  return $result
150
150
  fi
151
151
 
@@ -159,8 +159,8 @@ __rvm_install_source() {
159
159
  result="$?"
160
160
 
161
161
  if [[ "$result" -gt 0 ]]; then
162
- "$rvm_scripts_path/log" "fail" \
163
- "There has been an error applying the specified patches. Aborting the installation."
162
+ "$rvm_path/scripts/log" "fail" \
163
+ "There has been an error applying the specified patches. Halting the installation."
164
164
  return $result
165
165
  fi
166
166
 
@@ -171,7 +171,7 @@ __rvm_install_source() {
171
171
  __rvm_run "autoconf" "autoconf" "Running autoconf"
172
172
 
173
173
  else
174
- "$rvm_scripts_path/log" "fail" \
174
+ "$rvm_path/scripts/log" "fail" \
175
175
  "rvm requires autoconf to install the selected ruby interpreter however autoconf was not found in the PATH."
176
176
  return 1
177
177
  fi
@@ -183,8 +183,8 @@ __rvm_install_source() {
183
183
  result=$?
184
184
 
185
185
  if [[ "$result" -gt 0 ]] ; then
186
- "$rvm_scripts_path/log" "error" \
187
- "There has been an error while configuring. Aborting the installation."
186
+ "$rvm_path/scripts/log" "error" \
187
+ "There has been an error while configuring. Halting the installation."
188
188
  return $result
189
189
  fi
190
190
 
@@ -208,28 +208,28 @@ __rvm_install_source() {
208
208
 
209
209
  local configure_command="./configure --prefix=$rvm_ruby_home ${db_configure_flags:-""} ${rvm_configure_flags:-""} ${configure_parameters:-""}"
210
210
 
211
- __rvm_run "configure" "$configure_command" "#configuring $rvm_ruby_string"
211
+ __rvm_run "configure" "$configure_command" "$rvm_ruby_string - #configuring "
212
212
  result=$?
213
213
 
214
214
  if [[ "$result" -gt 0 ]] ; then
215
- "$rvm_scripts_path/log" "error" \
216
- "There has been an error while running configure. Aborting the installation."
215
+ "$rvm_path/scripts/log" "error" \
216
+ "There has been an error while running configure. Halting the installation."
217
217
  return $result
218
218
  fi
219
219
 
220
220
  else
221
- "$rvm_scripts_path/log" "error" \
221
+ "$rvm_path/scripts/log" "error" \
222
222
  "Skipping configure step, 'configure' does not exist, did autoconf not run successfully?"
223
223
  fi
224
224
 
225
225
  rvm_ruby_make=${rvm_ruby_make:-"make"}
226
226
 
227
- __rvm_run "make" "$rvm_ruby_make ${rvm_make_flags:-""}" "#compiling $rvm_ruby_string"
227
+ __rvm_run "make" "$rvm_ruby_make ${rvm_make_flags:-""}" "$rvm_ruby_string - #compiling "
228
228
  result=$?
229
229
 
230
230
  if [[ "$result" -gt 0 ]] ; then
231
- "$rvm_scripts_path/log" "error" \
232
- "There has been an error while running make. Aborting the installation."
231
+ "$rvm_path/scripts/log" "error" \
232
+ "There has been an error while running make. Halting the installation."
233
233
  return $result
234
234
  fi
235
235
 
@@ -239,12 +239,12 @@ __rvm_install_source() {
239
239
 
240
240
  rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
241
241
 
242
- __rvm_run "install" "$rvm_ruby_make_install" "#installing $rvm_ruby_string"
242
+ __rvm_run "install" "$rvm_ruby_make_install" "$rvm_ruby_string - #installing "
243
243
  result=$?
244
244
 
245
245
  if [[ "$result" -gt 0 ]] ; then
246
- "$rvm_scripts_path/log" "error" \
247
- "There has been an error while running make install. Aborting the installation."
246
+ "$rvm_path/scripts/log" "error" \
247
+ "There has been an error while running make install. Halting the installation."
248
248
  return $result
249
249
  fi
250
250
 
@@ -260,8 +260,8 @@ __rvm_install_source() {
260
260
 
261
261
  __rvm_post_install
262
262
 
263
- "$rvm_scripts_path/log" "info" \
264
- "#complete install of $rvm_ruby_string"
263
+ "$rvm_path/scripts/log" "info" \
264
+ "Install of $rvm_ruby_string - #complete "
265
265
 
266
266
  return 0
267
267
  }
@@ -288,7 +288,7 @@ __rvm_install_ruby() {
288
288
  if [[ "$rvm_head_flag" = 1 ]] ; then
289
289
 
290
290
  if [[ -n "$rvm_llvm_flag" ]] ; then
291
- "$rvm_scripts_path/package" llvm install
291
+ "$rvm_path/scripts/package" llvm install
292
292
  fi
293
293
 
294
294
  macruby_path="/usr/local/bin"
@@ -305,8 +305,8 @@ __rvm_install_ruby() {
305
305
  result=$?
306
306
 
307
307
  if [[ "$result" -gt 0 ]] ; then
308
- "$rvm_scripts_path/log" "error" \
309
- "There has been an error while trying to install from source. Aborting the installation."
308
+ "$rvm_path/scripts/log" "error" \
309
+ "There has been an error while trying to install from source. Halting the installation."
310
310
  return $result
311
311
  fi
312
312
 
@@ -314,14 +314,14 @@ __rvm_install_ruby() {
314
314
  macruby_path="/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin"
315
315
  # TODO: Separated nightly from head.
316
316
 
317
- "$rvm_scripts_path/log" "info" "Retrieving the latest nightly macruby build..."
317
+ "$rvm_path/scripts/log" "info" "Retrieving the latest nightly macruby build..."
318
318
 
319
- "$rvm_scripts_path/fetch" "$rvm_ruby_url"
319
+ "$rvm_path/scripts/fetch" "$rvm_ruby_url"
320
320
  result=$?
321
321
 
322
322
  if [[ "$result" -gt 0 ]] ; then
323
- "$rvm_scripts_path/log" "error" \
324
- "There has been an error while trying to fetch the source. Aborting the installation."
323
+ "$rvm_path/scripts/log" "error" \
324
+ "There has been an error while trying to fetch the source. Halting the installation."
325
325
  return $result
326
326
  fi
327
327
 
@@ -335,15 +335,15 @@ __rvm_install_ruby() {
335
335
  macruby_path="/Library/Frameworks/MacRuby.framework/Versions/${rvm_ruby_version}/usr/bin"
336
336
 
337
337
  # TODO: Separated nightly from head.
338
- "$rvm_scripts_path/log" "info" "Retrieving MacRuby ${rvm_ruby_version} ..."
338
+ "$rvm_path/scripts/log" "info" "Retrieving MacRuby ${rvm_ruby_version} ..."
339
339
 
340
- "$rvm_scripts_path/fetch" "$rvm_ruby_url"
340
+ "$rvm_path/scripts/fetch" "$rvm_ruby_url"
341
341
 
342
342
  result=$?
343
343
 
344
344
  if [[ "$result" -gt 0 ]] ; then
345
- "$rvm_scripts_path/log" "error" \
346
- "There has been an error while trying to fetch the source. Aborting the installation."
345
+ "$rvm_path/scripts/log" "error" \
346
+ "There has been an error while trying to fetch the source. Halting the installation."
347
347
  return $result
348
348
  fi
349
349
 
@@ -388,10 +388,12 @@ RubyWrapper
388
388
  if [[ "$binary_name" = "ruby" ]] ; then
389
389
  echo "$ruby_wrapper" > "$rvm_bin_path/$rvm_ruby_string"
390
390
  fi
391
- done
391
+ done ; unset binaries
392
+
392
393
  __rvm_irbrc
394
+
393
395
  else
394
- "$rvm_scripts_path/log" "fail" \
396
+ "$rvm_path/scripts/log" "fail" \
395
397
  "MacRuby can only be installed on a Darwin OS."
396
398
  fi
397
399
  ;;
@@ -401,36 +403,37 @@ RubyWrapper
401
403
 
402
404
  rvm_ruby_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
403
405
 
404
- "$rvm_scripts_path/log" "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
406
+ "$rvm_path/scripts/log" "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
405
407
 
406
408
  builtin cd "$rvm_src_path"
407
409
 
408
410
  if [[ ${rvm_force_flag:-0} -eq 0 && -d "$rvm_ruby_src_path" && ! -x "$rvm_ruby_src_path/installer" ]] ; then
409
411
 
410
- "$rvm_scripts_path/log" \
412
+ "$rvm_path/scripts/log" \
411
413
  "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
412
414
 
413
415
  else
414
- "$rvm_scripts_path/log" "#fetching $rvm_ruby_package_file"
416
+ "$rvm_path/scripts/log" \
417
+ "$rvm_ruby_string - #fetching ($rvm_ruby_package_file)"
415
418
 
416
- "$rvm_scripts_path/fetch" "$rvm_ruby_url"
419
+ "$rvm_path/scripts/fetch" \
420
+ "$rvm_ruby_url"
417
421
  result=$?
418
422
 
419
423
  if [[ "$result" -gt 0 ]] ; then
420
- "$rvm_scripts_path/log" "error" \
421
- "There has been an error while trying to fetch the source. Aborting the installation."
424
+ "$rvm_path/scripts/log" "error" \
425
+ "There has been an error while trying to fetch the source. Halting the installation."
422
426
  return $result
423
427
  fi
424
428
 
425
429
  rm -rf "$rvm_ruby_src_path"
426
430
 
427
- __rvm_run "extract" "gunzip < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C $rvm_src_path" "#extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
428
-
431
+ __rvm_run "extract" "gunzip < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C $rvm_src_path" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
429
432
  result=$?
430
433
 
431
434
  if [[ "$result" -gt 0 ]] ; then
432
- "$rvm_scripts_path/log" "error" \
433
- "There has been an error while trying to extract the source. Aborting the installation."
435
+ "$rvm_path/scripts/log" "error" \
436
+ "There has been an error while trying to extract the source. Halting the installation."
434
437
  return $result
435
438
  fi
436
439
 
@@ -456,17 +459,17 @@ RubyWrapper
456
459
  result=$?
457
460
 
458
461
  if [[ "$result" -gt 0 ]] ; then
459
- "$rvm_scripts_path/log" "error" \
460
- "There has been an error while trying to apply patches to ree. Aborting the installation."
462
+ "$rvm_path/scripts/log" "error" \
463
+ "There has been an error while trying to apply patches to ree. Halting the installation."
461
464
  return $result
462
465
  fi
463
466
 
464
- __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_configure_flags" "#installing $rvm_ruby_string"
467
+ __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_configure_flags" "$rvm_ruby_string - #installing "
465
468
  result=$?
466
469
 
467
470
  if [[ "$result" -gt 0 ]] ; then
468
- "$rvm_scripts_path/log" "error" \
469
- "There has been an error while trying to run the ree installer. Aborting the installation."
471
+ "$rvm_path/scripts/log" "error" \
472
+ "There has been an error while trying to run the ree installer. Halting the installation."
470
473
  return $result
471
474
  fi
472
475
 
@@ -481,7 +484,7 @@ RubyWrapper
481
484
  __rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_repo_url" "rvm_ruby_url"
482
485
 
483
486
  if [[ -z "$rvm_ruby_url" ]] ; then
484
- "$rvm_scripts_path/log" "fail" "rvm does not know the rvm repo url for '${rvm_ruby_interpreter}_${rvm_ruby_version}'"
487
+ "$rvm_path/scripts/log" "fail" "rvm does not know the rvm repo url for '${rvm_ruby_interpreter}_${rvm_ruby_version}'"
485
488
  result=1
486
489
 
487
490
  else
@@ -494,7 +497,7 @@ RubyWrapper
494
497
 
495
498
  rbx|rubinius)
496
499
 
497
- "$rvm_scripts_path/log" "info" "#dependency installation"
500
+ "$rvm_path/scripts/log" "info" "$rvm_ruby_string installing #dependencies "
498
501
 
499
502
  # Ensure we have a 1.8.7 compatible ruby installed.
500
503
  __rvm_ensure_has_18_compat_ruby || return 1
@@ -512,14 +515,14 @@ RubyWrapper
512
515
 
513
516
  if [[ -n "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ $rvm_head_flag -eq 0 ]] ; then
514
517
 
515
- "$rvm_scripts_path/log" "info" "#downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
518
+ "$rvm_path/scripts/log" "info" "$rvm_ruby_string #downloading ($rvm_ruby_package_file), this may take a while depending on your connection..."
516
519
 
517
- "$rvm_scripts_path/fetch" "$rvm_ruby_url"
520
+ "$rvm_path/scripts/fetch" "$rvm_ruby_url"
518
521
  result=$?
519
522
 
520
523
  if [[ "$result" -gt 0 ]] ; then
521
- "$rvm_scripts_path/log" "error" \
522
- "There has been an error while trying to fetch the source. Aborting the installation."
524
+ "$rvm_path/scripts/log" "error" \
525
+ "There has been an error while trying to fetch the source. Halting the installation."
523
526
  return $result
524
527
  fi
525
528
  __rvm_run "extract" \
@@ -527,8 +530,8 @@ RubyWrapper
527
530
  result=$?
528
531
 
529
532
  if [[ "$result" -gt 0 ]] ; then
530
- "$rvm_scripts_path/log" "error" \
531
- "There has been an error while trying to extract the source. Aborting the installation."
533
+ "$rvm_path/scripts/log" "error" \
534
+ "There has been an error while trying to extract the source. Halting the installation."
532
535
  return $result
533
536
  fi
534
537
 
@@ -543,8 +546,8 @@ RubyWrapper
543
546
  result=$?
544
547
 
545
548
  if [[ "$result" -gt 0 ]] ; then
546
- "$rvm_scripts_path/log" "error" \
547
- "There has been an error while fetching the rbx git repo. Aborting the installation."
549
+ "$rvm_path/scripts/log" "error" \
550
+ "There has been an error while fetching the rbx git repo. Halting the installation."
548
551
  return $result
549
552
  fi
550
553
  fi
@@ -557,8 +560,8 @@ RubyWrapper
557
560
  result=$?
558
561
 
559
562
  if [[ "$result" -gt 0 ]] ; then
560
- "$rvm_scripts_path/log" "error" \
561
- "There has been an error while trying to apply patches to rubinius. Aborting the installation."
563
+ "$rvm_path/scripts/log" "error" \
564
+ "There has been an error while trying to apply patches to rubinius. Halting the installation."
562
565
  return $result
563
566
  fi
564
567
 
@@ -583,8 +586,8 @@ RubyWrapper
583
586
  result=$?
584
587
 
585
588
  if [[ "$result" -gt 0 ]] ; then
586
- "$rvm_scripts_path/log" "error" \
587
- "There has been an error while running '$rvm_ruby_configure'. Aborting the installation."
589
+ "$rvm_path/scripts/log" "error" \
590
+ "There has been an error while running '$rvm_ruby_configure'. Halting the installation."
588
591
  return $result
589
592
  fi
590
593
 
@@ -598,8 +601,8 @@ RubyWrapper
598
601
  result=$?
599
602
 
600
603
  if [[ "$result" -gt 0 ]] ; then
601
- "$rvm_scripts_path/log" "error" \
602
- "There has been an error while running '$rvm_ruby_configure'. Aborting the installation."
604
+ "$rvm_path/scripts/log" "error" \
605
+ "There has been an error while running '$rvm_ruby_configure'. Halting the installation."
603
606
  return $result
604
607
  fi ; unset ruby
605
608
 
@@ -651,15 +654,15 @@ RubyWrapper
651
654
  result=$?
652
655
 
653
656
  if [[ "$result" -gt 0 ]] ; then
654
- "$rvm_scripts_path/log" "error" \
655
- "There has been an error while trying to fetch the source. Aborting the installation."
657
+ "$rvm_path/scripts/log" "error" \
658
+ "There has been an error while trying to fetch the source. Halting the installation."
656
659
  return $result
657
660
  fi
658
661
 
659
662
  builtin cd "$rvm_ruby_src_path"
660
663
 
661
664
  if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
662
- __rvm_run "ant.dist" "ant dist" "#ant dist"
665
+ __rvm_run "ant.dist" "ant dist" "$rvm_ruby_string - #ant dist"
663
666
  fi
664
667
 
665
668
  mkdir -p "$rvm_ruby_home/bin/"
@@ -681,7 +684,7 @@ RubyWrapper
681
684
 
682
685
  rm -rf "$rvm_ruby_home"
683
686
 
684
- __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "#installing JRuby to $rvm_ruby_home"
687
+ __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "$rvm_ruby_string - #installing to $rvm_ruby_home"
685
688
 
686
689
  (
687
690
  builtin cd "$rvm_ruby_home/bin/"
@@ -715,7 +718,7 @@ RubyWrapper
715
718
  # jruby ships with some built in gems, copy them in to place.
716
719
  if [[ -d "$rvm_ruby_home/lib/ruby/gems/1.8" ]]; then
717
720
 
718
- "$rvm_scripts_path/log" "info" "Copying across included gems"
721
+ "$rvm_path/scripts/log" "info" "Copying across included gems"
719
722
 
720
723
  cp -R "$rvm_ruby_home/lib/ruby/gems/1.8/" "$GEM_HOME/"
721
724
  fi
@@ -724,14 +727,15 @@ RubyWrapper
724
727
  maglev)
725
728
  __rvm_ensure_has_18_compat_ruby
726
729
 
727
- "$rvm_scripts_path/log" "info" "Running MagLev prereqs checking script."
730
+ "$rvm_path/scripts/log" "info" \
731
+ "Running MagLev prereqs checking script."
728
732
 
729
- "$rvm_scripts_path/maglev"
733
+ "$rvm_path/scripts/maglev"
730
734
  result=$?
731
735
 
732
736
  if [[ "$result" -gt 0 ]] ; then
733
- "$rvm_scripts_path/log" "error" \
734
- "Prerequisite checks have failed. Aborting the installation."
737
+ "$rvm_path/scripts/log" "error" \
738
+ "Prerequisite checks have failed. Halting the installation."
735
739
  return $result
736
740
  fi
737
741
 
@@ -745,8 +749,8 @@ RubyWrapper
745
749
  result=$?
746
750
 
747
751
  if [[ "$result" -gt 0 ]] ; then
748
- "$rvm_scripts_path/log" "error" \
749
- "There has been an error while trying to fetch the source. Aborting the installation."
752
+ "$rvm_path/scripts/log" "error" \
753
+ "There has been an error while trying to fetch the source. Halting the installation."
750
754
  return $result
751
755
  fi
752
756
  fi
@@ -760,14 +764,14 @@ RubyWrapper
760
764
  rvm_gemstone_url="${rvm_gemstone_url:-"$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"}"
761
765
  fi
762
766
 
763
- "$rvm_scripts_path/log" "info" "Downloading the GemStone package, this may take a while depending on your connection..."
767
+ "$rvm_path/scripts/log" "info" "Downloading the GemStone package, this may take a while depending on your connection..."
764
768
 
765
- "$rvm_scripts_path/fetch" "$rvm_gemstone_url"
769
+ "$rvm_path/scripts/fetch" "$rvm_gemstone_url"
766
770
  result=$?
767
771
 
768
772
  if [[ "$result" -gt 0 ]] ; then
769
- "$rvm_scripts_path/log" "error" \
770
- "There has been an error while trying to fetch the GemStone package. Aborting the installation."
773
+ "$rvm_path/scripts/log" "error" \
774
+ "There has been an error while trying to fetch the GemStone package. Halting the installation."
771
775
  return $result
772
776
  fi
773
777
 
@@ -783,8 +787,8 @@ RubyWrapper
783
787
  result=$?
784
788
 
785
789
  if [[ "$result" -gt 0 ]] ; then
786
- "$rvm_scripts_path/log" "error" \
787
- "There has been an error while trying to extract the GemStone package. Aborting the installation."
790
+ "$rvm_path/scripts/log" "error" \
791
+ "There has been an error while trying to extract the GemStone package. Halting the installation."
788
792
  return $result
789
793
  fi
790
794
 
@@ -802,20 +806,30 @@ RubyWrapper
802
806
 
803
807
  (
804
808
  builtin cd "$rvm_ruby_home/bin/"
809
+
805
810
  for binary in maglev-irb maglev-ruby maglev-gem ; do
811
+
806
812
  ln -nfs "$binary" "${binary#maglev-}"
813
+
807
814
  done ; unset binary
808
815
  )
809
816
 
810
817
  binaries=(maglev-ruby maglev-irb maglev-gem)
818
+
811
819
  for binary in "${binaries[@]}" ; do
820
+
812
821
  __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
822
+
813
823
  done
814
824
 
815
825
  builtin cd "$rvm_ruby_home"
826
+
816
827
  if [[ $rvm_head_flag -eq 1 ]] ; then
828
+
817
829
  git submodule update --init
830
+
818
831
  "$rvm_ruby_home/bin/maglev" force-reload
832
+
819
833
  ln -sf maglev.demo.key-$(uname -sm | \tr ' ' '-') etc/maglev.demo.key
820
834
  fi
821
835
 
@@ -824,14 +838,14 @@ RubyWrapper
824
838
  compatible_ruby="$(__rvm_18_compat_ruby)"
825
839
 
826
840
  if [[ ! -e ${rvm_ruby_home}/etc/conf.d/maglev.conf ]] ; then
827
- "$rvm_scripts_path/log" "info" "Creating default 'maglev' repository."
841
+ "$rvm_path/scripts/log" "info" "Creating default 'maglev' repository."
828
842
  "$rvm_wrappers_path/$compatible_ruby/rake" "stone:create[maglev]" >/dev/null 2>&1
829
843
  fi
830
844
 
831
- "$rvm_scripts_path/log" "info" "Generating maglev HTML documentation"
845
+ "$rvm_path/scripts/log" "info" "Generating maglev HTML documentation"
832
846
  "$rvm_wrappers_path/$compatible_ruby/rake" rdoc >/dev/null 2>&1
833
847
 
834
- "$rvm_scripts_path/log" "info" "Generating smalltalk FFI."
848
+ "$rvm_path/scripts/log" "info" "Generating smalltalk FFI."
835
849
  "$rvm_wrappers_path/$compatible_ruby/rake" stwrappers >/dev/null 2>&1
836
850
 
837
851
  unset compatible_ruby
@@ -854,7 +868,7 @@ RubyWrapper
854
868
 
855
869
  mono_version="$(mono -V | head -n 1 | cut -d ' ' -f5)"
856
870
 
857
- if "$rvm_scripts_path/match" "$mono_version" "([0-9]+)\.([0-9]+)\.?([0-9]+)?" ; then
871
+ if "$rvm_path/scripts/match" "$mono_version" "([0-9]+)\.([0-9]+)\.?([0-9]+)?" ; then
858
872
 
859
873
  mono_major_ver="$(echo "$mono_version" | cut -d '.' -f1)"
860
874
 
@@ -896,17 +910,17 @@ RubyWrapper
896
910
  cp -r "$rvm_ruby_src_path/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby"/* "$rvm_ruby_home/lib/ruby"
897
911
  cp -r "$rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Libs"/* "$rvm_ruby_home/lib/IronRuby"
898
912
  else
899
- "$rvm_scripts_path/log" "info" "Retrieving IronRuby"
913
+ "$rvm_path/scripts/log" "info" "Retrieving IronRuby"
900
914
 
901
- "$rvm_scripts_path/fetch" "$rvm_ruby_url" "$rvm_ruby_package_file"
915
+ "$rvm_path/scripts/fetch" "$rvm_ruby_url" "$rvm_ruby_package_file"
902
916
  result=$? ; if [[ "$result" -gt 0 ]] ; then
903
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
917
+ "$rvm_path/scripts/log" "error" "There has been an error while trying to fetch the source. Halting the installation." ; return $result
904
918
  fi
905
919
 
906
920
  mkdir -p "$rvm_ruby_src_path" "$rvm_ruby_home"
907
921
  unzip -o -d "${rvm_ruby_src_path}" "${rvm_archives_path}/${rvm_ruby_package_file}" >> "$rvm_ruby_log_path/extract.log" 2>> "$rvm_ruby_log_path/extract.error.log"
908
922
  result=$? ; if [[ "$result" -gt 1 ]] ; then
909
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation." ; return $result
923
+ "$rvm_path/scripts/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Halting the installation." ; return $result
910
924
  fi
911
925
 
912
926
  for dir in bin lib silverlight ; do
@@ -915,20 +929,31 @@ RubyWrapper
915
929
  fi
916
930
 
917
931
  binaries=(gem irb rdoc rake ri ruby)
932
+
918
933
  for binary_name in "${binaries[@]}" ; do
934
+
919
935
  if [[ -s "$rvm_ruby_home/bin/$binary_name" ]] ; then
936
+
920
937
  tr -d '\r' < "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
938
+
921
939
  #sed -e '1,1s=.*=#!'"/usr/bin/env ir=" "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
922
940
  mv -f "$rvm_ruby_home/bin/$binary_name.new" "$rvm_ruby_home/bin/$binary_name"
941
+
923
942
  chmod +x "$rvm_ruby_home/bin/$binary_name"
943
+
924
944
  fi
925
- done
945
+ done ; unset binaries
926
946
 
927
947
  sed -e '1,1s=.*=#!'"/usr/bin/env bash=" "$rvm_ruby_home/bin/ir" | \tr -d '\r' > "$rvm_ruby_home/bin/ir.new"
948
+
928
949
  mv -f "$rvm_ruby_home/bin/ir.new" "$rvm_ruby_home/bin/ir"
950
+
929
951
  chmod +x "$rvm_ruby_home/bin/ir"
952
+
930
953
  ln -fs "$rvm_ruby_home/bin/ir" "$rvm_ruby_home/bin/ruby"
954
+
931
955
  builtin hash -r
956
+
932
957
  __rvm_run "gems.install" "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_home/bin/gem install --no-rdoc --no-ri rake $rvm_gem_options" "Installing $rvm_gem_name to $dir"
933
958
  ;;
934
959
 
@@ -952,8 +977,8 @@ RubyWrapper
952
977
  result=$?
953
978
 
954
979
  if [[ "$result" -gt 0 ]] ; then
955
- "$rvm_scripts_path/log" "error" \
956
- "There has been an error while trying to apply patches to mput. Aborting the installation."
980
+ "$rvm_path/scripts/log" "error" \
981
+ "There has been an error while trying to apply patches to mput. Halting the installation."
957
982
  return $result
958
983
  fi
959
984
 
@@ -964,8 +989,8 @@ RubyWrapper
964
989
  __rvm_run "autoconf" "autoconf" "Running autoconf"
965
990
 
966
991
  else
967
- "$rvm_scripts_path/log" "fail" \
968
- "rvm expects autoconf to install this ruby interpreter, autoconf was not found in PATH. Aborting installation."
992
+ "$rvm_path/scripts/log" "fail" \
993
+ "rvm expects autoconf to install this ruby interpreter, autoconf was not found in PATH. Halting installation."
969
994
  return $result
970
995
  fi
971
996
  fi
@@ -973,7 +998,7 @@ RubyWrapper
973
998
  if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
974
999
 
975
1000
  if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
976
- "$rvm_scripts_path/log" "debug" "Skipping configure step, Makefile exists so configure must have already been run."
1001
+ "$rvm_path/scripts/log" "debug" "Skipping configure step, Makefile exists so configure must have already been run."
977
1002
  fi
978
1003
 
979
1004
  elif [[ -n "$rvm_ruby_configure" ]] ; then
@@ -982,8 +1007,8 @@ RubyWrapper
982
1007
  result=$?
983
1008
 
984
1009
  if [[ "$result" -gt 0 ]] ; then
985
- "$rvm_scripts_path/log" "error" \
986
- "There has been an error while trying to configure the source. Aborting the installation."
1010
+ "$rvm_path/scripts/log" "error" \
1011
+ "There has been an error while trying to configure the source. Halting the installation."
987
1012
  return $result
988
1013
  fi
989
1014
 
@@ -994,13 +1019,13 @@ RubyWrapper
994
1019
  result=$?
995
1020
 
996
1021
  if [[ "$result" -gt 0 ]] ; then
997
- "$rvm_scripts_path/log" "error" \
998
- "There has been an error while trying to configure the source. Aborting the installation."
1022
+ "$rvm_path/scripts/log" "error" \
1023
+ "There has been an error while trying to configure the source. Halting the installation."
999
1024
  return $result
1000
1025
  fi
1001
1026
 
1002
1027
  else
1003
- "$rvm_scripts_path/log" "error" \
1028
+ "$rvm_path/scripts/log" "error" \
1004
1029
  "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
1005
1030
  fi
1006
1031
 
@@ -1010,8 +1035,8 @@ RubyWrapper
1010
1035
  result=$?
1011
1036
 
1012
1037
  if [[ "$result" -gt 0 ]] ; then
1013
- "$rvm_scripts_path/log" "error" \
1014
- "There has been an error while trying to run make. Aborting the installation."
1038
+ "$rvm_path/scripts/log" "error" \
1039
+ "There has been an error while trying to run make. Halting the installation."
1015
1040
  return $result
1016
1041
  fi
1017
1042
 
@@ -1021,12 +1046,12 @@ RubyWrapper
1021
1046
  result=$?
1022
1047
 
1023
1048
  if [[ "$result" -gt 0 ]] ; then
1024
- "$rvm_scripts_path/log" "error" \
1025
- "There has been an error while trying to run make install. Aborting the installation."
1049
+ "$rvm_path/scripts/log" "error" \
1050
+ "There has been an error while trying to run make install. Halting the installation."
1026
1051
  return $result
1027
1052
  fi
1028
1053
 
1029
- "$rvm_scripts_path/log" "info" "Installation of $rvm_ruby_string is complete."
1054
+ "$rvm_path/scripts/log" "info" "Installation of $rvm_ruby_string is complete."
1030
1055
 
1031
1056
  export GEM_HOME="$rvm_ruby_gem_home"
1032
1057
  export GEM_PATH="$rvm_ruby_gem_path"
@@ -1053,14 +1078,16 @@ RubyWrapper
1053
1078
  ;;
1054
1079
 
1055
1080
  default)
1056
- "$rvm_scripts_path/log" "fail" "must specify a ruby interpreter to install."
1081
+ "$rvm_path/scripts/log" "fail" \
1082
+ "a ruby interpreter to install must be specified and not simply 'default'."
1057
1083
  ;;
1058
1084
 
1059
- *) "$rvm_scripts_path/log" "fail" "Ruby interpreter '$rvm_ruby_interpreter' is not known."
1085
+ *) "$rvm_path/scripts/log" "fail" \
1086
+ "Ruby interpreter '$rvm_ruby_interpreter' is not known."
1060
1087
 
1061
1088
  esac
1062
1089
 
1063
- rvm_hook="after_install" ; source "$rvm_scripts_path/hook"
1090
+ rvm_hook="after_install" ; source "$rvm_path/scripts/hook"
1064
1091
 
1065
1092
  if [[ -n "$ruby_options" ]] ; then
1066
1093
  RUBYOPT="$ruby_options"
@@ -1085,7 +1112,7 @@ __rvm_fetch_from_github() {
1085
1112
  if [[ "$result" -gt 0 ]] ; then
1086
1113
  rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/http:}"
1087
1114
 
1088
- "$rvm_scripts_path/log" "info" "Could not fetch $rvm_ruby_repo_url - trying $rvm_ruby_repo_http_url"
1115
+ "$rvm_path/scripts/log" "info" "Could not fetch $rvm_ruby_repo_url - trying $rvm_ruby_repo_http_url"
1089
1116
 
1090
1117
  __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_http_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_http_url"
1091
1118
  fi
@@ -1105,7 +1132,7 @@ __rvm_fetch_from_github() {
1105
1132
  __rvm_fetch_ruby() {
1106
1133
  [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] && __rvm_select
1107
1134
 
1108
- "$rvm_scripts_path/log" "info" "#fetching ${rvm_ruby_string}"
1135
+ "$rvm_path/scripts/log" "info" "$rvm_ruby_string - #fetching "
1109
1136
 
1110
1137
  if [[ ${rvm_head_flag:-0} -eq 0 && -z "${rvm_ruby_tag:-""}" && -z "${rvm_ruby_revision:-""}" ]] ; then
1111
1138
 
@@ -1139,14 +1166,15 @@ __rvm_fetch_ruby() {
1139
1166
  ;;
1140
1167
  esac
1141
1168
 
1142
- "$rvm_scripts_path/log" "info" "#downloading ${rvm_ruby_package_file}, this may take a while depending on your connection..."
1169
+ "$rvm_path/scripts/log" "info" \
1170
+ "$rvm_ruby_string - #downloading ${rvm_ruby_package_file}, this may take a while depending on your connection..."
1143
1171
 
1144
- "$rvm_scripts_path/fetch" "${rvm_ruby_url}"
1172
+ "$rvm_path/scripts/fetch" "${rvm_ruby_url}"
1145
1173
  result=$?
1146
1174
 
1147
1175
  if [[ "$result" -gt 0 ]] ; then
1148
- "$rvm_scripts_path/log" "error" \
1149
- "There has been an error while trying to fetch the source. Aborting the installation."
1176
+ "$rvm_path/scripts/log" "error" \
1177
+ "There has been an error while trying to fetch the source. Halting the installation."
1150
1178
  return $result
1151
1179
  fi
1152
1180
  fi
@@ -1161,11 +1189,13 @@ __rvm_fetch_ruby() {
1161
1189
 
1162
1190
  case "$rvm_archive_extension" in
1163
1191
  tar.gz|tgz)
1164
- __rvm_run "extract" "gunzip < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "#extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
1192
+ __rvm_run "extract" "gunzip < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
1165
1193
  result=$?
1166
1194
 
1167
1195
  if [[ "$result" -gt 0 ]] ; then
1168
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; return $result
1196
+ "$rvm_path/scripts/log" "error" \
1197
+ "There has been an error while trying to extract the source. Halting the installation."
1198
+ return $result
1169
1199
  fi
1170
1200
  ;;
1171
1201
  zip)
@@ -1173,21 +1203,24 @@ __rvm_fetch_ruby() {
1173
1203
  result=$?
1174
1204
 
1175
1205
  if [[ "$result" -gt 0 ]] ; then
1176
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation."
1206
+ "$rvm_path/scripts/log" "error" \
1207
+ "There has been an error while trying to extract $rvm_ruby_package_file. Halting the installation."
1177
1208
  return $result
1178
1209
  fi
1179
1210
  ;;
1180
1211
  tar.bz2)
1181
- __rvm_run "extract" "bunzip2 < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "#extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
1212
+ __rvm_run "extract" "bunzip2 < \"$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension\" | tar xf - -C /tmp/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to $rvm_ruby_src_path"
1182
1213
  result=$?
1183
1214
 
1184
1215
  if [[ "$result" -gt 0 ]] ; then
1185
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation."
1216
+ "$rvm_path/scripts/log" "error" \
1217
+ "There has been an error while trying to extract the source. Halting the installation."
1186
1218
  return $result
1187
1219
  fi
1188
1220
  ;;
1189
1221
  *)
1190
- "$rvm_scripts_path/log" "error" "Unknown archive format extension '$rvm_archive_extension'. Aborting the installation."
1222
+ "$rvm_path/scripts/log" "error" \
1223
+ "Unknown archive format extension '$rvm_archive_extension'. Halting the installation."
1191
1224
  return 1
1192
1225
  ;;
1193
1226
  esac
@@ -1198,10 +1231,14 @@ __rvm_fetch_ruby() {
1198
1231
  mv "$rvm_src_path/$(echo "$rvm_ruby_string" | sed -e 's/-n.*//')" "$rvm_ruby_src_path"
1199
1232
  fi
1200
1233
 
1234
+ "$rvm_ruby_string - #extracted to $rvm_ruby_src_path"
1235
+
1201
1236
  else
1202
- "$rvm_scripts_path/log" "info" "#extracting $rvm_ruby_string to $rvm_ruby_src_path (already extracted)" ; return 0
1237
+ "$rvm_path/scripts/log" "info" \
1238
+ "$rvm_ruby_string - #extracted to $rvm_ruby_src_path (already extracted)"
1203
1239
  fi
1204
1240
 
1241
+ return 0
1205
1242
  else
1206
1243
 
1207
1244
  mkdir -p "$rvm_repo_path"
@@ -1214,15 +1251,16 @@ __rvm_fetch_ruby() {
1214
1251
 
1215
1252
  if [[ -z "$rvm_ruby_revision" ]] ; then
1216
1253
 
1217
- "$rvm_scripts_path/log" "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
1254
+ "$rvm_path/scripts/log" "info" \
1255
+ "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
1218
1256
 
1219
1257
  git pull origin master --force
1220
1258
 
1221
1259
  result=$?
1222
1260
 
1223
1261
  if [[ "$result" -gt 0 ]] ; then
1224
- "$rvm_scripts_path/log" "error" \
1225
- "There has been an error while trying to update the source from the remote repository. Aborting the installation."
1262
+ "$rvm_path/scripts/log" "error" \
1263
+ "There has been an error while trying to update the source from the remote repository. Halting the installation."
1226
1264
  return $result
1227
1265
  fi
1228
1266
 
@@ -1235,8 +1273,8 @@ __rvm_fetch_ruby() {
1235
1273
  result=$?
1236
1274
 
1237
1275
  if [[ "$result" -gt 0 ]] ; then
1238
- "$rvm_scripts_path/log" "error" \
1239
- "There has been an error while trying to checkout the source branch. Aborting the installation."
1276
+ "$rvm_path/scripts/log" "error" \
1277
+ "There has been an error while trying to checkout the source branch. Halting the installation."
1240
1278
  return $result
1241
1279
  fi
1242
1280
  fi
@@ -1246,21 +1284,21 @@ __rvm_fetch_ruby() {
1246
1284
 
1247
1285
  rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/http:/}"
1248
1286
 
1249
- "$rvm_scripts_path/log" "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
1287
+ "$rvm_path/scripts/log" "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
1250
1288
 
1251
1289
  git clone --depth 1 "$rvm_ruby_repo_url" "$rvm_ruby_repo_path"
1252
1290
  result=$?
1253
1291
 
1254
1292
  if [[ "$result" -gt 0 ]] ; then
1255
- "$rvm_scripts_path/log" "info" \
1293
+ "$rvm_path/scripts/log" "info" \
1256
1294
  "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..."
1257
1295
 
1258
1296
  git clone "$rvm_ruby_repo_http_url" "$rvm_ruby_repo_path"
1259
1297
  result=$?
1260
1298
 
1261
1299
  if [[ "$result" -gt 0 ]] ; then
1262
- "$rvm_scripts_path/log" "error" \
1263
- "There has been an error while trying to fetch the repository. Aborting the installation."
1300
+ "$rvm_path/scripts/log" "error" \
1301
+ "There has been an error while trying to fetch the repository. Halting the installation."
1264
1302
  return $result
1265
1303
  fi
1266
1304
  fi
@@ -1300,14 +1338,14 @@ __rvm_fetch_ruby() {
1300
1338
 
1301
1339
  builtin cd "$rvm_ruby_repo_path"
1302
1340
 
1303
- "$rvm_scripts_path/log" "info" "Updating ruby from $rvm_ruby_url"
1341
+ "$rvm_path/scripts/log" "info" "Updating ruby from $rvm_ruby_url"
1304
1342
 
1305
1343
  __rvm_run "svn.switch" "svn switch $rvm_ruby_url"
1306
1344
 
1307
1345
  __rvm_run "svn.update" "svn update"
1308
1346
 
1309
1347
  if [[ -n "${rvm_rev:-""}" ]] ; then
1310
- "$rvm_scripts_path/log" "info" "Checking out revision ${rvm_rev/-r/-r } from $rvm_ruby_url"
1348
+ "$rvm_path/scripts/log" "info" "Checking out revision ${rvm_rev/-r/-r } from $rvm_ruby_url"
1311
1349
 
1312
1350
  __rvm_run "svn.checkout" "svn update -q ${rvm_rev/-r/-r }"
1313
1351
  fi
@@ -1319,13 +1357,13 @@ __rvm_fetch_ruby() {
1319
1357
  result=$?
1320
1358
 
1321
1359
  if [[ "$result" -gt 0 ]] ; then
1322
- "$rvm_scripts_path/log" "error" \
1323
- "There has been an error while trying to fetch / update the source. Aborting the installation."
1360
+ "$rvm_path/scripts/log" "error" \
1361
+ "There has been an error while trying to fetch / update the source. Halting the installation."
1324
1362
  return $result
1325
1363
  fi
1326
1364
  fi
1327
1365
 
1328
- "$rvm_scripts_path/log" "info" "Copying from repo to src path..."
1366
+ "$rvm_path/scripts/log" "info" "Copying from repo to src path..."
1329
1367
 
1330
1368
  rm -rf "$rvm_ruby_src_path"
1331
1369
 
@@ -1340,7 +1378,7 @@ __rvm_check_default() {
1340
1378
  local current_ruby_interpreter="$(echo "$rvm_ruby_string" | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
1341
1379
 
1342
1380
  if [[ -n "$current_ruby_interpreter" && "$current_ruby_interpreter" = "$default_ruby_interpreter" ]]; then
1343
- __rvm_run_with_env 'default.restore' 'system' 'rvm use system --default' 'Removing default ruby interpreter'
1381
+ __rvm_run_with_env 'default.restore' 'system' 'rvm use system --default' 'Removing default ruby interpreter'
1344
1382
  fi
1345
1383
  }
1346
1384
 
@@ -1352,11 +1390,12 @@ __rvm_uninstall_ruby() {
1352
1390
 
1353
1391
  for dir in "$rvm_rubies_path" ; do
1354
1392
  if [[ -d "$dir/$rvm_ruby_string" ]] ; then
1355
- "$rvm_scripts_path/log" "info" "Removing $dir/$rvm_ruby_string..."
1393
+ "$rvm_path/scripts/log" "info" "Removing $dir/$rvm_ruby_string..."
1356
1394
 
1357
1395
  rm -rf $dir/$rvm_ruby_string
1358
1396
  else
1359
- "$rvm_scripts_path/log" "info" "$dir/$rvm_ruby_string has already been removed."
1397
+ "$rvm_path/scripts/log" "info" \
1398
+ "$dir/$rvm_ruby_string has already been removed."
1360
1399
  fi
1361
1400
 
1362
1401
  if [[ -e "$rvm_bin_path/$rvm_ruby_string" ]] ; then
@@ -1371,7 +1410,8 @@ __rvm_uninstall_ruby() {
1371
1410
  __rvm_check_default
1372
1411
 
1373
1412
  else
1374
- "$rvm_scripts_path/log" "fail" "Cannot uninstall unknown package '$rvm_ruby_string'"
1413
+ "$rvm_path/scripts/log" "fail" \
1414
+ "Cannot uninstall unknown package '$rvm_ruby_string'"
1375
1415
  fi
1376
1416
 
1377
1417
  unset rvm_uninstall_flag
@@ -1387,11 +1427,11 @@ __rvm_remove_ruby() {
1387
1427
  for dir in $rvm_src_path $rvm_rubies_path ; do
1388
1428
 
1389
1429
  if [[ -d $dir/$rvm_ruby_string ]] ; then
1390
- "$rvm_scripts_path/log" "info" "Removing $dir/$rvm_ruby_string..."
1430
+ "$rvm_path/scripts/log" "info" "Removing $dir/$rvm_ruby_string..."
1391
1431
  rm -rf $dir/$rvm_ruby_string
1392
1432
 
1393
1433
  else
1394
- "$rvm_scripts_path/log" "info" "it seems that $dir/$rvm_ruby_string is already non existent."
1434
+ "$rvm_path/scripts/log" "info" "it seems that $dir/$rvm_ruby_string is already non existent."
1395
1435
  fi
1396
1436
 
1397
1437
  if [[ -e "$rvm_bin_path/$rvm_ruby_string" ]] ; then
@@ -1410,17 +1450,17 @@ __rvm_remove_ruby() {
1410
1450
  __rvm_remove_environments
1411
1451
  __rvm_remove_binaries
1412
1452
  else
1413
- "$rvm_scripts_path/log" "fail" "Cannot remove unknown package '$rvm_ruby_string'"
1453
+ "$rvm_path/scripts/log" "fail" "Cannot remove unknown package '$rvm_ruby_string'"
1414
1454
  fi ; unset rvm_remove_flag
1415
1455
  }
1416
1456
 
1417
1457
  __rvm_remove_gemsets() {
1418
1458
  if [[ ${rvm_gems_flag:-0} -eq 1 ]] ; then
1419
- "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string gemsets..."
1459
+ "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string gemsets..."
1420
1460
 
1421
- gemsets="$rvm_gems_path/$rvm_ruby_string $(builtin cd "${rvm_gems_path}"/ ; find * -type d -maxdepth 0 | awk '/'$rvm_ruby_string'@/')"
1461
+ gemsets=($(builtin cd "${rvm_gems_path}"/ ; find . -maxdepth 1 -mindepth 1 -type d))
1422
1462
 
1423
- for gemset in $gemsets ; do
1463
+ for gemset in "${gemsets[@]//.\/}" ; do
1424
1464
  if [[ -d "$gemset" ]] ; then
1425
1465
  rm -rf "$gemset"
1426
1466
  fi
@@ -1429,13 +1469,13 @@ __rvm_remove_gemsets() {
1429
1469
  }
1430
1470
 
1431
1471
  __rvm_remove_wrappers() {
1432
- "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string wrappers..."
1472
+ "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string wrappers..."
1433
1473
 
1434
- local wrappers wrapper
1474
+ local wrapper wrappers
1435
1475
 
1436
- wrappers="$rvm_wrappers_path/$rvm_ruby_string $(builtin cd "$rvm_wrappers_path"/ ; find * -type f -maxdepth 0 2>/dev/null | awk '/'$rvm_ruby_string'@/')"
1476
+ wrappers=($(find "$rvm_path/wrappers" -maxdepth 1 -mindepth 1 -type d -iname "*$rvm_ruby_string*" 2>/dev/null))
1437
1477
 
1438
- for wrapper in $wrappers ; do
1478
+ for wrapper in "${wrappers[@]}" ; do
1439
1479
  rm -rf "$wrapper"
1440
1480
  done
1441
1481
 
@@ -1443,68 +1483,86 @@ __rvm_remove_wrappers() {
1443
1483
  }
1444
1484
 
1445
1485
  __rvm_remove_environments() {
1446
- "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string environments..."
1486
+ "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string environments..."
1447
1487
 
1448
1488
  local environments environment
1449
1489
 
1450
- environments="$rvm_environments_path/$rvm_ruby_string $(builtin cd "$rvm_environments_path"/ ; find * -type f -maxdepth 0 | awk '/'$rvm_ruby_string'@/')"
1490
+ environments=($(find "$rvm_environments_path" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1451
1491
 
1452
- for environment in $environments ; do
1453
- rm -rf "$environment"
1492
+ for environment in "${environments[@]}" ; do
1493
+ if [[ -d "$environment" ]] ; then
1494
+ rm -rf "$environment"
1495
+ fi
1454
1496
  done
1455
1497
 
1456
1498
  return 0
1457
1499
  }
1458
1500
 
1459
1501
  __rvm_remove_aliases() {
1460
- "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string aliases..."
1502
+ "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string aliases..."
1461
1503
 
1462
1504
  local alias_name aliases
1463
1505
 
1464
- aliases=$(awk '/'$rvm_ruby_string'/' $rvm_config_path/alias | sed 's/=.*//')
1506
+ aliases=($(awk '/'$rvm_ruby_string'/' $rvm_config_path/alias | sed 's/=.*//'))
1465
1507
 
1466
- for alias_name in $aliases ; do
1508
+ for alias_name in "${aliases[@]}" ; do
1467
1509
  # Remove from alias key-value store
1468
- "$rvm_scripts_path/alias" delete "$alias_name" >/dev/null 2>&1
1510
+ "$rvm_path/scripts/alias" delete "$alias_name" >/dev/null 2>&1
1469
1511
  done
1470
1512
  }
1471
1513
 
1472
1514
  __rvm_remove_archives() {
1473
1515
  if [[ ${rvm_archive_flag:-0} -eq 1 ]] ; then
1474
- "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string archives..."
1516
+
1517
+ "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string archives..."
1518
+
1475
1519
  rm -f "$rvm_archives_path/${rvm_ruby_package_file}.${rvm_archive_extension}"
1476
1520
  fi
1477
1521
  }
1478
1522
 
1479
1523
  __rvm_remove_binaries() {
1480
- "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string binaries..."
1524
+ "$rvm_path/scripts/log" "info" "Removing $rvm_ruby_string binaries..."
1481
1525
 
1482
1526
  # Iterate over all binaries and check for symlinked wrappers etc.
1483
- local binary_name
1527
+ local binary_name binaries full_patch_path
1528
+
1529
+ binaries=($(find "$rvm_bin_path" -maxdepth 1 -mindepth 1 -type f -iname "*$rvm_ruby_string*" ))
1530
+
1531
+ for binary_name in "${binaries[@]}" ; do
1484
1532
 
1485
- for binary_name in $(builtin cd "$rvm_bin_path" ; find * -type f -maxdepth 0); do
1486
1533
  full_binary_path="$rvm_bin_path/$binary_name"
1487
1534
 
1488
- if [[ -L "$full_binary_path" ]] && "$rvm_scripts_path/match" "$(readlink "$full_binary_path")" "$rvm_ruby_string"; then
1535
+ if [[ -L "$full_binary_path" ]] && "$rvm_path/scripts/match" "$(readlink "$full_binary_path")" "$rvm_ruby_string"; then
1489
1536
  rm -f "$full_binary_path"
1490
1537
  fi
1491
- unset full_binary_path
1492
- done
1538
+ done ; unset binaries
1539
+
1540
+ return 0
1493
1541
  }
1494
1542
 
1495
1543
  __rvm_post_install() {
1544
+
1545
+ local rvm_ruby_aliases ruby_alias binary
1546
+
1496
1547
  if [[ "$rvm_ruby_interpreter" != "jruby" ]] ; then
1497
- binaries=(${binaries:-"gem irb erb ri rdoc testrb rake"})
1498
1548
 
1499
- "$rvm_scripts_path/log" "info" "#shebangs adjustment for $rvm_ruby_string ($binaries)."
1549
+ if [[ ${#binaries[@]} -lt 1 ]] ; then
1550
+ binaries=(gem irb erb ri rdoc testrb rake)
1551
+ fi
1552
+
1553
+ "$rvm_path/scripts/log" "info" \
1554
+ "$rvm_ruby_string adjusting #shebangs for ($binaries)."
1500
1555
 
1501
1556
  for binary in "${binaries[@]}" ; do
1502
1557
 
1503
- if [[ -e "$rvm_ruby_home/bin/$binary" ]] || [[ -e "$rvm_ruby_src_path/bin/$binary" ]] ; then
1558
+ if [[ -e "$rvm_ruby_home/bin/$binary" || -e "$rvm_ruby_src_path/bin/$binary" ]] ; then
1559
+
1560
+ if [[ "$rvm_ruby_src_path" != "$rvm_ruby_home" && -f "$rvm_ruby_src_path/bin/$binary" ]] ; then
1504
1561
 
1505
- if [[ "$rvm_ruby_src_path" != "$rvm_ruby_home" ]] && [[ -f "$rvm_ruby_src_path/bin/$binary" ]] ; then
1506
1562
  cp -f "$rvm_ruby_src_path/bin/$binary" "$rvm_ruby_home/bin/$binary"
1563
+
1507
1564
  elif [[ -f "$rvm_ruby_gem_home/bin/$binary" ]] ; then
1565
+
1508
1566
  cp -f "$rvm_ruby_gem_home/bin/$binary" "$rvm_ruby_home/bin/$binary"
1509
1567
  fi
1510
1568
 
@@ -1514,37 +1572,51 @@ __rvm_post_install() {
1514
1572
 
1515
1573
  chmod +x "$rvm_ruby_home/bin/$binary"
1516
1574
  fi
1517
- done ; unset binary binaries
1575
+ done
1576
+
1577
+ binaries=(gem irb erb ri rdoc testrb rake)
1518
1578
  fi
1519
1579
 
1520
1580
  # Import the initial gemsets.
1521
- __rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" "'$rvm_scripts_path/gemsets' initial" "#importing initial gems"
1581
+ __rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" "'$rvm_path/scripts/gemsets' initial" "$rvm_ruby_string - #importing default gemsets ($rvm_path/gemsets/)"
1522
1582
 
1523
1583
  __rvm_irbrc
1584
+
1524
1585
  __rvm_generate_default_docs
1525
1586
 
1526
1587
  if [[ -n "$rvm_ruby_aliases" ]]; then
1527
- "$rvm_scripts_path/log" "info" "Setting up aliases for $rvm_ruby_string"
1588
+ "$rvm_path/scripts/log" "info" "Setting up aliases for $rvm_ruby_string"
1589
+
1528
1590
  while read -r ruby_alias; do
1529
- "$rvm_scripts_path/log" info "Aliasing $rvm_ruby_string to $ruby_alias"
1530
- "$rvm_scripts_path/alias" delete "$ruby_alias" > /dev/null 2>&1
1531
- "$rvm_scripts_path/alias" create "$ruby_alias" "$rvm_ruby_string" > /dev/null 2>&1
1591
+
1592
+ "$rvm_path/scripts/log" info "Aliasing $rvm_ruby_string to $ruby_alias"
1593
+
1594
+ "$rvm_path/scripts/alias" delete "$ruby_alias" > /dev/null 2>&1
1595
+
1596
+ "$rvm_path/scripts/alias" create "$ruby_alias" "$rvm_ruby_string" > /dev/null 2>&1
1597
+
1532
1598
  done < <(echo "$rvm_ruby_string" | \tr ' ' '\n' | sort -u)
1533
- unset rvm_ruby_aliases ruby_alias
1534
1599
  fi
1535
1600
  }
1536
1601
 
1537
1602
  __rvm_generate_default_docs() {
1603
+
1538
1604
  if [[ "$rvm_docs_flag" = "1" && "$rvm_ruby_interpreter" != "macruby" ]]; then
1605
+
1539
1606
  __rvm_run_with_env "docs.generate" "$rvm_ruby_string" "rvm docs generate-ri" "Attempting to generate ri documentation..."
1540
1607
  fi
1541
1608
  }
1542
1609
 
1543
1610
  __rvm_rubygems_setup() {
1611
+
1612
+ local home path dir directory_name version_number ruby_lib_gem_path
1613
+
1544
1614
  if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.9/')" ]] || [[ -n "$(echo "$rvm_ruby_interpreter" | awk '/^mput/')" ]] ; then
1545
1615
  install=0
1616
+
1546
1617
  elif [[ "$rvm_ruby_string" = "ruby-head" ]] ; then
1547
1618
  install=0
1619
+
1548
1620
  else
1549
1621
  install=1
1550
1622
  fi
@@ -1562,9 +1634,12 @@ __rvm_rubygems_setup() {
1562
1634
  home="$GEM_HOME" ; path="$GEM_PATH" # Save
1563
1635
 
1564
1636
  for dir in $rvm_ruby_global_gems_path $rvm_ruby_gem_home ; do
1637
+
1565
1638
  export GEM_HOME="$dir" ; export GEM_PATH="$dir" ; export BUNDLE_PATH="$dir"
1566
- __rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "#rubygems update for $dir"
1567
- done ; unset home path dir
1639
+
1640
+ __rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "$rvm_ruby_string - updating #rubygems for $dir"
1641
+
1642
+ done
1568
1643
 
1569
1644
  GEM_HOME="$home" ; GEM_PATH="$path" ; BUNDLE_PATH="$home"
1570
1645
  export GEM_HOME GEM_PATH BUNDLE_PATH
@@ -1578,7 +1653,10 @@ __rvm_rubygems_setup() {
1578
1653
  version_number="${rvm_ruby_release_version}.${rvm_ruby_major_version}"
1579
1654
 
1580
1655
  if [[ "$version_number" == "." ]]; then
1581
- version_number="$(builtin cd "$directory_name" ; find * -type f -maxdepth 0 | \grep '^[[:digit:]].[[:digit:]]\(.[[:digit:]]\)\?' | head -n1)"
1656
+
1657
+ # TODO: Investigate this if statement, something feels not quite right.
1658
+ version_number="$(builtin cd "$directory_name" ; find . -maxdepth 1 -mindepth 1 -type f | \grep '^[[:digit:]].[[:digit:]]\(.[[:digit:]]\)\?' | head -n1)"
1659
+ version_number="${version_number//.\/}"
1582
1660
 
1583
1661
  if [[ -n "$version_number" ]]; then
1584
1662
  ruby_lib_gem_path="${directory_name}/${version_number}"
@@ -1590,24 +1668,24 @@ __rvm_rubygems_setup() {
1590
1668
  ruby_lib_gem_path="${directory_name}/${version_number}"
1591
1669
  fi
1592
1670
 
1593
- unset directory_name version_number
1594
-
1595
1671
  elif [[ -n "$(echo "$rvm_ruby_interpreter" | awk '/^rbx|jruby/')" ]] ; then
1596
1672
 
1597
1673
  # Hands off rubygems for rbx & jruby
1598
1674
  if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
1599
- "$rvm_scripts_path/log" "debug" "Skipping rubygems update for $rvm_ruby_version"
1675
+ "$rvm_path/scripts/log" "debug" "Skipping rubygems update for $rvm_ruby_version"
1600
1676
  fi
1601
1677
 
1602
1678
  ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/jruby"
1603
1679
 
1604
1680
  else
1605
- "$rvm_scripts_path/log" "info" "#rubygems installing to $rvm_ruby_string"
1681
+ "$rvm_path/scripts/log" "info" "$rvm_ruby_string - #rubygems installing to $rvm_ruby_string"
1682
+
1606
1683
  rvm_rubygems_version="$(__rvm_db "${rvm_ruby_interpreter}_rubygems_version")"
1607
1684
  rvm_rubygems_version="${rvm_rubygems_version:-"$(__rvm_db "rubygems_version")"}"
1608
1685
  rvm_rubygems_url=$(__rvm_db "rubygems_${rvm_rubygems_version}_url")
1609
1686
  rvm_gem_package_name="rubygems-$rvm_rubygems_version"
1610
1687
  rvm_gem_url="$rvm_rubygems_url/$rvm_gem_package_name.tgz"
1688
+
1611
1689
  # Sanity check... If setup.rb is missing from the rubygems source path,
1612
1690
  # something went wrong. Cleanup, aisle 3!
1613
1691
  if [[ ! -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then
@@ -1615,12 +1693,19 @@ __rvm_rubygems_setup() {
1615
1693
  fi
1616
1694
 
1617
1695
  if [[ ! -d "$rvm_src_path/$rvm_gem_package_name" ]] ; then
1618
- "$rvm_scripts_path/log" "info" "Retrieving $rvm_gem_package_name"
1619
- "$rvm_scripts_path/fetch" "$rvm_gem_url"
1620
- result=$? ; if [[ "$result" -gt 0 ]] ; then
1621
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
1696
+
1697
+ "$rvm_path/scripts/log" "info" "Retrieving $rvm_gem_package_name"
1698
+
1699
+ "$rvm_path/scripts/fetch" "$rvm_gem_url"
1700
+ result=$?
1701
+
1702
+ if [[ "$result" -gt 0 ]] ; then
1703
+ "$rvm_path/scripts/log" "error" \
1704
+ "There has been an error while trying to fetch the source. Halting the installation." ; return $result
1622
1705
  fi
1706
+
1623
1707
  mkdir -p "$rvm_src_path/$rvm_gem_package_name"
1708
+
1624
1709
  __rvm_run "rubygems.extract" "gunzip < \"$rvm_archives_path/$rvm_gem_package_name.tgz\" | tar xf - -C $rvm_src_path" "Extracting $rvm_gem_package_name ..."
1625
1710
  fi
1626
1711
 
@@ -1629,7 +1714,7 @@ __rvm_rubygems_setup() {
1629
1714
  __rvm_run "rubygems.install" "GEM_PATH=$rvm_ruby_gem_path GEM_HOME=$rvm_ruby_gem_home BUNDLE_PATH=$rvm_ruby_gem_home $rvm_ruby_home/bin/ruby $rvm_src_path/$rvm_gem_package_name/setup.rb"
1630
1715
  result=$?
1631
1716
  if [[ $result -gt 0 ]] ; then
1632
- "$rvm_scripts_path/log" "warning" "#warning Installation of rubygems $rvm_ruby_package_name did not complete successfully."
1717
+ "$rvm_path/scripts/log" "warning" "$rvm_ruby_string - #warning Installation of rubygems $rvm_ruby_package_name did not complete successfully."
1633
1718
  fi
1634
1719
 
1635
1720
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
@@ -1645,14 +1730,14 @@ __rvm_rubygems_setup() {
1645
1730
  # Add ruby's gem path to ruby's lib direcotry.
1646
1731
 
1647
1732
  if [[ -d "$ruby_lib_gem_path" ]] ; then
1648
- \rm -rf "$ruby_lib_gem_path"
1733
+ rm -rf "$ruby_lib_gem_path"
1649
1734
  fi
1650
1735
 
1651
1736
  mkdir -p ${ruby_lib_gem_path%\/*}
1652
1737
 
1653
1738
  ln -nfs "$rvm_ruby_gem_home" "$ruby_lib_gem_path"
1654
1739
 
1655
- fi; unset ruby_lib_gem_path
1740
+ fi
1656
1741
 
1657
1742
  if [[ -s "$rvm_ruby_src_path/bin/rdoc" ]] ; then
1658
1743
  __rvm_inject_ruby_shebang "$rvm_ruby_src_path/bin/rdoc"
@@ -1666,28 +1751,44 @@ __rvm_rubygems_setup() {
1666
1751
  }
1667
1752
 
1668
1753
  __rvm_inject_ruby_shebang() {
1754
+
1755
+ local actual_file
1756
+
1669
1757
  __rvm_actual_file $1
1670
1758
 
1671
1759
  if [[ -f "$actual_file" ]] ; then
1672
1760
  sed -e '1,1s=.*=#!'"/usr/bin/env ruby=" ${actual_file} > "${actual_file}.new"
1761
+
1673
1762
  mv "${actual_file}.new" "${actual_file}" ; chmod +x "$actual_file"
1674
- fi ; unset actual_file
1763
+ fi
1675
1764
  }
1676
1765
 
1677
1766
  __rvm_inject_gem_env() {
1767
+
1768
+ local actual_file string
1769
+
1678
1770
  __rvm_actual_file $1
1771
+
1679
1772
  if [[ -f "$actual_file" ]] ; then
1773
+
1680
1774
  if [[ -n "$(head -n 1 $actual_file | awk '/[j]*ruby/')" ]] ; then
1775
+
1681
1776
  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']\nENV['BUNDLE_PATH']=ENV['BUNDLE_PATH'] || '$rvm_ruby_gem_home'\n"
1777
+
1682
1778
  elif [[ -n "$(head -n 1 $actual_file | awk '/bash/')" ]] ; then
1779
+
1683
1780
  string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_path'}\nPATH=$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:\$PATH\nBUNDLE_PATH=\${BUNDLE_PATH:-'$rvm_ruby_gem_home'}\n"
1781
+
1684
1782
  fi
1783
+
1685
1784
  if [[ -n "$string" ]] ; then
1785
+
1686
1786
  awk "NR==2 {print \"$string\"} {print}" "$actual_file" > "$actual_file.new"
1787
+
1687
1788
  mv $actual_file.new $actual_file ; chmod +x "$actual_file"
1688
- unset string
1789
+
1689
1790
  fi
1690
- fi ; unset actual_file
1791
+ fi
1691
1792
  }
1692
1793
 
1693
1794
  __rvm_actual_file() {
@@ -1705,8 +1806,8 @@ __rvm_manage_rubies() {
1705
1806
  rvm_gemset_name=""
1706
1807
  rvm_ruby_selected_flag=0
1707
1808
 
1708
- rvm_ruby_gem_home="${rvm_ruby_gem_home:-""//${rvm_gemset_separator}*}"
1709
- rvm_ruby_string="${rvm_ruby_string:-""//${rvm_gemset_separator}*}"
1809
+ rvm_ruby_gem_home="${rvm_ruby_gem_home:-""//${rvm_gemset_separator:-"@"}*}"
1810
+ rvm_ruby_string="${rvm_ruby_string:-""//${rvm_gemset_separator:-"@"}*}"
1710
1811
 
1711
1812
  # Given list of ruby strings.
1712
1813
  if [[ -n "${rubies_string:-""}" ]] ;then
@@ -1735,6 +1836,7 @@ __rvm_manage_rubies() {
1735
1836
  if [[ "$action" != "install" && "$action" != "remove" && "$action" != "uninstall" ]] ; then
1736
1837
 
1737
1838
  local ruby_string
1839
+
1738
1840
  while read -r ruby_string
1739
1841
  do # Keep this on second line damnit!
1740
1842
 
@@ -1755,10 +1857,10 @@ __rvm_manage_rubies() {
1755
1857
 
1756
1858
  __rvm_unset_ruby_variables
1757
1859
  fi
1758
- done < <(builtin cd "$rvm_rubies_path" ; find * -type d -maxdepth 0 2> /dev/null)
1860
+ done < <(builtin cd "$rvm_rubies_path" ; find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | sed -e 's#./##g')
1759
1861
 
1760
1862
  else
1761
- "$rvm_scripts_path/log" "warn" \
1863
+ "$rvm_path/scripts/log" "warn" \
1762
1864
  'Really? '"$action"' all? See "rvm list known" and limit the selection to something more sane please :)'
1763
1865
  fi
1764
1866
  fi
@@ -1771,6 +1873,7 @@ args=($*)
1771
1873
  action="${args[0]:-""}"
1772
1874
  rubies_string="${args[1]:-""}"
1773
1875
  args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
1876
+ binaries=()
1774
1877
 
1775
1878
  __rvm_manage_rubies
1776
1879