rvm 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- source "$rvm_scripts_path/base"
3
+ source "$rvm_path/scripts/base"
4
4
 
5
5
  __rvm_attempt_single_exec() {
6
6
  # Return if we have multiple rubies. or we're not running exec.
@@ -37,7 +37,7 @@ __rvm_ruby_do() {
37
37
  binary="$(basename $(command -v $binary) 2>/dev/null)"
38
38
 
39
39
  else
40
- "$rvm_scripts_path/log" "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
40
+ "$rvm_path/scripts/log" "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
41
41
  __rvm_unset_ruby_variables
42
42
  return 1
43
43
  fi
@@ -51,11 +51,11 @@ __rvm_ruby_do() {
51
51
  # TODO: the else case below should be run if $args =~ /\.rb$/
52
52
  if [[ "ruby" = "$(basename $binary)" && "$rvm_benchmark_flag" -ne 1 ]] ; then
53
53
 
54
- if "$rvm_scripts_path/match" "$args" "\.rb$" ; then
54
+ if "$rvm_path/scripts/match" "$args" "\.rb$" ; then
55
55
 
56
56
  if [[ -z "$prefix" ]] ; then prefix="-S" ; fi
57
57
 
58
- if ! "$rvm_scripts_path/match" "$args" "$prefix" ; then
58
+ if ! "$rvm_path/scripts/match" "$args" "$prefix" ; then
59
59
  args="$prefix $args"
60
60
  fi
61
61
  fi
@@ -76,7 +76,7 @@ __rvm_ruby_do() {
76
76
  if [[ "$current_env" != "$current_set_ruby" ]]; then
77
77
  current_env="$current_set_ruby ($current_env)"
78
78
  fi
79
- "$rvm_scripts_path/log" "info" "$current_env: $(ruby -v $rvm_ruby_mode | \tr "\n" ' ')\n"
79
+ "$rvm_path/scripts/log" "info" "$current_env: $(ruby -v $rvm_ruby_mode | \tr "\n" ' ')\n"
80
80
  unset current_env
81
81
  fi
82
82
  eval "$rvm_command"
@@ -126,7 +126,7 @@ __rvm_yaml() {
126
126
  if [[ -n "${ZSH_VERSION:-""}" ]] ; then array_start=1 ; else array_start=0 ; fi
127
127
  for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
128
128
  if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
129
- "$rvm_scripts_path/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
129
+ "$rvm_path/scripts/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
130
130
  fi
131
131
  yaml="$yaml\n \"${rubies[$index]}\": ${statuses[$index]}"
132
132
  done ; unset index array_start
@@ -149,7 +149,7 @@ __rvm_json() {
149
149
 
150
150
  for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
151
151
  if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
152
- "$rvm_scripts_path/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
152
+ "$rvm_path/scripts/log" "debug" "${rubies[$index]}: ${statuses[$index]}"
153
153
  fi
154
154
  json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}"
155
155
  if (( $index + 1 < $total + $array_start )) ; then json="$json, " ; fi
@@ -172,13 +172,13 @@ action="${args[0]}"
172
172
  args=${args[@]:1}
173
173
 
174
174
  if [[ -z "$action" ]] ; then
175
- "$rvm_scripts_path/log" "error" "Action must be specified."
175
+ "$rvm_path/scripts/log" "error" "Action must be specified."
176
176
  exit 1
177
177
  fi
178
178
 
179
179
  if [[ "$action" == "ruby" ]] && echo "$args" | \grep -q "^'--[^[:space:]]*'$" ; then
180
- "$rvm_scripts_path/log" "warn" "You called rvm ruby with the arguments $args which look like use options."
181
- "$rvm_scripts_path/log" "warn" "Please note that 'rvm ruby' invokes set operations instead."
180
+ "$rvm_path/scripts/log" "warn" "You called rvm ruby with the arguments $args which look like use options."
181
+ "$rvm_path/scripts/log" "warn" "Please note that 'rvm ruby' invokes set operations instead."
182
182
  fi
183
183
 
184
184
  rvm_ruby_strings=$(__rvm_expand_ruby_string "$rvm_ruby_strings")
@@ -195,6 +195,6 @@ if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
195
195
  if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
196
196
  if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
197
197
 
198
- rvm_hook="after_do" ; source "$rvm_scripts_path/hook"
198
+ rvm_hook="after_do" ; source "$rvm_path/scripts/hook"
199
199
 
200
200
  exit ${#errors[*]}
@@ -3,11 +3,11 @@
3
3
  unset GREP_COLOR
4
4
  unset GREP_OPTIONS
5
5
 
6
- source "$rvm_scripts_path/base"
6
+ source "$rvm_path/scripts/base"
7
7
 
8
8
  __error_on_result() {
9
9
  if [[ "$1" -gt 0 ]]; then
10
- "$rvm_scripts_path/log" "fail" "$2 - Aborting now."
10
+ "$rvm_path/scripts/log" "fail" "$2 - Aborting now."
11
11
  return 0
12
12
  else
13
13
  return 1
@@ -27,41 +27,47 @@ snapshot_save() {
27
27
  \rm -rf "$snapshot_temp_path"
28
28
  \mkdir -p "$snapshot_temp_path"
29
29
 
30
- "$rvm_scripts_path/log" "info" "Backing up a list of aliases"
30
+ "$rvm_path/scripts/log" "info" "Backing up a list of aliases"
31
31
  \cp "$rvm_config_path/alias" "$snapshot_temp_path/"
32
32
 
33
- "$rvm_scripts_path/log" "info" "Backing up your user preferences"
33
+ "$rvm_path/scripts/log" "info" "Backing up your user preferences"
34
34
  \cp "$rvm_config_path/user" "$snapshot_temp_path/"
35
35
 
36
- "$rvm_scripts_path/log" "info" "Backing up your installed packages"
36
+ "$rvm_path/scripts/log" "info" "Backing up your installed packages"
37
37
  sed -e 's/-//' -e 's/^lib//' < "$rvm_config_path/packages" | awk -F= '{print $1}' | sort | uniq > "$snapshot_temp_path/packages"
38
38
 
39
- "$rvm_scripts_path/log" "info" "Backing up all of your gemsets"
39
+ "$rvm_path/scripts/log" "info" "Backing up all of your gemsets"
40
40
  \mkdir -p "$snapshot_temp_path/gems"
41
41
 
42
42
  (
43
43
  builtin cd "$snapshot_temp_path/gems"
44
- for snapshot_gemset in $("$rvm_scripts_path/list" gemsets strings) ; do
45
- __rvm_become "$snapshot_gemset"
46
- result="$?"
44
+
45
+ for snapshot_gemset in $("$rvm_path/scripts/list" gemsets strings) ; do
46
+
47
+ __rvm_become "$snapshot_gemset" ; result="$?"
48
+
47
49
  __error_on_result "$result" "Error becoming ruby $snapshot_gemset" && return "$result"
48
- "$rvm_scripts_path/gemsets" export "${snapshot_gemset}.gems" >/dev/null
49
- result="$?"
50
+
51
+ "$rvm_path/scripts/gemsets" export "${snapshot_gemset}.gems" >/dev/null ; result="$?"
52
+
50
53
  __error_on_result "$result" "Error exporting gemset contents for $snapshot_gemset" && return "$result"
54
+
51
55
  \mkdir -p "./$snapshot_gemset/"
56
+
52
57
  [[ -d "$GEM_HOME/cache/" ]] && \cp -R "$GEM_HOME/cache/" "./$snapshot_gemset/"
53
- done; unset snapshot_gemset
58
+
59
+ done
54
60
  )
55
61
 
56
- "$rvm_scripts_path/log" "info" "Backing up all of your installed rubies"
62
+ "$rvm_path/scripts/log" "info" "Backing up all of your installed rubies"
57
63
  echo '#!/usr/bin/env bash -e' > "$snapshot_temp_path/install-rubies.sh"
58
- echo "source \"\$rvm_scripts_path/rvm\" || true" >> "$snapshot_temp_path/install-rubies.sh"
64
+ echo "source \"\$rvm_path/scripts/rvm\" || true" >> "$snapshot_temp_path/install-rubies.sh"
59
65
  local snapshot_ruby_name_file="$rvm_tmp_path/$$-rubies"
60
66
  local snapshot_alias_name_file="$rvm_tmp_path/$$-aliases"
61
67
  local snapshot_installable_file="$rvm_tmp_path/$$-installable"
62
68
 
63
- "$rvm_scripts_path/alias" list | awk -F ' => ' '{print $1}' | sort | uniq 2>/dev/null > "$snapshot_alias_name_file"
64
- "$rvm_scripts_path/list" strings | \tr ' ' '\n' | sort | uniq > "$snapshot_ruby_name_file"
69
+ "$rvm_path/scripts/alias" list | awk -F ' => ' '{print $1}' | sort | uniq 2>/dev/null > "$snapshot_alias_name_file"
70
+ "$rvm_path/scripts/list" strings | \tr ' ' '\n' | sort | uniq > "$snapshot_ruby_name_file"
65
71
  comm -2 -3 "$snapshot_ruby_name_file" "$snapshot_alias_name_file" > "$snapshot_installable_file"
66
72
  \rm -rf "$snapshot_ruby_name_file" "$snapshot_alias_name_file"
67
73
 
@@ -80,7 +86,7 @@ snapshot_save() {
80
86
 
81
87
  \rm -rf "$snapshot_installable_file"
82
88
 
83
- "$rvm_scripts_path/log" "info" "Compressing snapshotting"
89
+ "$rvm_path/scripts/log" "info" "Compressing snapshotting"
84
90
  local destination_path="$PWD"
85
91
  (
86
92
  builtin cd "$snapshot_temp_path"
@@ -90,10 +96,10 @@ snapshot_save() {
90
96
  __error_on_result "$result" "Error creating archive $destination_path/$1.tar.gz" && return "$result"
91
97
  )
92
98
 
93
- "$rvm_scripts_path/log" "info" "Cleaning up"
99
+ "$rvm_path/scripts/log" "info" "Cleaning up"
94
100
  \rm -rf "$snapshot_temp_path"
95
101
 
96
- "$rvm_scripts_path/log" "info" "Snapshot complete"
102
+ "$rvm_path/scripts/log" "info" "Snapshot complete"
97
103
  }
98
104
 
99
105
  snapshot_load() {
@@ -115,7 +121,7 @@ snapshot_load() {
115
121
  \rm -rf "$snapshot_temp_path"
116
122
  \mkdir -p "$snapshot_temp_path"
117
123
 
118
- "$rvm_scripts_path/log" "info" "Extracting snapshot"
124
+ "$rvm_path/scripts/log" "info" "Extracting snapshot"
119
125
  (
120
126
  builtin cd "$snapshot_temp_path"
121
127
  tar xzf "$snapshot_archive"
@@ -123,59 +129,72 @@ snapshot_load() {
123
129
  __error_on_result "$result" "Error extracting the archive '$snapshot_archive'" && return "$result"
124
130
  )
125
131
 
126
- "$rvm_scripts_path/log" "info" "Restoring user settings"
132
+ "$rvm_path/scripts/log" "info" "Restoring user settings"
127
133
  \cp -f "$snapshot_temp_path/user" "$rvm_config_path/user"
128
134
 
129
- "$rvm_scripts_path/log" "info" "Installing rvm-managed packages"
135
+ "$rvm_path/scripts/log" "info" "Installing rvm-managed packages"
130
136
  for snapshot_package in $(cat "$snapshot_temp_path/packages"); do
131
- "$rvm_scripts_path/package" install "$snapshot_package"
137
+ "$rvm_path/scripts/package" install "$snapshot_package"
132
138
  result="$?"
133
139
  __error_on_result "$result" "Error installing package '$snapshot_package'" && return "$result"
134
140
  done; unset snapshot_package
135
141
 
136
- "$rvm_scripts_path/log" "info" "Installing rubies"
142
+ "$rvm_path/scripts/log" "info" "Installing rubies"
137
143
  chmod +x "$snapshot_temp_path/install-rubies.sh"
138
144
  "$snapshot_temp_path/install-rubies.sh"
139
145
  result="$?"
140
146
  __error_on_result "$result" "Error importing rubies." && return "$result"
141
147
 
142
148
  export rvm_create_flag=1
143
- "$rvm_scripts_path/log" "info" "Setting up gemsets"
149
+ "$rvm_path/scripts/log" "info" "Setting up gemsets"
144
150
  (
145
151
  builtin cd "$snapshot_temp_path/gems"
146
- for snapshot_gemset in $(find * -iname '*.gems' -type f -maxdepth 0 | sed 's/.gems$//'); do
152
+
153
+ gems=($(find . -mindepth 0 -maxdepth 0 -type f -iname '*.gems' | sed 's/.gems$//'))
154
+
155
+ for snapshot_gemset in "${gems[@]//.\/}" ; do
156
+
147
157
  __rvm_become "$snapshot_gemset"
148
158
  result="$?"
149
- __error_on_result "$result" "Error becoming '$snapshot_gemset'" && return "$result"
159
+
160
+ __error_on_result "$result" \
161
+ "Error becoming '$snapshot_gemset'" && return "$result"
162
+
150
163
  mkdir -p "$GEM_HOME/cache/"
164
+
151
165
  cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/"
152
166
  result="$?"
153
- __error_on_result "$result" "Error copying across cache for $snapshot_gemset" && return "$result"
154
- "$rvm_scripts_path/gemsets" import "$snapshot_gemset" >/dev/null 2>&1
167
+
168
+ __error_on_result "$result" \
169
+ "Error copying across cache for $snapshot_gemset" && return "$result"
170
+
171
+ "$rvm_path/scripts/gemsets" import "$snapshot_gemset" >/dev/null 2>&1
155
172
  result="$?"
156
- __error_on_result "$result" "Error importing gemset for $snapshot_gemset" && return "$result"
173
+
174
+ __error_on_result "$result" \
175
+ "Error importing gemset for $snapshot_gemset" && return "$result"
157
176
  done
158
177
  )
159
178
 
160
- "$rvm_scripts_path/log" "info" "Restoring aliases"
179
+ "$rvm_path/scripts/log" "info" "Restoring aliases"
161
180
  while read -r package_info; do
162
181
  # Note: this assumes an '=' int the input...
163
182
  local alias_name="${package_info/=*}"
164
183
  local alias_ruby="${package_info/*=}"
165
184
 
166
- "$rvm_scripts_path/alias" create "$alias_name" "$alias_ruby"
185
+ "$rvm_path/scripts/alias" create "$alias_name" "$alias_ruby"
167
186
  if [[ "$alias_name" = "default" ]]; then
168
- (source "$rvm_scripts_path/rvm" && rvm use "$alias_ruby" --default) >/dev/null 2>&1
187
+ (source "$rvm_path/scripts/rvm" && rvm use "$alias_ruby" --default) >/dev/null 2>&1
169
188
  result="$?"
170
189
  __error_on_result "$result" "Error setting default to $alias_ruby" && return "$result"
171
190
  fi
172
191
  done < "$snapshot_temp_path/alias"
173
192
  unset package_info
174
193
 
175
- "$rvm_scripts_path/log" "info" "Cleaning up load process"
194
+ "$rvm_path/scripts/log" "info" "Cleaning up load process"
176
195
  \rm -rf "$snapshot_temp_path"
177
196
 
178
- "$rvm_scripts_path/log" "info" "Loaded snapshot from $(basename "$snapshot_archive")"
197
+ "$rvm_path/scripts/log" "info" "Loaded snapshot from $(basename "$snapshot_archive")"
179
198
  }
180
199
 
181
200
  snapshot_usage() {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- source "$rvm_scripts_path/base"
3
+ source "$rvm_path/scripts/base"
4
4
 
5
5
  usage() {
6
6
  echo "Usage: rvm tools {identifier,path-identifier,strings}" 1>&2
@@ -18,7 +18,7 @@ tools_path_identifier() {
18
18
  return 1
19
19
  fi
20
20
 
21
- source "$rvm_scripts_path/rvm"
21
+ source "$rvm_path/scripts/rvm"
22
22
  builtin cd "$1"
23
23
  rvm_promptless=1 __rvm_project_rvmrc
24
24
  rvmrc_result="$?"
@@ -126,7 +126,7 @@ Be sure to get head often as rvm development happens fast,
126
126
  you can do this by running 'rvm update --head' followed by 'rvm reload'
127
127
  or opening a new shell
128
128
 
129
- w⦿‿⦿$
129
+ w⦿‿⦿t
130
130
 
131
131
  ~ Wayne
132
132
 
@@ -145,7 +145,7 @@ Upgrade Notes
145
145
  rvm remove X ; rvm install X
146
146
 
147
147
  * If you wish to have the 'pretty colors' again, set in ~/.rvmrc:
148
- export rvm_pretty_print=1
148
+ export rvm_pretty_print_flag=1
149
149
  "
150
150
  }
151
151
 
@@ -192,6 +192,7 @@ __rvm_initialize
192
192
  item="* "
193
193
  question="\n<?>"
194
194
  cwd="$PWD"
195
+
195
196
  source_path="${source_path:-$cwd}"
196
197
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
197
198
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
@@ -209,13 +210,10 @@ fi
209
210
 
210
211
  rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
211
212
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
212
- rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
213
213
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
214
214
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
215
215
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
216
216
 
217
- export rvm_gemset_separator="@" # TODO: Remove this after a while.
218
-
219
217
  printf "
220
218
  RVM: Shell scripts enabling management of multiple ruby environments.
221
219
  RTFM: http://rvm.beginrescueend.com/
@@ -223,35 +221,60 @@ printf "
223
221
  "
224
222
 
225
223
  if [[ ${upgrade_flag:-0} -eq 1 ]] ;then
224
+
226
225
  printf "\nUpgrading the RVM installation in $rvm_path/"
226
+
227
227
  else
228
- printf "\nInstalling rvm to $rvm_path/"
228
+
229
+ printf "\nInstalling RVM to $rvm_path/"
230
+
229
231
  fi
230
232
 
231
- mkdir -p "$rvm_archives_path" "$rvm_src_path" "$rvm_log_path" "$rvm_bin_path" "$rvm_gems_path" "$rvm_rubies_path" "$rvm_config_path" "$rvm_hooks_path" "$rvm_tmp_path"
233
+ for directory in "$rvm_archives_path" "$rvm_src_path" "$rvm_log_path" "$rvm_bin_path" "$rvm_gems_path" "$rvm_rubies_path" "$rvm_config_path" "$rvm_hooks_path" "$rvm_tmp_path" ; do
234
+
235
+ if [[ ! -d "$directory" ]] ; then
236
+
237
+ mkdir -p "$directory"
238
+
239
+ fi
240
+
241
+ done
232
242
 
233
243
  for file in README LICENCE ; do
244
+
234
245
  cp -f "$source_path/$file" "$rvm_path/"
246
+
235
247
  done
236
248
 
237
249
  #
238
250
  # Scripts
239
251
  #
240
252
  for dir_name in config scripts examples lib hooks help patches; do
241
- mkdir -p "$rvm_path/$dir_name"
253
+
242
254
  if [[ -d "$source_path/$dir_name" ]] ; then
255
+
256
+ if [[ ! -d "$rvm_path/$dir_name" ]] ; then
257
+
258
+ mkdir -p "$rvm_path/$dir_name"
259
+
260
+ fi
261
+
243
262
  cp -Rf "$source_path/$dir_name" "$rvm_path"
263
+
244
264
  fi
245
- done ; unset dir_name
265
+
266
+ done
246
267
 
247
268
  if [[ ! -s "$rvm_config_path/user" ]] ; then
248
- mkdir -p "$rvm_config_path/"
249
269
  echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_config_path/user"
250
270
  fi
251
271
 
252
- scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
272
+ scripts=(monitor match log install color db fetch log set package)
273
+
253
274
  for script_name in "${scripts[@]}" ; do
254
- chmod +x "$rvm_scripts_path/$script_name" 2>/dev/null # Hide errors.
275
+
276
+ chmod +x "$rvm_path/scripts/$script_name" 2>/dev/null # Hide errors.
277
+
255
278
  done
256
279
 
257
280
  #
@@ -259,29 +282,48 @@ done
259
282
  #
260
283
  # Cleanse and purge...
261
284
  for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
285
+
262
286
  rm -f "$rvm_bin_path/$file"
287
+
263
288
  cp -f "$source_path/binscripts/$file" $rvm_bin_path/
289
+
264
290
  done
265
- chmod +x "$rvm_bin_path"/*
291
+
292
+ chmod +x "$rvm_bin_path"/* # TODO: this is quite suboptimal.
266
293
 
267
294
  #
268
295
  # RC Files
269
296
  #
270
297
  if [[ -n "$rvm_auto_flag" ]] ; then
298
+
271
299
  printf "Checking rc files... ($rvm_rc_files)"
300
+
272
301
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
302
+
273
303
  for rcfile in $(printf $rvm_rc_files) ; do
304
+
274
305
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
306
+
275
307
  if [[ -s "$HOME/.profile" ]] ; then
308
+
276
309
  if ! grep -q '.profile' "$rcfile" ; then
310
+
277
311
  echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
312
+
278
313
  printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> "$rcfile"
314
+
279
315
  fi
316
+
280
317
  fi
318
+
281
319
  if ! grep -q "scripts\/rvm" "$rcfile" ; then
282
- echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
283
- printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> "$rcfile"
320
+
321
+ echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
322
+
323
+ printf "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> "$rcfile"
324
+
284
325
  fi
326
+
285
327
  done
286
328
  fi
287
329
  fi
@@ -290,47 +332,91 @@ fi
290
332
  # Initial Interpreter Gemsets.
291
333
  #
292
334
  if [[ -d gemsets/ ]] ; then
293
- mkdir -p "$rvm_gemsets_path"
335
+
336
+ if [[ ! -d "$rvm_path/gemsets" ]] ; then
337
+
338
+ mkdir -p "$rvm_path/gemsets"
339
+
340
+ fi
294
341
 
295
342
  for gemset_file in $(builtin cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
296
- destination="$rvm_gemsets_path/$gemset_file"
343
+
344
+ destination="$rvm_path/gemsets/$gemset_file"
345
+
297
346
  destination_path="$(dirname "$destination")"
347
+
298
348
  if [[ ! -s "$destination" ]] ; then
349
+
299
350
  mkdir -p "$destination_path"
351
+
300
352
  cp "gemsets/$gemset_file" "$destination"
353
+
301
354
  fi
302
- done ; unset destination destination_path gemset_file
355
+
356
+ done
357
+
358
+ unset destination destination_path gemset_file
359
+
303
360
  fi
304
361
 
305
362
  if [[ -d patchsets/ ]] ; then
306
- mkdir -p "$rvm_patchsets_path"
307
- for patchset_file in $(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
308
- destination="$rvm_patchsets_path/$patchset_file"
309
- destination_path="$(dirname "$destination")"
363
+
364
+ if [[ ! -d "$rvm_path/patchsets" ]] ; then
365
+
366
+ mkdir -p "$rvm_path/patchsets"
367
+
368
+ fi
369
+
370
+ patchsets=($(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///'))
371
+
372
+ for patchset_file in "${patchsets[@]}" ; do
373
+
374
+ destination="$rvm_path/patchsets/$patchset_file"
375
+
310
376
  if [[ ! -s "$destination" ]] ; then
377
+
378
+ destination_path="$(dirname "$destination")"
379
+
311
380
  mkdir -p "$destination_path"
381
+
312
382
  cp "patchsets/$patchset_file" "$destination"
383
+
313
384
  fi
314
- done ; unset destination destination_path patchset_file
385
+ done
386
+
315
387
  fi
316
388
 
317
389
  #
318
390
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
319
391
  #
320
392
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
393
+
321
394
  mkdir -p "$rvm_rubies_path/"
395
+
322
396
  for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do
397
+
323
398
  if [[ -d "$ruby" ]] ; then
399
+
324
400
  mv "$ruby" "$rvm_rubies_path/"
401
+
325
402
  new_path="$rvm_rubies_path/$(basename $ruby)"
403
+
326
404
  for file in gem rake ; do
405
+
327
406
  if [[ -s "$new_path/bin/$file" ]] ; then
407
+
328
408
  sed -e '1,1s=.*=#!'"${new_path}/bin/ruby=" "${new_path}/bin/${file}" > "${new_path}/bin/${file}.new"
409
+
329
410
  mv -f "$new_path/bin/$file.new" "$new_path/bin/$file"
411
+
330
412
  chmod +x "$new_path/bin/$file"
413
+
331
414
  fi
415
+
332
416
  done
417
+
333
418
  fi
419
+
334
420
  done
335
421
  #
336
422
  # End of rubies migration.
@@ -340,36 +426,60 @@ done
340
426
  # Migrate old gemset directories to new gemset pattern.
341
427
  #
342
428
  for gemset in "$rvm_path"/gems/*\%* ; do
343
- new_path=${gemset/\%/${rvm_gemset_separator}}
429
+
430
+ new_path=${gemset/\%/${rvm_gemset_separator:-"@"}}
431
+
344
432
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
433
+
345
434
  printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
435
+
346
436
  mv "$gemset" "$new_path"
437
+
347
438
  fi
439
+
348
440
  done
349
441
 
350
442
  for gemset in "$rvm_path"/gems/*\+* ; do
351
- new_path=${gemset/\+/${rvm_gemset_separator}}
443
+
444
+ new_path=${gemset/\+/${rvm_gemset_separator:-"@"}}
445
+
352
446
  if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
447
+
353
448
  printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
449
+
354
450
  mv $gemset $new_path
451
+
355
452
  fi
453
+
356
454
  done
357
455
 
358
456
  for gemset in "$rvm_path"/gems/*\@ ; do
457
+
359
458
  new_path=$(echo $gemset | sed -e 's#\@$##')
459
+
360
460
  if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
461
+
361
462
  printf "\n Fixing: $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
463
+
362
464
  mv "$gemset" "$new_path"
465
+
363
466
  fi
467
+
364
468
  done
365
469
 
366
470
  # Move from legacy defaults to the new, alias based system.
367
471
  if [[ -s "$rvm_config_path/default" ]]; then
368
- original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
472
+
473
+ original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator:-"@"}#")")"
474
+
369
475
  if [[ -n "$original_version" ]]; then
370
- "$rvm_scripts_path/alias" create default "$original_version" &> /dev/null
476
+
477
+ "$rvm_path/scripts/alias" create default "$original_version" &> /dev/null
478
+
371
479
  fi ; unset original_version
480
+
372
481
  rm -rf "$rvm_config_path/default"
482
+
373
483
  fi
374
484
 
375
485
  #
@@ -380,13 +490,21 @@ printf "\n Correct permissions for base binaries in $rvm_bin_path..."
380
490
  mkdir -p "$rvm_bin_path"
381
491
 
382
492
  for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
493
+
383
494
  [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
384
- done; unset file
495
+
496
+ done
497
+
385
498
  printf "\n Copying manpages into place."
386
499
 
387
- for man_file in $(builtin cd "$install_source_path/man" ; find * -type f -maxdepth 0 -print); do
500
+ files=($(builtin cd "$install_source_path/man" ; find . -maxdepth 1 -mindepth 1 -type f -print))
501
+
502
+ for file in "${files[@]//.\/}" ; do
503
+
388
504
  rm -rf "$rvm_man_path/$man_file"
505
+
389
506
  cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
507
+
390
508
  done
391
509
 
392
510
  [[ "$upgrade_flag" = 0 ]] && ./scripts/notes
@@ -400,13 +518,19 @@ if [[ ${upgrade_flag:-0} -eq 1 ]] ; then
400
518
  check_rubyopt_conditions
401
519
 
402
520
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
521
+
403
522
  else
523
+
404
524
  if [[ ${rvm_selfcontained:-0} -eq 1 ]] ; then
525
+
405
526
  installation_complete
527
+
406
528
  fi
407
529
 
408
530
  if [[ -s "$HOME/.bashrc" ]] && grep -q '&& return' "$HOME/.bashrc" ; then
531
+
409
532
  andand_return_warning
533
+
410
534
  fi
411
535
 
412
536
  check_rubyopt_conditions