rvm 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- rvm_selfcontained="${rvm_selfcontained:-1}"
4
-
5
- if [[ "$rvm_selfcontained" = "0" ]] ; then
3
+ if [[ ${rvm_selfcontained:-1} -eq 0 ]] ; then
6
4
  rvm_bin_path="${rvm_bin_path:-"${rvm_prefix}bin"}"
7
5
  rvm_man_path="${rvm_man_path:-"${rvm_prefix}share/man"}"
8
6
  rvm_rc_files="${rvm_rc_files:-"/etc/profile /etc/zshenv"}"
@@ -12,7 +10,7 @@ else
12
10
  rvm_rc_files="${rvm_rc_files:-"$HOME/.bash_profile $HOME/.bashrc $HOME/.zshenv"}"
13
11
  fi
14
12
 
15
- [[ -n "$rvm_archflags" ]] && rvm_make_flags_flag=1
13
+ [[ -n "${rvm_archflags:-""}" ]] && rvm_make_flags_flag=1
16
14
 
17
15
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
18
16
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
@@ -6,7 +6,7 @@ rvm_base_except="selector"
6
6
  source "$rvm_scripts_path/base"
7
7
 
8
8
  list_gemsets() {
9
- if [[ "$1" = "strings" ]]; then
9
+ if [[ "${1:-""}" = "strings" ]]; then
10
10
  list_gemset_strings
11
11
  return 0
12
12
  fi
@@ -57,14 +57,19 @@ list_gemsets() {
57
57
  }
58
58
 
59
59
  list_default() {
60
- if [[ "$1" = "string" ]] ; then
60
+ if [[ "${args[0]:-""}" = "string" ]] ; then
61
61
  "$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --
62
+
62
63
  else
63
64
  if [[ -L "$rvm_rubies_path/default" ]]; then
65
+
64
66
  version=$("$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --)
67
+
65
68
  if [[ ! -z "$version" ]] ; then
66
69
  printf "\n\nDefault Ruby (for new shells)\n"
70
+
67
71
  string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
72
+
68
73
  if [[ $rvm_pretty_print -eq 1 ]] ; then
69
74
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
70
75
  else
@@ -106,7 +111,7 @@ list_known_strings() {
106
111
  }
107
112
 
108
113
  list_known() {
109
- if [[ "$1" = "strings" ]]; then
114
+ if [[ "${1:-""}" = "strings" ]]; then
110
115
  list_known_strings
111
116
  return 0
112
117
  fi
@@ -124,8 +129,7 @@ list_rubies_strings() {
124
129
  }
125
130
 
126
131
  list_rubies() {
127
-
128
- if [[ "$1" = "strings" ]]; then list_rubies_strings ; return 0 ; fi
132
+ if [[ "${1:-""}" = "strings" ]]; then list_rubies_strings ; return 0 ; fi
129
133
 
130
134
  current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
131
135
 
@@ -171,8 +175,8 @@ list_rubies() {
171
175
  # Display the rubies, indicate their architecture and indicate which is currently used.
172
176
  # This is not meant to be used with scripting. This is for interactive mode usage only.
173
177
  args=($*)
174
- action="${args[0]}"
175
- args="$(echo ${args[@]:1}) " # Strip trailing / leading / extra spacing.
178
+ action="${args[0]:-""}"
179
+ args=${args[@]:1} # Strip trailing / leading / extra spacing.
176
180
 
177
181
  if [[ "known" = "$action" ]] ; then
178
182
  list_known
@@ -192,7 +196,7 @@ else # help
192
196
  printf "
193
197
  Usage:
194
198
 
195
- rvm list {known,gemsets,default,rubies,strings,known_strings}
199
+ rvm list {known,gemsets,default [string],rubies,strings,known_strings}
196
200
 
197
201
  "
198
202
  false
@@ -11,7 +11,7 @@ message="${1//%/%%}"
11
11
 
12
12
  rvm_pretty_print=${rvm_pretty_print:-0}
13
13
  if [[ $rvm_pretty_print -eq 0 ]] ; then
14
- if [[ $rvm_verbose_flag -eq 1 ]] && [[ -n "$level" ]] ; then
14
+ if [[ $rvm_verbose_flag -gt 0 && -n "$level" ]] ; then
15
15
  message="$level: $message"
16
16
  fi
17
17
 
@@ -1,25 +1,23 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
4
-
5
- original_ruby_version=$rvm_ruby_version
6
- original_ruby_string=$rvm_ruby_string
3
+ original_ruby_version=${rvm_ruby_version:-""}
4
+ original_ruby_string=${rvm_ruby_string:-""}
7
5
 
8
6
  source "$rvm_scripts_path/base"
9
7
  source "$rvm_scripts_path/patches"
10
8
 
11
9
  __rvm_check_for_clang() {
12
- if [[ -n "$rvm_clang_flag" ]] && ! command -v clang >/dev/null ; then
13
- "$rvm_scripts_path/log" "fail" "You passed the --clang option and clang isn't in your path. Please try again / don't use --clang"
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"
14
12
  return 1
15
13
  fi
16
14
  }
17
15
 
18
16
  # Checks for bison, returns zero iff it is found
19
17
  __rvm_check_for_bison() {
20
- if [[ "$rvm_head_flag" -gt 0 ]]; then
18
+ if [[ ${rvm_head_flag:-0} -gt 0 ]]; then
21
19
  if ! command -v bison >/dev/null ; then
22
- "$rvm_scripts_path/log" "fail" "bison is not available in your path. Please ensure it exists before compiling from head."
20
+ "$rvm_scripts_path/log" "fail" "\nbison is not available in your path. \nPlease ensure bison is installed before compiling from head.\n"
23
21
  return 1
24
22
  fi
25
23
  fi
@@ -30,11 +28,12 @@ __rvm_check_for_bison() {
30
28
  __rvm_current_patch_names() {
31
29
  # TODO: Lookup default patches on rvm_ruby_string heirarchy.
32
30
  local separator="%"
33
- local patches="$rvm_patch_names default"
34
- for patch_name in $(echo "$patches" | \tr ',' ' ' | __rvm_strip); do
31
+ local patches="${rvm_patch_names:-""} default"
32
+
33
+ for patch_name in $(echo ${patches//,/ }); do
35
34
  local level=1
36
35
  local name="$patch_name"
37
- if echo "$name" | \grep -q "$separator"; then
36
+ if echo "$name" | grep -q "$separator"; then
38
37
  level="${name/*${separator}/}"
39
38
  name="${name//${separator}*/}"
40
39
  fi
@@ -48,56 +47,67 @@ __rvm_apply_patches() {
48
47
  local patch_level_separator="%"
49
48
  local patch_fuzziness="25"
50
49
  local patch_level=1
51
- source_directory="${1:-"$rvm_ruby_src_path"}"
52
- __rvm_pushpop "$source_directory"
53
- unset source_directory
54
- patches="$(__rvm_current_patch_names | __rvm_strip)"
55
- for patch_name in $(echo $patches); do
56
- # If set, extract the patch level from the patch name.
57
- patch_level=1
58
- if echo "$patch_name" | \grep -q "$patch_level_separator"; then
59
- patch_level="${patch_name//*${patch_level_separator}/}"
60
- patch_name="${patch_name//${patch_level_separator}*/}"
61
- fi
62
- full_patch_path="$(__rvm_lookup_full_patch_path "$patch_name")"
63
- # Expand paths, and for those we found we then apply the patches.
64
- if [[ -n "$full_patch_path" ]]; then
65
- if [[ -f "$full_patch_path" ]] ; then
66
- __rvm_run "patch.apply.${patch_name/*\/}" "patch -F$patch_fuzziness -p$patch_level -f <\"$full_patch_path\"" "Applying patch '$patch_name' (located at $full_patch_path)"
67
- # Detect failed patches
68
- [[ "$?" -gt 0 ]] && patch_result=1
50
+ local source_directory="${1:-"$rvm_ruby_src_path"}"
51
+ (
52
+ builtin cd "$source_directory"
53
+
54
+ patches="$(__rvm_current_patch_names | __rvm_strip)"
55
+ for patch_name in $(echo $patches); do
56
+ # If set, extract the patch level from the patch name.
57
+ patch_level=1
58
+ if echo "$patch_name" | \grep -q "$patch_level_separator"; then
59
+ patch_level=${patch_name//*${patch_level_separator}/}
60
+ patch_name="${patch_name//${patch_level_separator}*/}"
69
61
  fi
70
- else
71
- "$rvm_scripts_path/log" "warn" "Patch '$patch_name' not found."
72
- patch_result=1
73
- fi
74
- done; unset patch_name full_patch_path patch_level
75
- __rvm_pushpop
62
+
63
+ full_patch_path="$(__rvm_lookup_full_patch_path "$patch_name")"
64
+
65
+ # Expand paths, and for those we found we then apply the patches.
66
+ if [[ -n "${full_patch_path:-""}" ]]; then
67
+
68
+ if [[ -f "$full_patch_path" ]] ; then
69
+ __rvm_run "patch.apply.${patch_name/*\/}" "patch -F$patch_fuzziness -p$patch_level -f <\"$full_patch_path\"" "Applying patch '$patch_name' (located at $full_patch_path)"
70
+ # Detect failed patches
71
+ [[ $? -gt 0 ]] && patch_result=1
72
+ fi
73
+ else
74
+ "$rvm_scripts_path/log" "warn" "Patch '$patch_name' not found."
75
+ patch_result=1
76
+ fi
77
+ done
78
+ )
79
+ unset patch_name full_patch_path patch_level
76
80
  return $patch_result
77
81
  }
78
82
 
79
83
  __rvm_install_source() {
80
- [[ -z "$rvm_ruby_selected_flag" ]] && __rvm_select
84
+ [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] && __rvm_select
81
85
 
82
- if [[ "$rvm_ruby_string" = "ruby-1.9.2-head" ]] ; then
86
+ if [[ "${rvm_ruby_string:-""}" =~ "-head" ]] ; then
83
87
  # Ensure we have a base ruby.
84
88
  __rvm_ensure_has_18_compat_ruby || return 1
85
89
  fi
86
90
 
87
- "$rvm_scripts_path/log" "info" "Installing Ruby from source to: $rvm_ruby_home"
88
- __rvm_pushpop "$rvm_src_path"
89
- if [[ -n "$rvm_force_flag" ]] ; then \rm -rf "$rvm_ruby_home" "$rvm_ruby_src_path" ; fi
91
+ "$rvm_scripts_path/log" "info" "\nInstalling Ruby from source to: $rvm_ruby_home, this may take a while depending on your cpu(s)...\n"
92
+
93
+ builtin cd "$rvm_src_path"
94
+
95
+ if [[ ${rvm_force_flag:-0} -eq 1 ]] ; then
96
+ for directory in "$rvm_ruby_home" "$rvm_ruby_src_path" ; do
97
+ [[ -d "$directory" ]] && rm -rf "$directory"
98
+ done
99
+ fi
90
100
 
91
101
  result=0
92
102
  __rvm_fetch_ruby
93
103
  result=$? ; if [[ "$result" -gt 0 ]] ; then
94
- "$rvm_scripts_path/log" "error" "There has been an error fetching the ruby interpreter. Aborting the installation." ; __rvm_pushpop ; return $result
104
+ "$rvm_scripts_path/log" "error" "There has been an error fetching the ruby interpreter. Aborting the installation." ; return $result
95
105
  fi
96
106
 
97
107
  builtin cd "$rvm_ruby_src_path"
98
108
 
99
109
  result=$? ; if [[ "$result" -gt 0 ]] ; then
100
- "$rvm_scripts_path/log" "error" "There has been an error, source directory is missing. Did the download or extraction fail? Aborting the installation." ; __rvm_pushpop ; return $result
110
+ "$rvm_scripts_path/log" "error" "There has been an error, source directory is missing. Did the download or extraction fail? Aborting the installation." ; return $result
101
111
  fi
102
112
 
103
113
  if [[ -d "${rvm_path}/usr" ]] ; then
@@ -112,7 +122,7 @@ __rvm_install_source() {
112
122
  return $result
113
123
  fi
114
124
 
115
- if [[ -z "$rvm_ruby_configure" ]] && [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
125
+ if [[ -z "${rvm_ruby_configure:-""}" ]] && [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
116
126
  if command -v autoconf > /dev/null ; then
117
127
  __rvm_run "autoconf" "autoconf" "Running autoconf"
118
128
  else
@@ -120,10 +130,10 @@ __rvm_install_source() {
120
130
  fi
121
131
  fi
122
132
 
123
- if [[ -n "$rvm_ruby_configure" ]] ; then
133
+ if [[ -n "${rvm_ruby_configure:-""}" ]] ; then
124
134
  __rvm_run "configure" "$rvm_ruby_configure"
125
135
  result=$? ; if [[ "$result" -gt 0 ]] ; then
126
- "$rvm_scripts_path/log" "error" "There has been an error while configuring. Aborting the installation." ; __rvm_pushpop ; return $result
136
+ "$rvm_scripts_path/log" "error" "There has been an error while configuring. Aborting the installation." ; return $result
127
137
  fi
128
138
  elif [[ -s ./configure ]] ; then
129
139
  # REE stores configure flags differently for head vs. the distributed release.
@@ -133,39 +143,37 @@ __rvm_install_source() {
133
143
 
134
144
  # On 1.9.2, we manually set the --with-baseruby option
135
145
  # to point to an expanded path.
136
- if [[ "$rvm_ruby_string" = "ruby-1.9.2-head" ]] ; then
146
+ if [[ "${rvm_ruby_string:-""}" = "ruby-1.9.2-head" ]] ; then
137
147
  local compatible_baseruby="$rvm_wrappers_path/$(__rvm_18_compat_ruby)/ruby"
138
148
  if [[ -x "$compatible_baseruby" ]] ; then
139
149
  configure_parameters="--with-baseruby=$compatible_baseruby"
140
150
  fi
141
151
  fi
142
152
 
143
- local configure_command="./configure --prefix=$rvm_ruby_home $db_configure_flags $rvm_ruby_configure_flags $configure_parameters"
144
- __rvm_run "configure" "$configure_command" "Configuring $rvm_ruby_string, this may take a while depending on your cpu(s)..."
153
+ local configure_command="./configure --prefix=$rvm_ruby_home ${db_configure_flags:-""} ${rvm_ruby_configure_flags:-""} ${configure_parameters:-""}"
154
+ __rvm_run "configure" "$configure_command" "#configuring $rvm_ruby_string"
145
155
  unset configure_parameters db_configure_flags
146
156
  result=$? ; if [[ "$result" -gt 0 ]] ; then
147
- "$rvm_scripts_path/log" "error" "There has been an error while running configure. Aborting the installation." ; __rvm_pushpop ; return $result
157
+ "$rvm_scripts_path/log" "error" "There has been an error while running configure. Aborting the installation." ; return $result
148
158
  fi
149
159
  else
150
160
  "$rvm_scripts_path/log" "error" "Skipping configure step, 'configure' does not exist, did autoconf not run successfully?"
151
161
  fi
152
162
 
153
163
  rvm_ruby_make=${rvm_ruby_make:-"make"}
154
- __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while depending on your cpu(s)..."
164
+ __rvm_run "make" "$rvm_ruby_make ${rvm_make_flags:-""}" "#compiling $rvm_ruby_string"
155
165
  result=$? ; if [[ "$result" -gt 0 ]] ; then
156
- "$rvm_scripts_path/log" "error" "There has been an error while running make. Aborting the installation." ; __rvm_pushpop ; return $result
166
+ "$rvm_scripts_path/log" "error" "There has been an error while running make. Aborting the installation." ; return $result
157
167
  fi
158
168
 
159
169
  if [[ -d .ext/rdoc ]] ; then \rm -rf .ext/rdoc ; fi
160
170
 
161
171
  rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
162
- __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string"
172
+ __rvm_run "install" "$rvm_ruby_make_install" "#installing $rvm_ruby_string"
163
173
  result=$? ; if [[ "$result" -gt 0 ]] ; then
164
- "$rvm_scripts_path/log" "error" "There has been an error while running make install. Aborting the installation." ; __rvm_pushpop ; return $result
174
+ "$rvm_scripts_path/log" "error" "There has been an error while running make install. Aborting the installation." ; return $result
165
175
  fi
166
176
 
167
- "$rvm_scripts_path/log" "info" "Installation of $rvm_ruby_string is complete."
168
-
169
177
  export GEM_HOME="$rvm_ruby_gem_home"
170
178
  export GEM_PATH="$rvm_ruby_gem_path"
171
179
  export BUNDLE_PATH="$rvm_ruby_gem_home"
@@ -174,62 +182,69 @@ __rvm_install_source() {
174
182
  __rvm_bin_script
175
183
  __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*"
176
184
  __rvm_post_install
177
- __rvm_pushpop
185
+
186
+ "$rvm_scripts_path/log" "info" "#complete install of $rvm_ruby_string"
178
187
  }
179
188
 
180
189
  __rvm_install_ruby() {
181
190
 
182
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
191
+ if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
183
192
 
184
- if [[ -n "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
193
+ if [[ -n "${RUBYOPT:-""}" ]] ; then ruby_options="$RUBYOPT" ; fi
194
+ unset RUBYOPT
185
195
 
186
196
  # Check for clang if the flag is set
187
197
  __rvm_check_for_clang
188
198
  local result="$?"
189
- [[ "$result" -gt 0 ]] && return $result
199
+ [[ $result -gt 0 ]] && return $result
190
200
 
191
201
  case "$rvm_ruby_interpreter" in
192
202
  macruby)
193
203
  if [[ "Darwin" = "$(uname)" ]] ; then
204
+
194
205
  if [[ "$rvm_head_flag" = 1 ]] ; then
206
+
195
207
  if [[ -n "$rvm_llvm_flag" ]] ; then
196
208
  "$rvm_scripts_path/package" llvm install
197
209
  fi
210
+
198
211
  macruby_path="/usr/local/bin"
199
212
  # TODO: configure & make variables should be set here.
200
213
  rvm_ruby_configure=" true "
201
214
  rvm_ruby_make="rake"
202
215
  rvm_ruby_make_install="sudo rake install"
203
- __rvm_db "${rvm_ruby_interpreter}_repo_url" "rvm_url"
204
- rvm_ruby_repo_url=$rvm_url
216
+ __rvm_db "${rvm_ruby_interpreter}_repo_url" "rvm_ruby_url"
217
+ rvm_ruby_repo_url=$rvm_ruby_url
205
218
  __rvm_install_source $*
206
219
  result=$? ; if [[ "$result" -gt 0 ]] ; then
207
220
  "$rvm_scripts_path/log" "error" "There has been an error while trying to install from source. Aborting the installation." ; return $result
208
221
  fi
222
+
209
223
  elif [[ "nightly" = "$rvm_ruby_version" ]] ; then
210
224
  macruby_path="/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin"
211
225
  # TODO: Separated nightly from head.
212
226
  "$rvm_scripts_path/log" "info" "Retrieving the latest nightly macruby build..."
213
- "$rvm_scripts_path/fetch" "$rvm_url"
227
+ "$rvm_scripts_path/fetch" "$rvm_ruby_url"
214
228
  result=$? ; if [[ "$result" -gt 0 ]] ; then
215
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
229
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
216
230
  fi
217
231
  mv "$rvm_archives_path/macruby_nightly-latest.pkg" "$rvm_archives_path/macruby_nightly.pkg"
218
232
  __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '$rvm_archives_path/macruby_nightly.pkg' -target '/'"
219
- \mkdir -p "$rvm_ruby_home/bin"
233
+ mkdir -p "$rvm_ruby_home/bin"
234
+
220
235
  else
221
236
  macruby_path="/Library/Frameworks/MacRuby.framework/Versions/${rvm_ruby_version}/usr/bin"
222
237
  # TODO: Separated nightly from head.
223
238
  "$rvm_scripts_path/log" "info" "Retrieving MacRuby ${rvm_ruby_version} ..."
224
- "$rvm_scripts_path/fetch" "$rvm_url"
239
+ "$rvm_scripts_path/fetch" "$rvm_ruby_url"
225
240
  result=$? ; if [[ "$result" -gt 0 ]] ; then
226
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
241
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
227
242
  fi
228
- \mkdir -p $rvm_ruby_src_path
229
- \unzip -o -j "$rvm_archives_path/$rvm_ruby_package_file" "MacRuby ${rvm_ruby_version}/MacRuby ${rvm_ruby_version}.pkg" -d "$rvm_ruby_src_path"
243
+ mkdir -p $rvm_ruby_src_path
244
+ unzip -o -j "$rvm_archives_path/$rvm_ruby_package_file" "MacRuby ${rvm_ruby_version}/MacRuby ${rvm_ruby_version}.pkg" -d "$rvm_ruby_src_path"
230
245
  mv "$rvm_ruby_src_path/MacRuby ${rvm_ruby_version}.pkg" "$rvm_ruby_src_path/$rvm_ruby_string.pkg"
231
246
  __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '$rvm_ruby_src_path/$rvm_ruby_string.pkg' -target '/'"
232
- \mkdir -p "$rvm_ruby_home/bin"
247
+ mkdir -p "$rvm_ruby_home/bin"
233
248
  fi
234
249
 
235
250
  binaries=(erb gem irb rake rdoc ri ruby testrb)
@@ -248,7 +263,7 @@ RubyWrapper
248
263
  )
249
264
 
250
265
  file_name="$rvm_ruby_home/bin/$binary_name"
251
- \rm -f "$file_name"
266
+ rm -f "$file_name"
252
267
  echo "$ruby_wrapper" > "$file_name"
253
268
  if [[ -f "$file_name" ]] ; then chmod +x $file_name ; fi
254
269
  if [[ "$binary_name" = "ruby" ]] ; then
@@ -264,30 +279,36 @@ RubyWrapper
264
279
 
265
280
  ree)
266
281
  if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.8/')" ]] && [[ $rvm_head_flag -eq 0 ]] ; then
267
- rvm_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
282
+
283
+ rvm_ruby_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
284
+
268
285
  "$rvm_scripts_path/log" "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
269
- __rvm_pushpop "$rvm_src_path"
270
- if [[ -z "$rvm_force_flag" ]] && [[ -d "$rvm_ruby_src_path" ]] && [[ ! -x "$rvm_ruby_src_path/installer" ]] ; then
286
+
287
+ builtin cd "$rvm_src_path"
288
+ if [[ ${rvm_force_flag:-0} -eq 0 && -d "$rvm_ruby_src_path" && ! -x "$rvm_ruby_src_path/installer" ]] ; then
271
289
  "$rvm_scripts_path/log" "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
290
+
272
291
  else
273
- "$rvm_scripts_path/log" "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
274
- "$rvm_scripts_path/fetch" "$rvm_url"
292
+ "$rvm_scripts_path/log" "#fetching $rvm_ruby_package_file"
293
+
294
+ "$rvm_scripts_path/fetch" "$rvm_ruby_url"
275
295
  result=$? ; if [[ "$result" -gt 0 ]] ; then
276
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
296
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
277
297
  fi
278
298
 
279
- \rm -rf "$rvm_ruby_src_path"
280
- __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 ..."
299
+ rm -rf "$rvm_ruby_src_path"
300
+ __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"
281
301
 
282
302
  result=$? ; if [[ "$result" -gt 0 ]] ; then
283
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; __rvm_pushpop ; return $result
303
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; return $result
284
304
  fi
285
305
 
286
306
  mv "$rvm_src_path/$rvm_ruby_package_file" "$rvm_ruby_src_path"
287
307
  fi
308
+
288
309
  builtin cd "$rvm_ruby_src_path"
289
310
 
290
- \mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
311
+ mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
291
312
  if [[ -n "$rvm_ruby_configure_flags" ]] ; then
292
313
  rvm_ruby_configure_flags="${rvm_ruby_configure_flags//--/-c --}"
293
314
  fi
@@ -300,12 +321,12 @@ RubyWrapper
300
321
 
301
322
  __rvm_apply_patches "$rvm_ruby_src_path/source"
302
323
  result=$? ; if [[ "$result" -gt 0 ]] ; then
303
- "$rvm_scripts_path/log" "error" "There has been an error while trying to apply patches to ree. Aborting the installation." ; __rvm_pushpop ; return $result
324
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to apply patches to ree. Aborting the installation." ; return $result
304
325
  fi
305
326
 
306
- __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while depending on your cpu(s)..."
327
+ __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_string $rvm_ree_options $db_configure_flags $rvm_ruby_configure_flags" "#installing $rvm_ruby_string"
307
328
  result=$? ; if [[ "$result" -gt 0 ]] ; then
308
- "$rvm_scripts_path/log" "error" "There has been an error while trying to run the ree installer. Aborting the installation." ; __rvm_pushpop ; return $result
329
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to run the ree installer. Aborting the installation." ; return $result
309
330
  fi
310
331
 
311
332
  chmod +x "$rvm_ruby_home"/bin/*
@@ -314,22 +335,21 @@ RubyWrapper
314
335
  __rvm_irbrc
315
336
  __rvm_bin_script
316
337
  __rvm_post_install
317
- __rvm_pushpop
318
338
  else
319
- __rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_repo_url" "rvm_url"
320
- if [[ -z "$rvm_url" ]] ; then
339
+ __rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_repo_url" "rvm_ruby_url"
340
+ if [[ -z "$rvm_ruby_url" ]] ; then
321
341
  "$rvm_scripts_path/log" "fail" "rvm does not know the rvm repo url for '${rvm_ruby_interpreter}_${rvm_ruby_version}'"
322
342
  result=1
323
343
  else
324
- rvm_ruby_repo_url="$rvm_url"
325
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
344
+ rvm_ruby_repo_url="$rvm_ruby_url"
345
+ if [[ ${rvm_make_flags_flag:-0} -eq 1 ]] ; then __rvm_make_flags ; fi
326
346
  __rvm_install_source $*
327
347
  fi
328
348
  fi
329
349
  ;;
330
350
 
331
351
  rbx|rubinius)
332
- "$rvm_scripts_path/log" "info" "Installing pre-requisites"
352
+ "$rvm_scripts_path/log" "info" "#dependency installation"
333
353
 
334
354
  # Ensure we have a 1.8.7 compatible ruby installed.
335
355
  __rvm_ensure_has_18_compat_ruby || return 1
@@ -342,26 +362,26 @@ RubyWrapper
342
362
  builtin hash -r
343
363
 
344
364
  if [[ -n "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ $rvm_head_flag -eq 0 ]] ; then
345
- "$rvm_scripts_path/log" "info" "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
346
- "$rvm_scripts_path/fetch" "$rvm_url"
365
+ "$rvm_scripts_path/log" "info" "#downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
366
+ "$rvm_scripts_path/fetch" "$rvm_ruby_url"
347
367
  result=$? ; if [[ "$result" -gt 0 ]] ; then
348
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
368
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
349
369
  fi
350
370
  __rvm_run "extract" "gunzip < \"$rvm_archives_path/$(basename $rvm_ruby_package_file)\" | tar xf - -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
351
371
 
352
372
  result=$? ; if [[ "$result" -gt 0 ]] ; then
353
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; __rvm_pushpop ; return $result
373
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; return $result
354
374
  fi
355
375
 
356
376
  # Remove the left over folder first.
357
- \rm -rf "$rvm_ruby_src_path"
377
+ rm -rf "$rvm_ruby_src_path"
358
378
  mv "$rvm_src_path/rubinius-${rvm_ruby_version}" "$rvm_ruby_src_path"
359
379
  else
360
380
  __rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
361
381
  #rvm_ruby_home="$rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version"
362
382
  __rvm_fetch_from_github "rbx"
363
383
  result=$? ; if [[ "$result" -gt 0 ]] ; then
364
- "$rvm_scripts_path/log" "error" "There has been an error while fetching the rbx git repo. Aborting the installation." ; __rvm_pushpop ; return $result
384
+ "$rvm_scripts_path/log" "error" "There has been an error while fetching the rbx git repo. Aborting the installation." ; return $result
365
385
  fi
366
386
  fi
367
387
 
@@ -369,7 +389,7 @@ RubyWrapper
369
389
 
370
390
  __rvm_apply_patches
371
391
  result=$? ; if [[ "$result" -gt 0 ]] ; then
372
- "$rvm_scripts_path/log" "error" "There has been an error while trying to apply patches to rubinius. Aborting the installation." ; __rvm_pushpop ; return $result
392
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to apply patches to rubinius. Aborting the installation." ; return $result
373
393
  fi
374
394
 
375
395
  __rvm_db "${rvm_ruby_interpreter}_configure_flags" "db_configure_flags"
@@ -387,7 +407,7 @@ RubyWrapper
387
407
  fi
388
408
  __rvm_run "configure" "$rvm_ruby_configure" "$message"
389
409
  result=$? ; if [[ "$result" -gt 0 ]] ; then
390
- "$rvm_scripts_path/log" "error" "There has been an error while running '$rvm_ruby_configure'. Aborting the installation." ; __rvm_pushpop ; return $result
410
+ "$rvm_scripts_path/log" "error" "There has been an error while running '$rvm_ruby_configure'. Aborting the installation." ; return $result
391
411
  fi
392
412
 
393
413
  if [[ "$rvm_trace_flag" -eq 1 ]] ; then
@@ -397,7 +417,7 @@ RubyWrapper
397
417
  fi
398
418
  __rvm_run "rake" "$rvm_ruby_make" "$message"
399
419
  result=$? ; if [[ "$result" -gt 0 ]] ; then
400
- "$rvm_scripts_path/log" "error" "There has been an error while running '$rvm_ruby_configure'. Aborting the installation." ; __rvm_pushpop ; return $result
420
+ "$rvm_scripts_path/log" "error" "There has been an error while running '$rvm_ruby_configure'. Aborting the installation." ; return $result
401
421
  fi ; unset ruby
402
422
 
403
423
  # Symlink rubinius wrappers
@@ -405,14 +425,14 @@ RubyWrapper
405
425
 
406
426
  # Install IRB Wrapper on Rubinius.
407
427
  file_name="$rvm_ruby_home/bin/irb"
408
- \rm -f "$file_name"
428
+ rm -f "$file_name"
409
429
  printf '#!/usr/bin/env bash\n' > "$file_name"
410
430
  printf "exec '$rvm_ruby_home/bin/rbx' 'irb' \"\$@\"\n" >> "$file_name"
411
431
  [[ -f "$file_name" ]] && chmod +x "$file_name"
412
432
 
413
433
  # Install Gem Wrapper on Rubinius.
414
434
  file_name="$rvm_ruby_home/bin/gem"
415
- \cp -f "$rvm_ruby_home/lib/bin/gem.rb" "$file_name"
435
+ cp -f "$rvm_ruby_home/lib/bin/gem.rb" "$file_name"
416
436
  __rvm_inject_ruby_shebang "$file_name"
417
437
  [[ -f "$file_name" ]] && chmod +x "$file_name"
418
438
  unset file_name
@@ -428,34 +448,34 @@ RubyWrapper
428
448
  printf "java must be installed and in your path in order to install JRuby." ; return 1
429
449
  fi
430
450
 
431
- __rvm_pushpop "$rvm_src_path"
451
+ builtin cd "$rvm_src_path"
452
+
432
453
  __rvm_fetch_ruby
433
454
  result=$? ; if [[ "$result" -gt 0 ]] ; then
434
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
455
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
435
456
  fi
436
457
 
437
458
  builtin cd "$rvm_ruby_src_path"
438
- if [[ $rvm_head_flag -eq 1 ]] ; then __rvm_run "ant.dist" "ant dist" "Running 'ant dist' (this could take a few minutes) ..." ; fi
459
+ if [[ $rvm_head_flag -eq 1 ]] ; then __rvm_run "ant.dist" "ant dist" "#ant dist" ; fi
439
460
 
440
- \mkdir -p "$rvm_ruby_home/bin/"
461
+ mkdir -p "$rvm_ruby_home/bin/"
441
462
  if "$rvm_scripts_path/match" "$rvm_ruby_version" "1\.3" || "$rvm_scripts_path/match" "$rvm_ruby_version" "1\.2" ; then
442
463
  __rvm_run "nailgun" "builtin cd \"$rvm_ruby_src_path/tool/nailgun\" && make $rvm_make_flags" "Building Nailgun"
443
464
  else
444
465
  __rvm_run "nailgun" "builtin cd \"$rvm_ruby_src_path/tool/nailgun\" && ./configure --prefix=$rvm_ruby_home && make $rvm_make_flags" "Building Nailgun"
445
466
  fi
446
467
 
447
- __rvm_pushpop
448
-
449
- if [[ -z "$rvm_ruby_home" ]] || [[ "$rvm_ruby_home" = "/" ]] ; then echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000 ; fi
468
+ if [[ -z "${rvm_ruby_home:-""}" || "$rvm_ruby_home" = "/" ]] ; then echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000 ; fi
450
469
 
451
- \rm -rf "$rvm_ruby_home"
452
- __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "Installing JRuby to $rvm_ruby_home"
470
+ rm -rf "$rvm_ruby_home"
471
+ __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "#installing JRuby to $rvm_ruby_home"
453
472
 
454
- __rvm_pushpop "$rvm_ruby_home/bin/"
455
- for binary in jirb jruby jgem ; do
456
- ln -nfs "$binary" "${binary#j}"
457
- done ; unset binary
458
- __rvm_pushpop
473
+ (
474
+ builtin cd "$rvm_ruby_home/bin/"
475
+ for binary in jirb jruby jgem ; do
476
+ ln -nfs "$binary" "${binary#j}"
477
+ done ; unset binary
478
+ )
459
479
 
460
480
  # -server is "a lot slower for short-lived scripts like rake tasks, and takes longer to load"
461
481
  #sed -e 's#^JAVA_VM=-client#JAVA_VM=-server#' $rvm_ruby_home/bin/jruby > $rvm_ruby_home/bin/jruby.new &&
@@ -480,7 +500,6 @@ RubyWrapper
480
500
  "$rvm_scripts_path/log" "info" "Copying across included gems"
481
501
  cp -R "$rvm_ruby_home/lib/ruby/gems/1.8/" "$GEM_HOME/"
482
502
  fi
483
-
484
503
  ;;
485
504
 
486
505
  maglev)
@@ -489,16 +508,16 @@ RubyWrapper
489
508
  "$rvm_scripts_path/log" "info" "Running MagLev prereqs checking script."
490
509
  "$rvm_scripts_path/maglev"
491
510
  result=$? ; if [[ "$result" -gt 0 ]] ; then
492
- "$rvm_scripts_path/log" "error" "Prerequisite checks have failed. Aborting the installation." ; __rvm_pushpop ; return $result
511
+ "$rvm_scripts_path/log" "error" "Prerequisite checks have failed. Aborting the installation." ; return $result
493
512
  fi
494
513
 
495
- __rvm_pushpop "$rvm_src_path"
514
+ builtin cd "$rvm_src_path"
496
515
 
497
- if [[ ! -d "$rvm_src_path/$rvm_ruby_string" ]] || [[ -n "$rvm_force_flag" ]] ; then
498
- \rm -rf "$rvm_src_path/$rvm_ruby_string/" "$rvm_src_path/$rvm_ruby_string/"
516
+ if [[ ! -d "$rvm_src_path/$rvm_ruby_string" || ${rvm_force_flag:-0} -eq 1 ]] ; then
517
+ rm -rf "$rvm_src_path/$rvm_ruby_string/" "$rvm_src_path/$rvm_ruby_string/"
499
518
  __rvm_fetch_ruby
500
519
  result=$? ; if [[ "$result" -gt 0 ]] ; then
501
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
520
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
502
521
  fi
503
522
  fi
504
523
 
@@ -509,13 +528,13 @@ RubyWrapper
509
528
  fi
510
529
 
511
530
  "$rvm_scripts_path/log" "info" "Downloading the GemStone package, this may take a while depending on your connection..."
531
+
512
532
  "$rvm_scripts_path/fetch" "$rvm_gemstone_url"
513
533
  result=$? ; if [[ "$result" -gt 0 ]] ; then
514
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the GemStone package. Aborting the installation." ; __rvm_pushpop ; return $result
534
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the GemStone package. Aborting the installation." ; return $result
515
535
  fi
516
536
 
517
537
  builtin cd "$rvm_src_path"
518
-
519
538
  if [[ -s "$rvm_ruby_package_file" ]] ; then
520
539
  mv "$rvm_ruby_package_file" "$rvm_ruby_src_path"
521
540
  fi
@@ -524,23 +543,22 @@ RubyWrapper
524
543
 
525
544
  __rvm_run "gemstone.extract" "gunzip < \"$rvm_archives_path/${rvm_gemstone_package_file}.${rvm_archive_extension}\" | tar xf - -C $rvm_ruby_src_path"
526
545
  result=$? ; if [[ "$result" -gt 0 ]] ; then
527
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the GemStone package. Aborting the installation." ; __rvm_pushpop ; return $result
546
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the GemStone package. Aborting the installation." ; return $result
528
547
  fi
529
548
 
530
549
  chmod -R 777 "$rvm_gemstone_package_file" # for now.
531
550
  ln -nfs "$rvm_gemstone_package_file" "gemstone"
532
551
 
533
- __rvm_pushpop
534
-
535
552
  if [[ -z "$rvm_ruby_home" ]] || [[ "$rvm_ruby_home" = "/" ]] ; then echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000 ; fi
536
- \rm -rf $rvm_ruby_home
553
+ rm -rf $rvm_ruby_home
537
554
  __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "Installing maglev to $rvm_ruby_home"
538
555
 
539
- __rvm_pushpop "$rvm_ruby_home/bin/"
540
- for binary in maglev-irb maglev-ruby maglev-gem ; do
541
- ln -nfs "$binary" "${binary#maglev-}"
542
- done ; unset binary
543
- __rvm_pushpop
556
+ (
557
+ builtin cd "$rvm_ruby_home/bin/"
558
+ for binary in maglev-irb maglev-ruby maglev-gem ; do
559
+ ln -nfs "$binary" "${binary#maglev-}"
560
+ done ; unset binary
561
+ )
544
562
 
545
563
  for binary in maglev-ruby maglev-irb maglev-gem ; do
546
564
  __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
@@ -583,66 +601,66 @@ RubyWrapper
583
601
  fi
584
602
 
585
603
  if [[ $rvm_head_flag -eq 1 ]] ; then
586
- mono_version="$(mono -V | head -n 1 | cut -d ' ' -f5)"
587
- if "$rvm_scripts_path/match" "$mono_version" "([0-9]+)\.([0-9]+)\.?([0-9]+)?" ; then
588
- mono_major_ver="$(echo "$mono_version" | cut -d '.' -f1)"
589
- mono_minor_ver="$(echo "$mono_version" | cut -d '.' -f2)"
590
- if [[ $mono_major_ver -lt 2 ]] || ( [[ $mono_major_ver -eq 2 ]] && [[ $mono_minor_ver -lt 6 ]] ) ; then
591
- printf "Mono 2.6 (or greater) must be installed and in your path in order to build IronRuby from the repository."
592
- printf "Version detected: ${mono_version}"
593
- return 1
594
- fi
595
- else
596
- printf "Cannot recognize mono version."
604
+ mono_version="$(mono -V | head -n 1 | cut -d ' ' -f5)"
605
+ if "$rvm_scripts_path/match" "$mono_version" "([0-9]+)\.([0-9]+)\.?([0-9]+)?" ; then
606
+ mono_major_ver="$(echo "$mono_version" | cut -d '.' -f1)"
607
+ mono_minor_ver="$(echo "$mono_version" | cut -d '.' -f2)"
608
+ if [[ $mono_major_ver -lt 2 ]] || ( [[ $mono_major_ver -eq 2 ]] && [[ $mono_minor_ver -lt 6 ]] ) ; then
609
+ printf "Mono 2.6 (or greater) must be installed and in your path in order to build IronRuby from the repository."
610
+ printf "Version detected: ${mono_version}"
597
611
  return 1
598
612
  fi
613
+ else
614
+ printf "Cannot recognize mono version."
615
+ return 1
616
+ fi
599
617
 
600
- __rvm_ensure_has_18_compat_ruby
618
+ __rvm_ensure_has_18_compat_ruby
601
619
 
602
- __rvm_fetch_ruby
603
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
604
- builtin cd "$rvm_ruby_src_path"
620
+ __rvm_fetch_ruby
621
+ if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
622
+ builtin cd "$rvm_ruby_src_path"
605
623
 
606
- compatible_ruby="$(__rvm_18_compat_ruby)"
624
+ compatible_ruby="$(__rvm_18_compat_ruby)"
607
625
 
608
- "$rvm_wrappers_path/$compatible_ruby/gem" install pathname2 --no-rdoc --no-ri
626
+ "$rvm_wrappers_path/$compatible_ruby/gem" install pathname2 --no-rdoc --no-ri
609
627
 
610
- # MONO_LIB=/Library/Frameworks/Mono.framework/Versions/current/lib/
611
- rvm_ruby_make="$rvm_wrappers_path/$compatible_ruby/rake MERLIN_ROOT=\"$rvm_ruby_src_path/Merlin/Main\" compile mono=1 configuration=release --trace"
612
- __rvm_run "rake" "$rvm_ruby_make" "Building IronRuby..."
613
- unset compatible_ruby
614
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
628
+ # MONO_LIB=/Library/Frameworks/Mono.framework/Versions/current/lib/
629
+ rvm_ruby_make="$rvm_wrappers_path/$compatible_ruby/rake MERLIN_ROOT=\"$rvm_ruby_src_path/Merlin/Main\" compile mono=1 configuration=release --trace"
630
+ __rvm_run "rake" "$rvm_ruby_make" "Building IronRuby..."
631
+ unset compatible_ruby
632
+ if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
615
633
 
616
- \rm -rf "$rvm_ruby_home"/*
617
- \mkdir -p "$rvm_ruby_home/bin" "$rvm_ruby_home/lib" "$rvm_ruby_home/lib/ruby" "$rvm_ruby_home/lib/IronRuby"
634
+ rm -rf "$rvm_ruby_home"/*
635
+ mkdir -p "$rvm_ruby_home/bin" "$rvm_ruby_home/lib" "$rvm_ruby_home/lib/ruby" "$rvm_ruby_home/lib/IronRuby"
618
636
 
619
- \cp -r "$rvm_ruby_src_path/Merlin/Main/Bin/mono_release"/* "$rvm_ruby_home/bin/"
620
- \cp -r "$rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Scripts/bin"/* "$rvm_ruby_home/bin/"
621
- \cp -r "$rvm_ruby_src_path/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby"/* "$rvm_ruby_home/lib/ruby"
622
- \cp -r "$rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Libs"/* "$rvm_ruby_home/lib/IronRuby"
637
+ cp -r "$rvm_ruby_src_path/Merlin/Main/Bin/mono_release"/* "$rvm_ruby_home/bin/"
638
+ cp -r "$rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Scripts/bin"/* "$rvm_ruby_home/bin/"
639
+ cp -r "$rvm_ruby_src_path/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby"/* "$rvm_ruby_home/lib/ruby"
640
+ cp -r "$rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Libs"/* "$rvm_ruby_home/lib/IronRuby"
623
641
  else
624
642
  "$rvm_scripts_path/log" "info" "Retrieving IronRuby"
625
643
 
626
- "$rvm_scripts_path/fetch" "$rvm_url" "$rvm_ruby_package_file"
644
+ "$rvm_scripts_path/fetch" "$rvm_ruby_url" "$rvm_ruby_package_file"
627
645
  result=$? ; if [[ "$result" -gt 0 ]] ; then
628
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
646
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
629
647
  fi
630
648
 
631
- \mkdir -p "$rvm_ruby_src_path" "$rvm_ruby_home"
649
+ mkdir -p "$rvm_ruby_src_path" "$rvm_ruby_home"
632
650
  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"
633
651
  result=$? ; if [[ "$result" -gt 1 ]] ; then
634
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation." ; __rvm_pushpop ; return $result
652
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation." ; return $result
635
653
  fi
636
654
 
637
655
  for dir in bin lib silverlight ; do
638
- \cp -Rf "$rvm_src_path/$rvm_ruby_string/$dir" "$rvm_ruby_home/$dir"
656
+ cp -Rf "$rvm_src_path/$rvm_ruby_string/$dir" "$rvm_ruby_home/$dir"
639
657
  done
640
658
  fi
641
659
 
642
660
  binaries=(gem irb rdoc rake ri ruby)
643
661
  for binary_name in ${binaries[@]} ; do
644
662
  if [[ -s "$rvm_ruby_home/bin/$binary_name" ]] ; then
645
- \tr -d '\r' < "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
663
+ tr -d '\r' < "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
646
664
  #sed -e '1,1s=.*=#!'"/usr/bin/env ir=" "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new"
647
665
  mv -f "$rvm_ruby_home/bin/$binary_name.new" "$rvm_ruby_home/bin/$binary_name"
648
666
  chmod +x "$rvm_ruby_home/bin/$binary_name"
@@ -658,7 +676,7 @@ RubyWrapper
658
676
  ;;
659
677
 
660
678
  mput|shyouhei)
661
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
679
+ if [[ ${rvm_make_flags_flag:-0} -eq 1 ]] ; then __rvm_make_flags ; fi
662
680
  unset BUNDLE_PATH GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
663
681
  __rvm_remove_rvm_from_path
664
682
  __rvm_conditionally_add_bin_path ; export PATH
@@ -682,18 +700,20 @@ RubyWrapper
682
700
  fi
683
701
 
684
702
  if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
685
- (($rvm_debug_flag)) && "$rvm_scripts_path/log" "debug" "Skipping configure step, Makefile exists so configure must have already been run."
703
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
704
+ "$rvm_scripts_path/log" "debug" "Skipping configure step, Makefile exists so configure must have already been run."
705
+ fi
686
706
  elif [[ -n "$rvm_ruby_configure" ]] ; then
687
707
  __rvm_run "configure" "$rvm_ruby_configure"
688
708
  result=$? ; if [[ "$result" -gt 0 ]] ; then
689
- "$rvm_scripts_path/log" "error" "There has been an error while trying to configure the source. Aborting the installation." ; __rvm_pushpop ; return $result
709
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to configure the source. Aborting the installation." ; return $result
690
710
  fi
691
711
 
692
712
  elif [[ -s ./configure ]] ; then
693
713
  local configure_command="./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags"
694
714
  __rvm_run "configure" "" "Configuring $rvm_ruby_string using $rvm_ruby_configure_flags, this may take a while depending on your cpu(s)..."
695
715
  result=$? ; if [[ "$result" -gt 0 ]] ; then
696
- "$rvm_scripts_path/log" "error" "There has been an error while trying to configure the source. Aborting the installation." ; __rvm_pushpop ; return $result
716
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to configure the source. Aborting the installation." ; return $result
697
717
  fi
698
718
  else
699
719
  "$rvm_scripts_path/log" "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
@@ -702,13 +722,13 @@ RubyWrapper
702
722
  rvm_ruby_make=${rvm_ruby_make:-"make"}
703
723
  __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while depending on your cpu(s)..."
704
724
  result=$? ; if [[ "$result" -gt 0 ]] ; then
705
- "$rvm_scripts_path/log" "error" "There has been an error while trying to run make. Aborting the installation." ; __rvm_pushpop ; return $result
725
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to run make. Aborting the installation." ; return $result
706
726
  fi
707
727
 
708
728
  rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
709
729
  __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string"
710
730
  result=$? ; if [[ "$result" -gt 0 ]] ; then
711
- "$rvm_scripts_path/log" "error" "There has been an error while trying to run make install. Aborting the installation." ; __rvm_pushpop ; return $result
731
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to run make install. Aborting the installation." ; return $result
712
732
  fi
713
733
 
714
734
  "$rvm_scripts_path/log" "info" "Installation of $rvm_ruby_string is complete."
@@ -721,15 +741,18 @@ RubyWrapper
721
741
  __rvm_bin_script
722
742
  __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*"
723
743
  __rvm_post_install
724
- __rvm_pushpop
725
744
  ;;
726
745
 
727
746
  ruby)
728
- __rvm_check_for_bison # Run like hell
747
+ __rvm_check_for_bison # && Run like hell...
729
748
  result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
749
+ if [[ ${rvm_make_flags_flag:-0} -eq 1 ]] ; then __rvm_make_flags ; fi
730
750
 
731
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
732
- __rvm_install_source $*
751
+ (
752
+ __rvm_install_source $*
753
+ )
754
+
755
+ result=$?
733
756
  ;;
734
757
 
735
758
  default)
@@ -743,12 +766,14 @@ RubyWrapper
743
766
  rvm_hook="after_install" ; source "$rvm_scripts_path/hook"
744
767
 
745
768
  if [[ -n "$ruby_options" ]] ; then RUBYOPT="$ruby_options" ; export RUBYOPT ; fi
769
+
770
+ return $result
746
771
  }
747
772
 
748
773
  __rvm_fetch_from_github() {
749
- \rm -rf "$rvm_ruby_src_path"
774
+ rm -rf "$rvm_ruby_src_path"
750
775
  if [[ ! -d "$rvm_ruby_repo_path/.git" ]] ; then
751
- \rm -rf "$rvm_ruby_repo_path"
776
+ rm -rf "$rvm_ruby_repo_path"
752
777
  builtin cd "$rvm_home"
753
778
  __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_repo_path" "Cloning $rvm_ruby_repo_url"
754
779
  result=$? ; if [[ "$result" -gt 0 ]] ; then
@@ -767,8 +792,9 @@ __rvm_fetch_from_github() {
767
792
 
768
793
  __rvm_fetch_ruby() {
769
794
  [[ -z "$rvm_ruby_selected_flag" ]] && __rvm_select
795
+ "$rvm_scripts_path/log" "info" "#fetching ${rvm_ruby_string}"
770
796
 
771
- if [[ $rvm_head_flag -eq 0 && -z "$rvm_ruby_tag" && -z "$rvm_ruby_revision" ]] ; then
797
+ if [[ ${rvm_head_flag:-0} -eq 0 && -z "${rvm_ruby_tag:-""}" && -z "${rvm_ruby_revision:-""}" ]] ; then
772
798
  rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_string"}"
773
799
  rvm_ruby_package_file="${rvm_ruby_package_file:-"$rvm_ruby_package_name"}"
774
800
  if [[ "ruby" = "$rvm_ruby_interpreter" ]]; then
@@ -779,66 +805,66 @@ __rvm_fetch_ruby() {
779
805
 
780
806
  if [[ ! -s "$rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension" ]] ; then
781
807
  if [[ "ruby" = "$rvm_ruby_interpreter" ]] ; then
782
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_release_version}.${rvm_major_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
808
+ rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_release_version}.${rvm_ruby_major_version}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
783
809
  elif [[ "ree" = "$rvm_ruby_interpreter" ]] ; then
784
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
810
+ rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
785
811
  elif [[ "jruby" = "$rvm_ruby_interpreter" ]] ; then
786
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_version}/${rvm_ruby_package_file}.${rvm_archive_extension}"
812
+ rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_version}/${rvm_ruby_package_file}.${rvm_archive_extension}"
787
813
  elif [[ "maglev" = "$rvm_ruby_interpreter" ]] ; then
788
814
  : # Should already be set from selector
789
815
  else
790
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
816
+ rvm_ruby_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/${rvm_ruby_package_file}.${rvm_archive_extension}"
791
817
  fi
792
818
  "$rvm_scripts_path/log" "info" "Downloading ${rvm_ruby_package_file}, this may take a while depending on your connection..."
793
- "$rvm_scripts_path/fetch" "${rvm_url}"
819
+ "$rvm_scripts_path/fetch" "${rvm_ruby_url}"
794
820
  result=$? ; if [[ "$result" -gt 0 ]] ; then
795
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
821
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
796
822
  fi
797
823
  fi
798
824
 
799
- if [[ ! -d "$rvm_ruby_src_path" ]] || [[ -n "$rvm_force_flag" ]] ; then
800
- \rm -rf "$rvm_ruby_src_path" # Especially when forced, we want to ensure the destination is missing.
825
+ if [[ ! -d "$rvm_ruby_src_path" || ${rvm_force_flag:-0} -eq 1 ]] ; then
826
+ rm -rf "$rvm_ruby_src_path" # Especially when forced, we want to ensure the destination is missing.
801
827
 
802
- \mkdir -p "/tmp/rvm_src_$$"
828
+ mkdir -p "/tmp/rvm_src_$$"
803
829
 
804
830
  if [[ "tar.gz" = "$rvm_archive_extension" ]] || [[ "tgz" = "$rvm_archive_extension" ]] ; then
805
- __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 ..."
831
+ __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"
806
832
  result=$? ; if [[ "$result" -gt 0 ]] ; then
807
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; __rvm_pushpop ; return $result
833
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; return $result
808
834
  fi
809
835
  elif [[ "zip" = "$rvm_archive_extension" ]] ; then
810
836
  __rvm_run "extract" "unzip -q -o $rvm_archives_path/$rvm_ruby_package_file -d /tmp/rvm_src_$$"
811
837
  result=$? ; if [[ "$result" -gt 0 ]] ; then
812
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation." ; __rvm_pushpop ; return $result
838
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation." ; return $result
813
839
  fi
814
840
  elif [[ "tar.bz2" = "$rvm_archive_extension" ]] ; then
815
- __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 ..."
841
+ __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"
816
842
  result=$? ; if [[ "$result" -gt 0 ]] ; then
817
- "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; __rvm_pushpop ; return $result
843
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to extract the source. Aborting the installation." ; return $result
818
844
  fi
819
845
  fi
820
846
 
821
- mv "/tmp/rvm_src_$$/$(builtin cd /tmp/rvm_src_$$ ; \ls)" "$rvm_ruby_src_path" ; \rm -rf "/tmp/rvm_src_$$"
847
+ mv "/tmp/rvm_src_$$/$(builtin cd /tmp/rvm_src_$$ ; ls)" "$rvm_ruby_src_path" ; rm -rf "/tmp/rvm_src_$$"
822
848
 
823
- if [[ -n "$rvm_ruby_name" ]] && [[ -d "$rvm_src_path/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]] ; then
849
+ if [[ -n "${rvm_ruby_name:-""}" && -d "$rvm_src_path/$(echo $rvm_ruby_string | sed -e 's/-n.*//')" ]] ; then
824
850
  mv "$rvm_src_path/$(echo "$rvm_ruby_string" | sed -e 's/-n.*//')" "$rvm_ruby_src_path"
825
851
  fi
826
852
 
827
853
  else
828
- "$rvm_scripts_path/log" "info" "$rvm_ruby_src_path has already been extracted." ; __rvm_pushpop ; return 0
854
+ "$rvm_scripts_path/log" "info" "#extracting $rvm_ruby_string to $rvm_ruby_src_path (already extracted)" ; return 0
829
855
  fi
830
856
 
831
857
  else
832
858
 
833
- \mkdir -p "$rvm_repo_path"
834
- if [[ -n "$(echo "$rvm_url" | awk '/^git/')" ]] ; then
859
+ mkdir -p "$rvm_repo_path"
860
+ if [[ -n "$(echo "$rvm_ruby_url" | awk '/^git/')" ]] ; then
835
861
  if [[ -d "$rvm_ruby_repo_path/.git" ]] ; then
836
862
  builtin cd "$rvm_ruby_repo_path"
837
863
  if [[ -z "$rvm_ruby_revision" ]] ; then
838
864
  "$rvm_scripts_path/log" "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
839
865
  git pull origin master --force
840
866
  result=$? ; if [[ "$result" -gt 0 ]] ; then
841
- "$rvm_scripts_path/log" "error" "There has been an error while trying to update the source from the remote repository. Aborting the installation." ; __rvm_pushpop ; return $result
867
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to update the source from the remote repository. Aborting the installation." ; return $result
842
868
  fi
843
869
  else
844
870
  if [[ -z "$rvm_ruby_sha" ]] ; then
@@ -847,11 +873,11 @@ __rvm_fetch_ruby() {
847
873
  git checkout $(echo "$rvm_ruby_sha" | sed 's#^s##')
848
874
  fi
849
875
  result=$? ; if [[ "$result" -gt 0 ]] ; then
850
- "$rvm_scripts_path/log" "error" "There has been an error while trying to checkout the source branch. Aborting the installation." ; __rvm_pushpop ; return $result
876
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to checkout the source branch. Aborting the installation." ; return $result
851
877
  fi
852
878
  fi
853
879
  else
854
- \rm -rf "$rvm_ruby_repo_path"
880
+ rm -rf "$rvm_ruby_repo_path"
855
881
  rvm_ruby_repo_http_url="${rvm_ruby_repo_url//git:/http:/}"
856
882
  "$rvm_scripts_path/log" "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
857
883
  git clone --depth 1 "$rvm_ruby_repo_url" "$rvm_ruby_repo_path"
@@ -859,26 +885,26 @@ __rvm_fetch_ruby() {
859
885
  "$rvm_scripts_path/log" "info" "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..."
860
886
  git clone "$rvm_ruby_repo_http_url" "$rvm_ruby_repo_path"
861
887
  result=$? ; if [[ "$result" -gt 0 ]] ; then
862
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the repository. Aborting the installation." ; __rvm_pushpop ; return $result
888
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the repository. Aborting the installation." ; return $result
863
889
  fi
864
890
  fi
865
891
  fi
866
892
  else
867
893
  if [[ -n "$rvm_ruby_tag" ]] ; then
868
894
  # TODO: Check if tag v is valid
869
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/tags/$(echo "$rvm_ruby_tag" | sed 's/^t//')"}"
895
+ rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/tags/$(echo "$rvm_ruby_tag" | sed 's/^t//')"}"
870
896
  elif [[ -z "$rvm_ruby_version" && $rvm_head_flag -eq 1 ]] ; then
871
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/trunk"}"
872
- elif [[ "$rvm_major_version" = "9" ]] ; then
873
- if [[ -z "$rvm_minor_version" || "$rvm_minor_version" = 3 ]] ; then
874
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/trunk"}"
897
+ rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/trunk"}"
898
+ elif [[ "$rvm_ruby_major_version" = "9" ]] ; then
899
+ if [[ -z "$rvm_ruby_minor_version" || "$rvm_ruby_minor_version" = 3 ]] ; then
900
+ rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/trunk"}"
875
901
  else
876
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_release_version}_${rvm_major_version}_${rvm_minor_version}"}"
902
+ rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}_${rvm_ruby_minor_version}"}"
877
903
  fi
878
- elif [[ -z "$rvm_minor_version" ]] || [[ "$rvm_major_version.$rvm_minor_version" = "8.8" ]] ; then
879
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_release_version}_${rvm_major_version}"}"
904
+ elif [[ -z "$rvm_ruby_minor_version" ]] || [[ "$rvm_ruby_major_version.$rvm_ruby_minor_version" = "8.8" ]] ; then
905
+ rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}"}"
880
906
  else
881
- rvm_url="${rvm_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_release_version}_${rvm_major_version}_${rvm_minor_version}"}"
907
+ rvm_ruby_url="${rvm_ruby_url:-"$rvm_ruby_repo_url/branches/ruby_${rvm_ruby_release_version}_${rvm_ruby_major_version}_${rvm_ruby_minor_version}"}"
882
908
  fi
883
909
  rvm_rev=""
884
910
  if [ -n "$rvm_ruby_revision" ] ; then
@@ -887,25 +913,25 @@ __rvm_fetch_ruby() {
887
913
 
888
914
  if [[ -d "$rvm_ruby_repo_path/.svn" ]] ; then
889
915
  builtin cd "$rvm_ruby_repo_path"
890
- "$rvm_scripts_path/log" "info" "Updating ruby from $rvm_url"
891
- __rvm_run "svn.switch" "svn switch $rvm_url"
916
+ "$rvm_scripts_path/log" "info" "Updating ruby from $rvm_ruby_url"
917
+ __rvm_run "svn.switch" "svn switch $rvm_ruby_url"
892
918
  __rvm_run "svn.update" "svn update"
893
919
  if [[ -n "$rvm_rev" ]] ; then
894
- "$rvm_scripts_path/log" "info" "Checking out revision ${rvm_rev/-r/-r } from $rvm_url"
920
+ "$rvm_scripts_path/log" "info" "Checking out revision ${rvm_rev/-r/-r } from $rvm_ruby_url"
895
921
  __rvm_run "svn.checkout" "svn update -q ${rvm_rev/-r/-r }"
896
922
  fi
897
923
  else
898
- \rm -rf "$rvm_ruby_repo_path"
899
- __rvm_run "svn.checkout" "svn checkout -q ${rvm_rev/-r/-r } $rvm_url $rvm_ruby_repo_path" "Downloading source from ${rvm_url}."
924
+ rm -rf "$rvm_ruby_repo_path"
925
+ __rvm_run "svn.checkout" "svn checkout -q ${rvm_rev/-r/-r } $rvm_ruby_url $rvm_ruby_repo_path" "Downloading source from ${rvm_ruby_url}."
900
926
  fi
901
927
  result=$? ; if [[ "$result" -gt 0 ]] ; then
902
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch / update the source. Aborting the installation." ; __rvm_pushpop ; return $result
928
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch / update the source. Aborting the installation." ; return $result
903
929
  fi
904
930
 
905
931
  fi
906
932
  "$rvm_scripts_path/log" "info" "Copying from repo to src path..."
907
- \rm -rf "$rvm_ruby_src_path"
908
- \cp -R "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
933
+ rm -rf "$rvm_ruby_src_path"
934
+ cp -R "$rvm_ruby_repo_path" "$rvm_ruby_src_path"
909
935
  fi
910
936
  }
911
937
 
@@ -925,12 +951,12 @@ __rvm_uninstall_ruby() {
925
951
  for dir in "$rvm_rubies_path" ; do
926
952
  if [[ -d "$dir/$rvm_ruby_string" ]] ; then
927
953
  "$rvm_scripts_path/log" "info" "Removing $dir/$rvm_ruby_string..."
928
- \rm -rf $dir/$rvm_ruby_string
954
+ rm -rf $dir/$rvm_ruby_string
929
955
  else
930
956
  "$rvm_scripts_path/log" "info" "$dir/$rvm_ruby_string has already been removed."
931
957
  fi
932
958
  if [[ -e "$rvm_bin_path/$rvm_ruby_string" ]] ; then
933
- \rm -f "$rvm_bin_path/$rvm_ruby_string"
959
+ rm -f "$rvm_bin_path/$rvm_ruby_string"
934
960
  fi
935
961
  done ; unset dir
936
962
 
@@ -946,24 +972,28 @@ __rvm_uninstall_ruby() {
946
972
  }
947
973
 
948
974
  __rvm_remove_ruby() {
949
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
975
+ if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
976
+
977
+ if [[ -n "${rvm_ruby_string:-""}" ]] ; then
950
978
 
951
- if [[ -n "$rvm_ruby_string" ]] ; then
952
979
  for dir in $rvm_src_path $rvm_rubies_path ; do
980
+
953
981
  if [[ -d $dir/$rvm_ruby_string ]] ; then
954
982
  "$rvm_scripts_path/log" "info" "Removing $dir/$rvm_ruby_string..."
955
- \rm -rf $dir/$rvm_ruby_string
983
+ rm -rf $dir/$rvm_ruby_string
984
+
956
985
  else
957
986
  "$rvm_scripts_path/log" "info" "it seems that $dir/$rvm_ruby_string is already non existent."
958
987
  fi
959
988
 
960
989
  if [[ -e "$rvm_bin_path/$rvm_ruby_string" ]] ; then
961
- \rm -f "$rvm_bin_path/$rvm_ruby_string"
990
+ rm -f "$rvm_bin_path/$rvm_ruby_string"
962
991
  fi
963
992
 
964
993
  __rvm_check_default
965
994
 
966
995
  done ; unset dir
996
+
967
997
  __rvm_remove_install_record "$rvm_ruby_string"
968
998
  __rvm_remove_gemsets
969
999
  __rvm_remove_archives
@@ -977,12 +1007,14 @@ __rvm_remove_ruby() {
977
1007
  }
978
1008
 
979
1009
  __rvm_remove_gemsets() {
980
- if [[ -n "$rvm_gems_flag" ]] ; then
1010
+ if [[ ${rvm_gems_flag:-0} -eq 1 ]] ; then
981
1011
  "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string gemsets..."
982
- gemsets="$rvm_gems_path/$rvm_ruby_string $(\ls -d "${rvm_gems_path}"/* | awk '/'$rvm_ruby_string'@/')"
1012
+
1013
+ gemsets="$rvm_gems_path/$rvm_ruby_string $(ls -d "${rvm_gems_path}"/* | awk '/'$rvm_ruby_string'@/')"
1014
+
983
1015
  for gemset in $gemsets ; do
984
1016
  if [[ -d "$gemset" ]] ; then
985
- \rm -rf "$gemset"
1017
+ rm -rf "$gemset"
986
1018
  fi
987
1019
  done ; unset gemset gemsets
988
1020
  fi
@@ -990,58 +1022,77 @@ __rvm_remove_gemsets() {
990
1022
 
991
1023
  __rvm_remove_wrappers() {
992
1024
  "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string wrappers..."
993
- wrappers="$rvm_wrappers_path/$rvm_ruby_string $(\ls -d "$rvm_wrappers_path"/* 2>/dev/null | awk '/'$rvm_ruby_string'@/')"
1025
+
1026
+ local wrappers wrapper
1027
+
1028
+ wrappers="$rvm_wrappers_path/$rvm_ruby_string $(ls -d "$rvm_wrappers_path"/* 2>/dev/null | awk '/'$rvm_ruby_string'@/')"
1029
+
994
1030
  for wrapper in $wrappers ; do
995
- \rm -rf "$wrapper"
996
- done ; unset wrapper wrappers
1031
+ rm -rf "$wrapper"
1032
+ done
1033
+
1034
+ return 0
997
1035
  }
998
1036
 
999
1037
  __rvm_remove_environments() {
1000
1038
  "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string environments..."
1001
- environments="$rvm_environments_path/$rvm_ruby_string $(\ls -d "$rvm_environments_path"/* | awk '/'$rvm_ruby_string'@/')"
1039
+
1040
+ local environments environment
1041
+
1042
+ environments="$rvm_environments_path/$rvm_ruby_string $(ls -d "$rvm_environments_path"/* | awk '/'$rvm_ruby_string'@/')"
1043
+
1002
1044
  for environment in $environments ; do
1003
- \rm -rf "$environment"
1004
- done ; unset environment environments
1045
+ rm -rf "$environment"
1046
+ done
1047
+
1048
+ return 0
1005
1049
  }
1006
1050
 
1007
1051
  __rvm_remove_aliases() {
1008
1052
  "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string aliases..."
1053
+
1054
+ local alias_name aliases
1055
+
1009
1056
  aliases=$(awk '/'$rvm_ruby_string'/' $rvm_config_path/alias | sed 's/=.*//')
1057
+
1010
1058
  for alias_name in $aliases ; do
1011
1059
  # Remove from alias key-value store
1012
1060
  "$rvm_scripts_path/alias" delete "$alias_name" >/dev/null 2>&1
1013
- done ; unset alias_name aliases
1061
+ done
1014
1062
  }
1015
1063
 
1016
1064
  __rvm_remove_archives() {
1017
- if [[ -n "$rvm_archive_flag" ]] ; then
1065
+ if [[ ${rvm_archive_flag:-0} -eq 1 ]] ; then
1018
1066
  "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string archives..."
1019
- \rm -f "$rvm_archives_path/${rvm_ruby_package_file}.${rvm_archive_extension}"
1067
+ rm -f "$rvm_archives_path/${rvm_ruby_package_file}.${rvm_archive_extension}"
1020
1068
  fi
1021
1069
  }
1022
1070
 
1023
1071
  __rvm_remove_binaries() {
1024
1072
  "$rvm_scripts_path/log" "info" "Removing $rvm_ruby_string binaries..."
1073
+
1025
1074
  # Iterate over all binaries and check for symlinked wrappers etc.
1026
- for binary_name in $(\ls "$rvm_bin_path"); do
1075
+ local binary_name
1076
+ for binary_name in $(ls "$rvm_bin_path"); do
1027
1077
  full_binary_path="$rvm_bin_path/$binary_name"
1078
+
1028
1079
  if [[ -L "$full_binary_path" ]] && "$rvm_scripts_path/match" "$(readlink "$full_binary_path")" "$rvm_ruby_string"; then
1029
- \rm -f "$full_binary_path"
1080
+ rm -f "$full_binary_path"
1030
1081
  fi
1031
1082
  unset full_binary_path
1032
- done; unset binary_name
1083
+ done
1033
1084
  }
1034
1085
 
1035
1086
  __rvm_post_install() {
1036
1087
  if [[ "$rvm_ruby_interpreter" != "jruby" ]] ; then
1037
1088
  binaries="${binaries:-"gem irb erb ri rdoc testrb rake"}"
1038
- "$rvm_scripts_path/log" "info" "adjusting shebangs for $rvm_ruby_string ($binaries)."
1089
+ "$rvm_scripts_path/log" "info" "#shebangs adjustment for $rvm_ruby_string ($binaries)."
1039
1090
  for binary in $(echo $binaries) ; do
1040
1091
  if [[ -e "$rvm_ruby_home/bin/$binary" ]] || [[ -e "$rvm_ruby_src_path/bin/$binary" ]] ; then
1041
1092
  if [[ "$rvm_ruby_src_path" != "$rvm_ruby_home" ]] && [[ -f "$rvm_ruby_src_path/bin/$binary" ]] ; then
1042
- \cp -f "$rvm_ruby_src_path/bin/$binary" "$rvm_ruby_home/bin/$binary"
1093
+ cp -f "$rvm_ruby_src_path/bin/$binary" "$rvm_ruby_home/bin/$binary"
1043
1094
  elif [[ -f "$rvm_ruby_gem_home/bin/$binary" ]] ; then
1044
- \cp -f "$rvm_ruby_gem_home/bin/$binary" "$rvm_ruby_home/bin/$binary"
1095
+ cp -f "$rvm_ruby_gem_home/bin/$binary" "$rvm_ruby_home/bin/$binary"
1045
1096
  fi
1046
1097
  __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
1047
1098
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
@@ -1051,7 +1102,7 @@ __rvm_post_install() {
1051
1102
  fi
1052
1103
 
1053
1104
  # Import the initial gemsets.
1054
- __rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" "'$rvm_scripts_path/gemsets' initial" "Importing initial gems..."
1105
+ __rvm_run_with_env "gemsets.initial" "$rvm_ruby_string" "'$rvm_scripts_path/gemsets' initial" "#importing initial gems"
1055
1106
 
1056
1107
  __rvm_irbrc
1057
1108
  __rvm_generate_default_docs
@@ -1089,12 +1140,12 @@ __rvm_rubygems_setup() {
1089
1140
  __rvm_inject_ruby_shebang "$rvm_ruby_src_path/bin/gem"
1090
1141
  __rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
1091
1142
 
1092
- \cp "$rvm_ruby_src_path/bin/gem" "$rvm_ruby_home/bin/gem"
1143
+ cp "$rvm_ruby_src_path/bin/gem" "$rvm_ruby_home/bin/gem"
1093
1144
 
1094
1145
  home="$GEM_HOME" ; path="$GEM_PATH" # Save
1095
1146
  for dir in $rvm_ruby_global_gems_path $rvm_ruby_gem_home ; do
1096
1147
  export GEM_HOME="$dir" ; export GEM_PATH="$dir" ; export BUNDLE_PATH="$dir"
1097
- __rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "Updating rubygems for $dir"
1148
+ __rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "#rubygems update for $dir"
1098
1149
  done ; unset home path dir
1099
1150
  GEM_HOME="$home" ; GEM_PATH="$path" ; BUNDLE_PATH="$home"
1100
1151
  export GEM_HOME GEM_PATH BUNDLE_PATH
@@ -1103,7 +1154,7 @@ __rvm_rubygems_setup() {
1103
1154
  __rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
1104
1155
 
1105
1156
  directory_name="$rvm_ruby_home/lib/ruby/gems"
1106
- version_number="${rvm_release_version}.${rvm_major_version}"
1157
+ version_number="${rvm_ruby_release_version}.${rvm_ruby_major_version}"
1107
1158
  if [[ "$version_number" == "." ]]; then
1108
1159
  version_number="$(\ls "$directory_name" | \grep '^[[:digit:]].[[:digit:]]\(.[[:digit:]]\)\?' | head -n1)"
1109
1160
  if [[ -n "$version_number" ]]; then
@@ -1115,12 +1166,16 @@ __rvm_rubygems_setup() {
1115
1166
  ruby_lib_gem_path="${directory_name}/${version_number}"
1116
1167
  fi
1117
1168
  unset directory_name version_number
1169
+
1118
1170
  elif [[ -n "$(echo "$rvm_ruby_interpreter" | awk '/^rbx|jruby/')" ]] ; then
1119
1171
  # Hands off rubygems for rbx & jruby
1120
- if [[ -n "$rvm_debug_flag" ]] ; then "$rvm_scripts_path/log" "debug" "Skipping rubygems update for $rvm_ruby_version" ; fi
1172
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
1173
+ "$rvm_scripts_path/log" "debug" "Skipping rubygems update for $rvm_ruby_version"
1174
+ fi
1121
1175
  ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/jruby"
1176
+
1122
1177
  else
1123
- "$rvm_scripts_path/log" "info" "Installing rubygems dedicated to $rvm_ruby_string..."
1178
+ "$rvm_scripts_path/log" "info" "#rubygems installing to $rvm_ruby_string"
1124
1179
  rvm_rubygems_version="$(__rvm_db "${rvm_ruby_interpreter}_rubygems_version")"
1125
1180
  rvm_rubygems_version="${rvm_rubygems_version:-"$(__rvm_db "rubygems_version")"}"
1126
1181
  rvm_rubygems_url=$(__rvm_db "rubygems_${rvm_rubygems_version}_url")
@@ -1129,33 +1184,31 @@ __rvm_rubygems_setup() {
1129
1184
  # Sanity check... If setup.rb is missing from the rubygems source path,
1130
1185
  # something went wrong. Cleanup, aisle 3!
1131
1186
  if [[ ! -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then
1132
- \rm -rf "$rvm_src_path/$rvm_gem_package_name"
1187
+ rm -rf "$rvm_src_path/$rvm_gem_package_name"
1133
1188
  fi
1134
1189
 
1135
1190
  if [[ ! -d "$rvm_src_path/$rvm_gem_package_name" ]] ; then
1136
1191
  "$rvm_scripts_path/log" "info" "Retrieving $rvm_gem_package_name"
1137
1192
  "$rvm_scripts_path/fetch" "$rvm_gem_url"
1138
1193
  result=$? ; if [[ "$result" -gt 0 ]] ; then
1139
- "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result
1194
+ "$rvm_scripts_path/log" "error" "There has been an error while trying to fetch the source. Aborting the installation." ; return $result
1140
1195
  fi
1141
- \mkdir -p "$rvm_src_path/$rvm_gem_package_name"
1196
+ mkdir -p "$rvm_src_path/$rvm_gem_package_name"
1142
1197
  __rvm_run "rubygems.extract" "gunzip < \"$rvm_archives_path/$rvm_gem_package_name.tgz\" | tar xf - -C $rvm_src_path" "Extracting $rvm_gem_package_name ..."
1143
1198
  fi
1144
1199
 
1145
1200
  builtin cd "$rvm_src_path/$rvm_gem_package_name"
1146
1201
 
1147
- __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" "Installing rubygems for $rvm_ruby_home/bin/ruby"
1202
+ __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"
1148
1203
  result=$?
1149
- if [[ $result -eq 0 ]] ; then
1150
- "$rvm_scripts_path/log" "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
1151
- else
1152
- "$rvm_scripts_path/log" "warning" "Installation of rubygems $rvm_ruby_package_name did not complete successfully."
1204
+ if [[ $result -gt 0 ]] ; then
1205
+ "$rvm_scripts_path/log" "warning" "#warning Installation of rubygems $rvm_ruby_package_name did not complete successfully."
1153
1206
  fi
1154
1207
 
1155
1208
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
1156
1209
 
1157
- if [[ -n "$rvm_major_version" ]] ; then
1158
- ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/${rvm_release_version}.$rvm_major_version"
1210
+ if [[ -n "$rvm_ruby_major_version" ]] ; then
1211
+ ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/${rvm_ruby_release_version}.$rvm_ruby_major_version"
1159
1212
  else
1160
1213
  ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/$interpreter"
1161
1214
  fi
@@ -1163,7 +1216,7 @@ __rvm_rubygems_setup() {
1163
1216
 
1164
1217
  if [[ -n "$ruby_lib_gem_path" ]]; then
1165
1218
  # Add ruby's gem path to ruby's lib direcotry.
1166
- \mkdir -p $(dirname "$ruby_lib_gem_path")
1219
+ mkdir -p $(dirname "$ruby_lib_gem_path")
1167
1220
  if [[ -d "$ruby_lib_gem_path" ]] ; then \rm -rf "$ruby_lib_gem_path" ; fi
1168
1221
  ln -nfs "$rvm_ruby_gem_home" "$ruby_lib_gem_path"
1169
1222
  fi; unset ruby_lib_gem_path
@@ -1215,8 +1268,8 @@ __rvm_actual_file() {
1215
1268
  __rvm_manage_rubies() {
1216
1269
  unset rvm_gemset_name rvm_ruby_selected_flag
1217
1270
 
1218
- rvm_ruby_gem_home=$(echo "$rvm_ruby_gem_home" | awk -F${rvm_gemset_separator} '{print $1}')
1219
- rvm_ruby_string=$(echo "$rvm_ruby_string" | awk -F${rvm_gemset_separator} '{print $1}')
1271
+ rvm_ruby_gem_home=$(echo "${rvm_ruby_gem_home:-""}" | awk -F${rvm_gemset_separator} '{print $1}')
1272
+ rvm_ruby_string=$(echo "${rvm_ruby_string:-""}" | awk -F${rvm_gemset_separator} '{print $1}')
1220
1273
 
1221
1274
  local manage_result=0
1222
1275
 
@@ -1249,7 +1302,7 @@ __rvm_manage_rubies() {
1249
1302
  unset current_manage_ruby_string
1250
1303
  __rvm_unset_ruby_variables
1251
1304
  fi
1252
- done < <(\ls "$rvm_rubies_path"/*/bin/ruby 2> /dev/null)
1305
+ done < <(ls "$rvm_rubies_path"/*/bin/ruby 2> /dev/null)
1253
1306
  else
1254
1307
  "$rvm_scripts_path/log" "warn" 'Really? '"$action"' all? See "rvm list known" and limit the selection to something more sane please :)'
1255
1308
  fi
@@ -1260,8 +1313,8 @@ __rvm_manage_rubies() {
1260
1313
  }
1261
1314
 
1262
1315
  args=($*)
1263
- action="${args[0]}"
1264
- rubies_string="${args[1]}"
1316
+ action="${args[0]:-""}"
1317
+ rubies_string="${args[1]:-""}"
1265
1318
  args="$(echo ${args[@]:2}) " # Strip trailing / leading / extra spacing.
1266
1319
 
1267
1320
  __rvm_manage_rubies