rvm 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,25 @@
1
1
  #!/usr/bin/env bash
2
2
  rvm_base_except="selector"
3
+
3
4
  source "$rvm_path/scripts/base"
4
5
 
5
6
  rvm_docs_ruby_string="$(__rvm_environment_identifier | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
7
+
6
8
  if [[ "$rvm_docs_ruby_string" = "system" || -z "$rvm_docs_ruby_string" ]]; then
9
+
7
10
  "$rvm_path/scripts/log" "error" "Currently 'rvm docs ...' does not work with non-rvm rubies."
11
+
8
12
  exit 1
13
+
9
14
  fi
10
15
 
11
16
  rvm_docs_type="${rvm_docs_type:-rdoc}"
12
17
 
13
18
  # Ensure we have the doc directories.
14
- if [[ ! -d "$rvm_docs_path" ]] ; then
15
- \mkdir -p "$rvm_docs_path/rdoc" "$rvm_docs_path/yard"
19
+ if [[ ! -d "${rvm_docs_path:-"$rvm_path/docs"}" ]] ; then
20
+
21
+ mkdir -p "${rvm_docs_path:-"$rvm_path/docs"}/rdoc" "${rvm_docs_path:-"$rvm_path/docs"}/yard"
22
+
16
23
  fi
17
24
 
18
25
  usage() {
@@ -27,39 +34,60 @@ usage() {
27
34
  }
28
35
 
29
36
  open_docs() {
30
- if [[ -s "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html" ]] ; then
37
+ if [[ -s "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/index.html" ]] ; then
38
+
31
39
  if command -v open >/dev/null ; then
32
- open "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
40
+
41
+ open "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
42
+
33
43
  elif command -v xdg-open >/dev/null ; then
34
- xdg-open "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
44
+
45
+ xdg-open "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/index.html"
46
+
35
47
  else
48
+
36
49
  "$rvm_path/scripts"/log "error" "Neither open nor xdg-open were found, in order to open the docs one of these two are required. \n(OR you can let me know how else to open the html in your browser from comand line on your OS :) )"
50
+
37
51
  fi
52
+
38
53
  else
54
+
39
55
  "$rvm_path/scripts"/log "error" "$rvm_docs_type docs are missing, perhaps run 'rvm docs generate' first?"
56
+
40
57
  fi
41
58
  }
42
59
 
43
60
  generate_ri() {
44
61
  # Generate ri docs
45
62
  (
46
- builtin cd "$rvm_src_path/$rvm_docs_ruby_string/"
63
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_docs_ruby_string/"
64
+
47
65
  "$rvm_path/scripts/log" "info" "Generating ri documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
48
- "$rvm_path/scripts/log" "info" "( Errors will be logged to $rvm_log_path/$rvm_docs_ruby_string/docs.error.log )"
49
- rdoc -a --ri --ri-site > /dev/null 2>> $rvm_log_path/$rvm_docs_ruby_string/docs.error.log
66
+
67
+ "$rvm_path/scripts/log" "info" "( Errors will be logged to ${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log )"
68
+
69
+ rdoc -a --ri --ri-site > /dev/null 2>> ${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log
50
70
  )
51
71
  }
52
72
 
53
73
  generate_rdoc() {
54
74
  (
55
- builtin cd "$rvm_src_path/$rvm_docs_ruby_string/"
56
- \rm -rf "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type/"
75
+ builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_docs_ruby_string/"
76
+
77
+ \rm -rf "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type/"
78
+
57
79
  "$rvm_path/scripts/log" "info" "Generating rdoc documentation, be aware that this could take a *long* time, and depends heavily on your system resources..."
58
- "$rvm_path/scripts/log" "info" "( Errors will be logged to $rvm_log_path/$rvm_docs_ruby_string/docs.error.log )"
80
+
81
+ "$rvm_path/scripts/log" "info" "( Errors will be logged to ${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log )"
82
+
59
83
  if gem list | \grep -q ^hanna ; then
60
- hanna -o "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type" --inline-source --line-numbers --fmt=html > /dev/null 2>> "$rvm_log_path/$rvm_docs_ruby_string/docs.error.log"
84
+
85
+ hanna -o "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type" --inline-source --line-numbers --fmt=html > /dev/null 2>> "${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log"
86
+
61
87
  else
62
- rdoc -a -o "$rvm_docs_path/$rvm_docs_ruby_string/$rvm_docs_type" > /dev/null 2>> "$rvm_log_path/$rvm_docs_ruby_string/docs.error.log"
88
+
89
+ rdoc -a -o "${rvm_docs_path:-"$rvm_path/docs"}/$rvm_docs_ruby_string/$rvm_docs_type" > /dev/null 2>> "${rvm_log_path:-"$rvm_path/log"}/$rvm_docs_ruby_string/docs.error.log"
90
+
63
91
  fi
64
92
  )
65
93
  }
@@ -25,7 +25,7 @@ __rvm_become "$environment_name"
25
25
 
26
26
  if [[ "$?" = 0 ]]; then
27
27
  __rvm_use
28
- environment_file_path="$rvm_environments_path/$(__rvm_environment_identifier)"
28
+ environment_file_path="$rvm_path/environments/$(__rvm_environment_identifier)"
29
29
  # Echo the path or environment file.
30
30
  if [[ -n "$rvm_path_flag" ]]; then
31
31
  echo "$environment_file_path"
@@ -32,7 +32,7 @@ convert_exports_to_fish() {
32
32
  }
33
33
 
34
34
  contents_of_environment_file() {
35
- cat "$rvm_environments_path/$(__rvm_environment_identifier)"
35
+ cat "$rvm_path/environments/$(__rvm_environment_identifier)"
36
36
  }
37
37
 
38
38
  convert_to_shell() {
@@ -1,118 +1,230 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  rvm_base_except="selector"
4
+
4
5
  source "$rvm_path/scripts/base"
6
+
5
7
  result=0
6
8
 
7
9
  # Set it to cleanup the download on interruption.
8
10
  trap 'cleanup_download' 1 2 3 15
9
11
 
10
12
  cleanup_download() {
11
- [[ -f "$archive" ]] && rm -rf "$archive"
13
+
14
+ [[ -f "$archive" ]] && rm -f "$archive"
15
+
12
16
  }
13
17
 
14
18
  record_md5() {
19
+
15
20
  if [[ "Darwin" = "$(uname)" ]] || [[ "FreeBSD" = "$(uname)" ]]; then
21
+
16
22
  archive_md5="$(/sbin/md5 -q "${archive}")"
23
+
17
24
  else
25
+
18
26
  archive_md5="$(md5sum "${archive}" | awk '{print $1}')"
27
+
19
28
  fi
20
- "$rvm_path/scripts/db" "$rvm_config_path/md5" "$archive" "$archive_md5"
29
+
30
+ "$rvm_path/scripts/db" "$rvm_path/config/md5" "$archive" "$archive_md5"
31
+
21
32
  }
22
33
 
23
- builtin cd "$rvm_archives_path"
34
+ builtin cd "${rvm_archives_path:-"$rvm_path/archives"}"
24
35
 
25
36
  # args=($*) # Reserved for future use
26
37
 
27
- if [[ -z "$1" ]] ; then "$rvm_path/scripts/log" "fail" "BUG: $0 called without an argument :/" ; exit 1 ; fi
38
+ if [[ -z "$1" ]] ; then
39
+
40
+ "$rvm_path/scripts/log" "fail" \
41
+ "BUG: $0 called without an argument :/"
42
+
43
+ exit 1
44
+ fi
28
45
 
29
46
  url="$1"; download=1 ; package_name="$2"
30
47
 
31
48
  if ! command -v curl > /dev/null ; then
32
- "$rvm_path/scripts/log" "fail" "rvm requires curl. curl was not found in your active path."
49
+
50
+ "$rvm_path/scripts/log" "fail" \
51
+ "rvm requires curl. curl was not found in your active path."
52
+
33
53
  exit 1
54
+
34
55
  elif [[ ! -z ${rvm_proxy} ]] ; then
56
+
35
57
  fetch_command="curl -x${rvm_proxy} -L --create-dirs -C - " # -s for silent
58
+
36
59
  else
60
+
37
61
  fetch_command="curl -L --create-dirs -C - " # -s for silent
62
+
38
63
  fi
39
64
 
40
65
  if [[ ! -z "$package_name" ]] ; then
66
+
41
67
  fetch_command="${fetch_command} -o ${package_name} "
68
+
42
69
  archive="$package_name"
70
+
43
71
  else
72
+
44
73
  fetch_command="${fetch_command} -O "
74
+
45
75
  archive=$(basename "$url")
76
+
46
77
  fi
47
78
 
48
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then "$rvm_path/scripts/log" "debug" "Fetching $archive" ; fi
79
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
80
+
81
+ "$rvm_path/scripts/log" "debug" \
82
+ "Fetching $archive"
83
+
84
+ fi
49
85
 
50
86
  # Check first if we have the correct archive
51
- archive_md5="$($rvm_path/scripts/db "$rvm_config_path/md5" "$archive" | head -n1)"
52
- if [[ -e "$archive" ]] && [[ ! -z "$archive_md5" ]] ; then
53
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then "$rvm_path/scripts/log" "debug" "Found archive and its md5, testing correctness" ; fi
54
- if ! "$rvm_path/scripts"/md5 "${rvm_archives_path}/${archive}" "$archive_md5" ; then
55
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then "$rvm_path/scripts/log" "debug" "Archive is bad, downloading" ; fi
87
+ archive_md5="$($rvm_path/scripts/db "$rvm_path/config/md5" "$archive" | head -n1)"
88
+
89
+ if [[ -e "$archive" && ! -z "$archive_md5" ]] ; then
90
+
91
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
92
+
93
+ "$rvm_path/scripts/log" "debug" \
94
+ "Found archive and its md5, testing correctness"
95
+
96
+ fi
97
+
98
+ if ! "$rvm_path/scripts"/md5 "${rvm_archives_path:-"$rvm_path/archives"}/${archive}" "$archive_md5" ; then
99
+
100
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
101
+ "$rvm_path/scripts/log" "debug" \
102
+ "Archive md5 did not match, downloading"
103
+ fi
104
+
56
105
  download=1
106
+
57
107
  else
58
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then "$rvm_path/scripts/log" "debug" "Archive is good, not downloading" ; fi
108
+
109
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
110
+
111
+ "$rvm_path/scripts/log" "debug" \
112
+ "Archive md5 matched, not downloading"
113
+
114
+ fi
115
+
59
116
  download=0
117
+
60
118
  result=0
61
- fi ; unset archive_md5
119
+
120
+ fi
121
+
62
122
  else
63
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then "$rvm_path/scripts/log" "debug" "No archive or no MD5, downloading" ; fi
123
+
124
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
125
+
126
+ "$rvm_path/scripts/log" "debug" \
127
+ "No archive or no MD5, downloading"
128
+
129
+ fi
130
+
64
131
  download=1
132
+
65
133
  fi
66
134
 
67
135
  # try to convert the ftp url to a http url
68
- http_url="$(echo $url | sed -e 's/ftp:/http:/' -e 's/git:/http:/')"
136
+ http_url="$(echo "$url" | sed -e 's/ftp:/http:/' -e 's/git:/http:/')"
69
137
 
70
138
  if [[ $download -gt 0 ]] ; then
139
+
71
140
  rm -f $archive
72
- eval $fetch_command "$url"
73
- result=$?
141
+
142
+ eval $fetch_command "$url" ; result=$?
143
+
74
144
  if [[ $result -gt 0 ]] ; then
145
+
75
146
  retry=0
147
+
76
148
  try_http=0
149
+
77
150
  if [[ $result -eq 78 ]] ; then
78
- "$rvm_path/scripts/log" "error" "The requested url does not exist: '$url'"
151
+
152
+ "$rvm_path/scripts/log" "error" \
153
+ "The requested url does not exist: '$url'"
154
+
79
155
  try_http=1
156
+
80
157
  elif [[ $result -eq 18 ]] ; then
81
- "$rvm_path/scripts/log" "error" "Partial file. Only a part of the file was transferred. Removing partial and re-trying."
158
+
159
+ "$rvm_path/scripts/log" "error" \
160
+ "Partial file. Only a part of the file was transferred. Removing partial and re-trying."
161
+
82
162
  rm -f "$archive"
163
+
83
164
  retry=1
165
+
84
166
  elif [[ $result -eq 33 ]] ; then
85
- if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then "$rvm_path/scripts/log" "debug" "Server does not support 'range' command, removing '$archive'" ; fi
167
+
168
+ if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then
169
+
170
+ "$rvm_path/scripts/log" "debug" \
171
+ "Server does not support 'range' command, removing '$archive'"
172
+
173
+ fi
174
+
86
175
  rm -f "$archive"
176
+
87
177
  retry=1
178
+
88
179
  else
89
- "$rvm_path/scripts/log" "error" "There was an error, please check $rvm_ruby_log_path/*.error.log. Next we'll try to fetch via http."
180
+
181
+ "$rvm_path/scripts/log" "error" \
182
+ "There was an error, please check ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/*.error.log. Next we'll try to fetch via http."
183
+
90
184
  try_http=1
185
+
91
186
  fi
92
187
 
93
188
  if [[ $retry -eq 1 ]] ; then
94
- eval $fetch_command "$url"
95
- result=$?
189
+
190
+ eval $fetch_command "$url" ; result=$?
191
+
96
192
  if [[ $result -gt 0 ]] ; then
97
- "$rvm_path/scripts/log" "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
193
+
194
+ "$rvm_path/scripts/log" "error" \
195
+ "There was an error, please check ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/*.error.log"
196
+
98
197
  else
198
+
99
199
  record_md5
200
+
100
201
  fi
202
+
101
203
  fi
102
204
 
103
205
  if [[ $try_http -eq 1 ]] ; then
104
- eval $fetch_command "$http_url"
105
- result=$?
206
+
207
+ eval $fetch_command "$http_url" ; result=$?
208
+
106
209
  if [[ $result -gt 0 ]] ; then
107
- "$rvm_path/scripts/log" "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
210
+
211
+ "$rvm_path/scripts/log" "error" \
212
+ "There was an error, please check ${rvm_log_path:-"$rvm_path/log"}/$rvm_ruby_string/*.error.log"
213
+
108
214
  else
215
+
109
216
  record_md5
217
+
110
218
  fi
219
+
111
220
  fi
112
221
 
113
222
  else
223
+
114
224
  record_md5
225
+
115
226
  fi
227
+
116
228
  fi
117
229
 
118
230
  exit $result
@@ -14,7 +14,7 @@ usage() {
14
14
 
15
15
  Action:
16
16
 
17
- {import,export,create,copy,empty,delete,name,dir,list,gemdir,install,pristine,clear,use,update,globalcache}
17
+ {import,export,create,copy,empty,delete,name,dir,list,gemdir,install,pristine,clear,use,update,unpack,globalcache}
18
18
 
19
19
  Description:
20
20
 
@@ -27,7 +27,7 @@ gemset_update() {
27
27
  if [[ -z "$rvm_ruby_strings" ]]; then
28
28
  "$rvm_path/scripts/log" "info" "Running gem update for all rubies and gemsets."
29
29
 
30
- rvm_ruby_strings="$(builtin cd "$rvm_gems_path" ; find . -maxdepth 1 -mindepth 1 -type d -print 2>/dev/null | grep -v '^\(doc\|cache\|@\|system\)' | \tr '\n' ',')"
30
+ rvm_ruby_strings="$(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}" ; find . -maxdepth 1 -mindepth 1 -type d -print 2>/dev/null | grep -v '^\(doc\|cache\|@\|system\)' | \tr '\n' ',')"
31
31
  rvm_ruby_strings="${rvm_ruby_strings/%,}"
32
32
  rvm_ruby_strings="${rvm_ruby_strings//.\/}"
33
33
  else
@@ -62,11 +62,11 @@ gemset_globalcache() {
62
62
 
63
63
  "$rvm_path/scripts/log" "info" "Removing the global cache (note: this will empty the caches)"
64
64
 
65
- directories=($(builtin cd "$rvm_gems_path" ; find . -maxdepth 1 -mindepth 1 -type d -print))
65
+ directories=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}" ; find . -maxdepth 1 -mindepth 1 -type d -print))
66
66
 
67
67
  for directory_name in "${directories[@]//.\/}"; do
68
68
 
69
- current_cache_path="$rvm_gems_path/$directory_name/cache"
69
+ current_cache_path="${rvm_gems_path:-"$rvm_path/gems"}/$directory_name/cache"
70
70
 
71
71
  if [[ -L "$current_cache_path" && "$(readlink "$current_cache_path")" == "$rvm_gems_cache_path" ]]; then
72
72
 
@@ -78,7 +78,7 @@ gemset_globalcache() {
78
78
  fi
79
79
  done
80
80
 
81
- "$rvm_path/scripts/db" "$rvm_config_path/user" "use_gemset_globalcache" "delete"
81
+ "$rvm_path/scripts/db" "$rvm_path/config/user" "use_gemset_globalcache" "delete"
82
82
 
83
83
  elif [[ "$1" == "enable" ]]; then
84
84
 
@@ -86,11 +86,11 @@ gemset_globalcache() {
86
86
 
87
87
  mkdir -p "$rvm_gems_cache_path"
88
88
 
89
- directories=($(builtin cd "$rvm_gems_path" ; find . -maxdepth 1 -mindepth 1 -type d -print))
89
+ directories=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}" ; find . -maxdepth 1 -mindepth 1 -type d -print))
90
90
 
91
91
  for directory_name in "${directories[@]//.\/}" ; do
92
92
 
93
- current_cache_path="$rvm_gems_path/$directory_name/cache"
93
+ current_cache_path="${rvm_gems_path:-"$rvm_path/gems"}/$directory_name/cache"
94
94
 
95
95
  if [[ -d "$current_cache_path" && ! -L "$current_cache_path" ]]; then
96
96
 
@@ -105,7 +105,7 @@ gemset_globalcache() {
105
105
 
106
106
  done
107
107
 
108
- "$rvm_path/scripts/db" "$rvm_config_path/user" "use_gemset_globalcache" "true"
108
+ "$rvm_path/scripts/db" "$rvm_path/config/user" "use_gemset_globalcache" "true"
109
109
 
110
110
  else
111
111
  printf "
@@ -175,13 +175,13 @@ gemset_list() {
175
175
  if [[ ${rvm_ruby_selected_flag:-0} -eq 0 ]] ; then __rvm_select ; fi
176
176
 
177
177
  "$rvm_path/scripts/log" "info" \
178
- "\ngemsets for $rvm_ruby_string (found in $rvm_gems_path/$rvm_ruby_string)"
178
+ "\ngemsets for $rvm_ruby_string (found in ${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string)"
179
179
 
180
- if [[ -n "${rvm_gems_path:-""}" ]] ; then
180
+ if [[ -d "${rvm_gems_path:-"$rvm_path/gems"}" ]] ; then
181
181
 
182
182
  if [[ -n "${rvm_ruby_string:-""}" ]] ; then
183
183
 
184
- ls "${rvm_gems_path}/" | awk -F"${rvm_gemset_separator:-"@"}" "/${rvm_ruby_string}${rvm_gemset_separator:-"@"}/{print \$2}" 2>/dev/null
184
+ ls "${rvm_gems_path:-"$rvm_path/gems"}/" | awk -F"${rvm_gemset_separator:-"@"}" "/${rvm_ruby_string}${rvm_gemset_separator:-"@"}/{print \$2}" 2>/dev/null
185
185
 
186
186
  else
187
187
  "$rvm_path/scripts/log" "error" \
@@ -191,7 +191,7 @@ gemset_list() {
191
191
 
192
192
  else
193
193
  "$rvm_path/scripts/log" "error" \
194
- "\$rvm_gems_path is not set!"
194
+ "${rvm_gems_path:-"$rvm_path/gems"} does not exist!"
195
195
  return 1
196
196
  fi
197
197
  printf "\n"
@@ -205,7 +205,7 @@ gemset_delete() {
205
205
 
206
206
  if [[ -n "$rvm_gemset_name" ]] ; then
207
207
 
208
- gemdir="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator:-"@"}$rvm_gemset_name"
208
+ gemdir="${rvm_gems_path:-"$rvm_path/gems"}/$rvm_ruby_string${rvm_gemset_separator:-"@"}$rvm_gemset_name"
209
209
 
210
210
  if [[ -d "$gemdir" && "$gemdir" != '/' && ${rvm_force_flag:-0} -gt 0 ]] ; then
211
211
 
@@ -345,6 +345,49 @@ gemset_copy() {
345
345
  fi
346
346
  }
347
347
 
348
+ gemset_unpack() {
349
+
350
+ local gems name directory version versions
351
+
352
+ directory="${args[$__array_start]}"
353
+
354
+ if [[ -z "$directory" ]] ; then
355
+ directory="vendor/gems"
356
+ fi
357
+
358
+ if [[ -n "$rvm_ruby_gem_home" ]] ; then
359
+ export GEM_HOME="$rvm_ruby_gem_home"
360
+ export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin"
361
+ export BUNDLE_PATH="$rvm_ruby_gem_home"
362
+ fi
363
+
364
+ "$rvm_path/scripts/log" "info" \
365
+ "Unpacking current environments gemset to ${directory}\n"
366
+
367
+ unset -f gem
368
+
369
+ gems=($(command gem list | sed 's#[\(|\)]##g' | sed -e 's#, #,#g' -e 's/ /;/g'))
370
+
371
+ for gem in ${gems[@]} ; do
372
+
373
+ name="${gem/;*/}"
374
+
375
+ versions="${gem/*;/}" ; versions=(${versions//,/ })
376
+
377
+ for version in "${versions[@]}" ; do
378
+
379
+ ( command gem unpack "$name" -v"$version" --target "$directory" )&
380
+
381
+ done
382
+
383
+ done ; wait
384
+
385
+ "$rvm_path/scripts/log" "info" \
386
+ "Unpacking into ${directory} complete\n"
387
+
388
+ return 0
389
+ }
390
+
348
391
  gemset_export() {
349
392
  local gems name file_name version versions
350
393
 
@@ -352,7 +395,7 @@ gemset_export() {
352
395
 
353
396
  if [[ -n "$rvm_ruby_gem_home" ]] ; then
354
397
  export GEM_HOME="$rvm_ruby_gem_home"
355
- export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator:-"@"}global/bin"
398
+ export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin"
356
399
  export BUNDLE_PATH="$rvm_ruby_gem_home"
357
400
  fi
358
401
 
@@ -399,7 +442,7 @@ gemset_import() {
399
442
 
400
443
  if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
401
444
  export GEM_HOME="$rvm_ruby_gem_home"
402
- export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator:-"@"}global/bin"
445
+ export GEM_PATH="$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin"
403
446
  export BUNDLE_PATH="$rvm_ruby_gem_home"
404
447
  fi
405
448
 
@@ -494,7 +537,8 @@ __rvm_parse_gems_args() {
494
537
  # Install a gem
495
538
  gem_install() {
496
539
 
497
- local gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string gem_action
540
+ local result gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string gem_action
541
+
498
542
  result=0
499
543
 
500
544
  # First we parse the gem args to pick apart the pieces.
@@ -544,11 +588,11 @@ gem_install() {
544
588
  else
545
589
  if [[ -s "$(__rvm_current_gemcache_dir)/$(basename $gem_file_name)" ]] ; then
546
590
 
547
- mkdir -p "$rvm_tmp_path/$$/"
591
+ mkdir -p "${rvm_tmp_path:-"$rvm_path/tmp"}/$$/"
548
592
 
549
- mv "$(__rvm_current_gemcache_dir)/$gem_file_name" "$rvm_tmp_path/$$/$gem_file_name"
593
+ mv "$(__rvm_current_gemcache_dir)/$gem_file_name" "${rvm_tmp_path:-"$rvm_path/tmp"}/$$/$gem_file_name"
550
594
 
551
- gem="$rvm_tmp_path/$$/$gem_file_name -f -l"
595
+ gem="${rvm_tmp_path:-"$rvm_path/tmp"}/$$/$gem_file_name -f -l"
552
596
  else
553
597
  gem="$cache_file"
554
598
  fi
@@ -562,9 +606,9 @@ gem_install() {
562
606
  # TODO: Set vars if fourth field is non-empty (means that there are conditional statements to execute in the gem install line.
563
607
  if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
564
608
 
565
- if [[ -n "$rvm_ruby_gem_home" && "$rvm_ruby_gem_home" != "$rvm_gems_path" ]] ; then
609
+ if [[ -n "$rvm_ruby_gem_home" && "$rvm_ruby_gem_home" != "${rvm_gems_path:-"$rvm_path/gems"}" ]] ; then
566
610
 
567
- command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home/bin:$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator:-"@"}global/bin' BUNDLE_PATH='${rvm_ruby_gem_home}' ${gem_prefix} command gem install $gems_args $rvm_gem_options $gem_postfix $vars"
611
+ command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin' BUNDLE_PATH='${rvm_ruby_gem_home}' ${gem_prefix} command gem install $gems_args $rvm_gem_options $gem_postfix $vars"
568
612
 
569
613
  else
570
614
 
@@ -655,7 +699,7 @@ gemset_prune() {
655
699
  }
656
700
 
657
701
  gemset_pristine() {
658
- if command -v gem > /dev/null ; then
702
+ if ( unset -f gem ; command -v gem > /dev/null ) ; then
659
703
 
660
704
  gem pristine --all
661
705
 
@@ -673,7 +717,8 @@ gemset_pristine() {
673
717
  # Loads the default gemsets for the current interpreter and gemset.
674
718
  gemset_initial() {
675
719
 
676
- "$rvm_path/scripts/log" "info" "Importing initial gemsets for $(__rvm_environment_identifier)."
720
+ "$rvm_path/scripts/log" "info" \
721
+ "Importing initial gemsets for $(__rvm_environment_identifier)."
677
722
 
678
723
  mkdir -p "$rvm_path/gemsets/${rvm_ruby_string//-//}" 2>/dev/null
679
724
 
@@ -799,6 +844,9 @@ case "$action" in
799
844
  update)
800
845
  gemset_update
801
846
  ;;
847
+ unpack)
848
+ gemset_unpack
849
+ ;;
802
850
  globalcache)
803
851
  gemset_globalcache "$2"
804
852
  ;;