rvm 1.0.3 → 1.0.4

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.
@@ -17,8 +17,6 @@ if [[ -d "$install_source_path/scripts" ]] && [[ -s "$install_source_path/script
17
17
  builtin cd "$install_source_path"
18
18
  fi
19
19
 
20
- sleep=0.010
21
-
22
20
  source scripts/version
23
21
  source scripts/utility
24
22
 
@@ -42,16 +40,116 @@ check_rubyopt_conditions() {
42
40
  fi
43
41
  }
44
42
 
45
- spinner_counter=0
46
- spinner() {
47
- array=('/' '-' '\\' '|' '/' '-' '\\' '|')
48
- index=$((($spinner_counter % 8)))
49
- printf "\r${array[$index]}"
50
- let "spinner_counter=spinner_counter+1"
51
- sleep $sleep
43
+ andand_return_instructions() {
44
+ printf "
45
+ This means that if you see something like:
46
+
47
+ '[ -z \"\$PS1\" ] && return'
48
+
49
+ then you change this line to:
50
+
51
+ if [[ -n \"\$PS1\" ]] ; then
52
+
53
+ # ... original content that was below the '&& return' line ...
54
+
55
+ fi # <= be sure to close the if at the end of the .bashrc.
56
+
57
+ # This is a good place to source rvm v v v
58
+ [[ -s \"\$HOME/.rvm/scripts/rvm\" ]] && source \"\$HOME/.rvm/scripts/rvm\" # This loads RVM into a shell session.
59
+
60
+ EOF - This marks the end of the .bashrc file
61
+ "
62
+ }
63
+
64
+ installation_complete() {
65
+ printf "
66
+ You must now complete the install by loading RVM in new shells.
67
+
68
+ 1) Place the folowing line at the end of your shell's loading files
69
+ (.bashrc or .bash_profile for bash and .zshrc for zsh),
70
+ after all PATH/variable settings:
71
+
72
+ [[ -s \"\$HOME/.rvm/scripts/rvm\" ]] && source \"\$HOME/.rvm/scripts/rvm\" # This loads RVM into a shell session.
73
+
74
+ You only need to add this line the first time you install rvm.
75
+
76
+ 2) Ensure that there is no 'return' from inside the ~/.bashrc file,
77
+ otherwise rvm may be prevented from working properly.
78
+
79
+ $(andand_return_instructions)
80
+
81
+ Be absolutely *sure* to REMOVE the '&& return'.
82
+
83
+ If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile.
84
+
85
+ Placing all non-interactive (non login) items in the .bashrc,
86
+ including the 'source' line above and any environment settings.
87
+
88
+ 3) CLOSE THIS SHELL and open a new one in order to use rvm.
89
+ \n"
90
+ }
91
+
92
+ andand_return_warning() {
93
+ printf "
94
+ WARNING: you have a 'return' statement in your ~/.bashrc
95
+ This could cause some features of RVM to not work.
96
+
97
+ $(andand_return_instructions)
98
+
99
+ Even if you are using zsh you should still adjust the ~/.bashrc
100
+ If you have any questions about this please visit
101
+ #rvm on irc.freenode.net.
102
+ \n"
103
+ }
104
+
105
+ thank_you() {
106
+ printf "
107
+ ${name:-"$(whoami)"},
108
+
109
+ Thank you very much for using RVM! I sincerely hope that RVM helps to
110
+ make your work both easier and more enjoyable.
111
+
112
+ If you have any questions, issues and/or ideas for improvement please
113
+ join#rvm on irc.freenode.net and let me know, note you must register
114
+ (http://bit.ly/5mGjlm) and identify (/msg nickserv <nick> <pass>) to
115
+ talk, this prevents spambots from ruining our day.
116
+
117
+ My irc nickname is 'wayneeseguin' and I hang out in #rvm typically
118
+
119
+ ~09:00-17:00EDT and again from ~21:00EDT-~23:00EDT
120
+
121
+ If I do not respond right away, please hang around after asking your
122
+ question, I will respond as soon as I am back. It is best to talk in
123
+ #rvm itself as then other users can help out should I be offline.
124
+
125
+ Be sure to get head often as rvm development happens fast,
126
+ you can do this by running 'rvm update --head' followed by 'rvm reload'
127
+ or opening a new shell
128
+
129
+ w⦿‿⦿$
130
+
131
+ ~ Wayne
132
+
133
+ "
134
+ }
135
+
136
+ upgrade_notes() {
137
+ printf "
138
+
139
+ Upgrade Notes
140
+
141
+ * Ruby package dependency list for your OS is given by:
142
+ rvm notes
143
+
144
+ * If you encounter any issues with a ruby 'X' your best bet is to:
145
+ rvm remove X ; rvm install X
146
+
147
+ * If you wish to have the 'pretty colors' again, set in ~/.rvmrc:
148
+ export rvm_pretty_print=1
149
+ "
52
150
  }
53
151
 
54
- if echo "$*" | \grep -q 'trace' ; then echo "$*" ; env | \grep '^rvm_' ; set -x ; fi
152
+ if echo "$*" | grep -q 'trace' ; then echo "$*" ; env | grep '^rvm_' ; set -x ; fi
55
153
 
56
154
  while [[ $# -gt 0 ]] ; do
57
155
  token="$1" ; shift
@@ -76,7 +174,7 @@ if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
76
174
 
77
175
  source scripts/initialize
78
176
 
79
- if \grep -q 'scripts/rvm' "$HOME"/.bash* 2>/dev/null || \grep -q 'scripts/rvm' "$HOME"/.zsh* 2>/dev/null; then
177
+ if grep -q 'scripts/rvm' "$HOME"/.bash* 2>/dev/null || grep -q 'scripts/rvm' "$HOME"/.zsh* 2>/dev/null; then
80
178
  if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then
81
179
  export upgrade_flag=1
82
180
  else
@@ -91,8 +189,8 @@ __rvm_initialize
91
189
  #
92
190
  # Setup & Configuration
93
191
  #
94
- item="$(tput setaf 2)* $(tput sgr0)"
95
- question="\n$(tput setaf 2)<?>$(tput sgr0)"
192
+ item="* "
193
+ question="\n<?>"
96
194
  cwd="$PWD"
97
195
  source_path="${source_path:-$cwd}"
98
196
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
@@ -118,45 +216,41 @@ rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
118
216
 
119
217
  export rvm_gemset_separator="@" # TODO: Remove this after a while.
120
218
 
121
- printf "\n$(tput setaf 2)RVM:$(tput sgr0) shell scripts which allow management of multiple ruby interpreters and environments."
122
- printf "\n$(tput setaf 2)RTFM: $(tput sgr0) http://rvm.beginrescueend.com/"
123
- printf "\n$(tput setaf 2)HELP: $(tput sgr0) http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)"
219
+ printf "
220
+ RVM: Shell scripts enabling management of multiple ruby environments.
221
+ RTFM: http://rvm.beginrescueend.com/
222
+ HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
223
+ "
124
224
 
125
- if [[ "$upgrade_flag" -eq 1 ]] ;then
126
- printf "\n\n Upgrading the RVM installation in $rvm_path/"
225
+ if [[ ${upgrade_flag:-0} -eq 1 ]] ;then
226
+ printf "\nUpgrading the RVM installation in $rvm_path/"
127
227
  else
128
- printf "\n\n Installing rvm to $rvm_path/"
228
+ printf "\nInstalling rvm to $rvm_path/"
129
229
  fi
130
230
 
131
- spinner
132
-
133
- \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"
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"
134
232
 
135
233
  for file in README LICENCE ; do
136
- spinner
137
- \cp -f "$source_path/$file" "$rvm_path/"
234
+ cp -f "$source_path/$file" "$rvm_path/"
138
235
  done
139
236
 
140
237
  #
141
238
  # Scripts
142
239
  #
143
240
  for dir_name in config scripts examples lib hooks help patches; do
144
- spinner
145
- \mkdir -p "$rvm_path/$dir_name"
241
+ mkdir -p "$rvm_path/$dir_name"
146
242
  if [[ -d "$source_path/$dir_name" ]] ; then
147
- \cp -Rf "$source_path/$dir_name" "$rvm_path"
243
+ cp -Rf "$source_path/$dir_name" "$rvm_path"
148
244
  fi
149
245
  done ; unset dir_name
150
246
 
151
- spinner
152
247
  if [[ ! -s "$rvm_config_path/user" ]] ; then
153
- \mkdir -p "$rvm_config_path/"
248
+ mkdir -p "$rvm_config_path/"
154
249
  echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_config_path/user"
155
250
  fi
156
251
 
157
252
  scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
158
253
  for script_name in "${scripts[@]}" ; do
159
- spinner
160
254
  chmod +x "$rvm_scripts_path/$script_name" 2>/dev/null # Hide errors.
161
255
  done
162
256
 
@@ -165,29 +259,26 @@ done
165
259
  #
166
260
  # Cleanse and purge...
167
261
  for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
168
- spinner && sleep $sleep
169
- \rm -f "$rvm_bin_path/$file"
170
- \cp -f "$source_path/binscripts/$file" $rvm_bin_path/
262
+ rm -f "$rvm_bin_path/$file"
263
+ cp -f "$source_path/binscripts/$file" $rvm_bin_path/
171
264
  done
172
- spinner
173
265
  chmod +x "$rvm_bin_path"/*
174
266
 
175
267
  #
176
268
  # RC Files
177
269
  #
178
- spinner
179
270
  if [[ -n "$rvm_auto_flag" ]] ; then
180
271
  printf "Checking rc files... ($rvm_rc_files)"
181
272
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
182
273
  for rcfile in $(printf $rvm_rc_files) ; do
183
- if [[ ! -f $rcfile ]] ; then \touch $rcfile ; fi
274
+ if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
184
275
  if [[ -s "$HOME/.profile" ]] ; then
185
- if ! \grep -q '.profile' "$rcfile" ; then
276
+ if ! grep -q '.profile' "$rcfile" ; then
186
277
  echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
187
278
  printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> "$rcfile"
188
279
  fi
189
280
  fi
190
- if ! \grep -q "scripts\/rvm" "$rcfile" ; then
281
+ if ! grep -q "scripts\/rvm" "$rcfile" ; then
191
282
  echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
192
283
  printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> "$rcfile"
193
284
  fi
@@ -198,28 +289,27 @@ fi
198
289
  #
199
290
  # Initial Interpreter Gemsets.
200
291
  #
201
- spinner
202
292
  if [[ -d gemsets/ ]] ; then
203
- \mkdir -p "$rvm_gemsets_path"
293
+ mkdir -p "$rvm_gemsets_path"
294
+
204
295
  for gemset_file in $(builtin cd gemsets ; find \. -iname '*.gems' | sed 's/^\.\///') ; do
205
296
  destination="$rvm_gemsets_path/$gemset_file"
206
297
  destination_path="$(dirname "$destination")"
207
298
  if [[ ! -s "$destination" ]] ; then
208
- \mkdir -p "$destination_path"
209
- \cp "gemsets/$gemset_file" "$destination"
299
+ mkdir -p "$destination_path"
300
+ cp "gemsets/$gemset_file" "$destination"
210
301
  fi
211
302
  done ; unset destination destination_path gemset_file
212
303
  fi
213
304
 
214
- spinner
215
305
  if [[ -d patchsets/ ]] ; then
216
- \mkdir -p "$rvm_patchsets_path"
306
+ mkdir -p "$rvm_patchsets_path"
217
307
  for patchset_file in $(builtin cd patchsets ; find \. -iname '*' | sed 's/^\.\///') ; do
218
308
  destination="$rvm_patchsets_path/$patchset_file"
219
309
  destination_path="$(dirname "$destination")"
220
310
  if [[ ! -s "$destination" ]] ; then
221
- \mkdir -p "$destination_path"
222
- \cp "patchsets/$patchset_file" "$destination"
311
+ mkdir -p "$destination_path"
312
+ cp "patchsets/$patchset_file" "$destination"
223
313
  fi
224
314
  done ; unset destination destination_path patchset_file
225
315
  fi
@@ -228,14 +318,12 @@ fi
228
318
  # Migrate ~/.rvm/ruby-X,jruby-X,... to ~/.rvm/rubies/ for 0.1.0.
229
319
  #
230
320
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
231
- \mkdir -p "$rvm_rubies_path/"
232
- spinner
321
+ mkdir -p "$rvm_rubies_path/"
233
322
  for ruby in $rvm_path/ruby-* $rvm_path/jruby-* $rvm_path/mput-* $rvm_path/rbx-* $rvm_path/maglev-* $rvm_path/ree-* ; do
234
323
  if [[ -d "$ruby" ]] ; then
235
324
  mv "$ruby" "$rvm_rubies_path/"
236
325
  new_path="$rvm_rubies_path/$(basename $ruby)"
237
326
  for file in gem rake ; do
238
- spinner
239
327
  if [[ -s "$new_path/bin/$file" ]] ; then
240
328
  sed -e '1,1s=.*=#!'"${new_path}/bin/ruby=" "${new_path}/bin/${file}" > "${new_path}/bin/${file}.new"
241
329
  mv -f "$new_path/bin/$file.new" "$new_path/bin/$file"
@@ -251,9 +339,6 @@ done
251
339
  #
252
340
  # Migrate old gemset directories to new gemset pattern.
253
341
  #
254
- spinner
255
- printf "\r*" # Stop spinner.
256
-
257
342
  for gemset in "$rvm_path"/gems/*\%* ; do
258
343
  new_path=${gemset/\%/${rvm_gemset_separator}}
259
344
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
@@ -264,7 +349,7 @@ done
264
349
 
265
350
  for gemset in "$rvm_path"/gems/*\+* ; do
266
351
  new_path=${gemset/\+/${rvm_gemset_separator}}
267
- if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
352
+ if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
268
353
  printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
269
354
  mv $gemset $new_path
270
355
  fi
@@ -272,7 +357,7 @@ done
272
357
 
273
358
  for gemset in "$rvm_path"/gems/*\@ ; do
274
359
  new_path=$(echo $gemset | sed -e 's#\@$##')
275
- if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
360
+ if [[ -d "$gemset" && ! -d "$new_path" ]] ; then
276
361
  printf "\n Fixing: $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
277
362
  mv "$gemset" "$new_path"
278
363
  fi
@@ -280,77 +365,54 @@ done
280
365
 
281
366
  # Move from legacy defaults to the new, alias based system.
282
367
  if [[ -s "$rvm_config_path/default" ]]; then
283
- original_version="$(basename "$(\grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
368
+ original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
284
369
  if [[ -n "$original_version" ]]; then
285
370
  "$rvm_scripts_path/alias" create default "$original_version" &> /dev/null
286
371
  fi ; unset original_version
287
- \rm -rf "$rvm_config_path/default"
372
+ rm -rf "$rvm_config_path/default"
288
373
  fi
289
374
 
290
375
  #
291
376
  # End of gemset migration.
292
377
  #
293
378
  printf "\n Correct permissions for base binaries in $rvm_bin_path..."
294
- \mkdir -p "$rvm_bin_path"
295
- for file in rvm rvmsudo rvm-shell rvm-auto-ruby; do
379
+
380
+ mkdir -p "$rvm_bin_path"
381
+
382
+ for file in rvm rvmsudo rvm-shell rvm-auto-ruby ; do
296
383
  [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
297
384
  done; unset file
298
385
  printf "\n Copying manpages into place."
299
- for man_file in $(\ls "$install_source_path/man"); do
300
- \rm -rf "$rvm_man_path/$man_file"
301
- \cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
386
+ for man_file in $(ls "$install_source_path/man"); do
387
+ rm -rf "$rvm_man_path/$man_file"
388
+ cp -R "$install_source_path/man/$man_file" "$rvm_man_path/"
302
389
  done
303
390
 
304
391
  [[ "$upgrade_flag" = 0 ]] && ./scripts/notes
305
392
 
306
393
  name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)"
307
- printf "\n\n${name:-"$(whoami)"},\n"
308
- printf "\nThank you for using rvm. I hope that it makes your work easier and more enjoyable."
309
- printf "\nIf you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know."
310
- printf "\nMy irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST."
311
- printf "\nIf I do not respond right away, please hang around after asking your question, I will respond as soon as I am back."
312
- printf "\nBe sure to get head often as rvm development happens fast, you can do this by running 'rvm update --head'."
313
- printf "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!"
314
- printf "\n ~ Wayne\n"
315
-
316
- if [[ "$upgrade_flag" -eq 1 ]] ; then
317
- printf "\n$(tput setaf 6)Upgrade Notes\n"
318
- printf "\n * 'rvm notes' tells you OS dependency packages for installing rubies."
319
- printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' "
320
- printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
321
- printf "\n * If you wish to have the 'pretty colors' again, set 'export rvm_pretty_print=1' in ~/.rvmrc.\n"
322
- printf "\n$(tput sgr0)\n"
394
+
395
+ if [[ ${upgrade_flag:-0} -eq 1 ]] ; then
396
+
397
+ upgrade_notes
398
+
323
399
  check_rubyopt_conditions
400
+
324
401
  printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
325
402
  else
326
- if [[ "$rvm_selfcontained" = "1" ]] ; then
327
- printf "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
328
- printf "\n1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:"
329
- printf "\n [[ -s \$HOME/.rvm/scripts/rvm ]] && source \$HOME/.rvm/scripts/rvm"
330
- printf "\n Please note that this must only occur once - so, you only need to add it the first time you install rvm."
331
- printf "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
332
- printf "\n This means that if you see '[ -z \"\$PS1\" ] && return' then you must change this line to:"
333
- printf "\n if [[ -n \"\$PS1\" ]] ; then"
334
- printf "\n ... original content that was below the && return line ..."
335
- printf "\n fi # <= be sure to close the if."
336
- printf "\n #EOF .bashrc"
337
- printf "\n Be absolutely *sure* to REMOVE the '&& return'."
338
- printf "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile."
339
- printf "\n placing all non-interactive items in the .bashrc, including the 'source' line above"
340
- printf "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
403
+ if [[ ${rvm_selfcontained:-0} -eq 1 ]] ; then
404
+ installation_complete
341
405
  fi
342
- if [[ -s "$HOME/.bashrc" ]] && \grep -q '&& return' "$HOME/.bashrc" ; then
343
- printf "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc."
344
- printf "\n This means that if you see '[ -z \"\$PS1\" ] && return' then you must change this line to:"
345
- printf "\n if [[ -n \"\$PS1\" ]] ; then"
346
- printf "\n ... original content that was below the && return line ..."
347
- printf "\n fi # <= be sure to close the if."
348
- printf "\n #EOF .bashrc"
349
- printf "\nEven if you use zsh you should still adjust the .bashrc as above."
350
- printf "\nIf you have any questions about this please visit #rvm on irc.freenode.net.\n"
406
+
407
+ if [[ -s "$HOME/.bashrc" ]] && grep -q '&& return' "$HOME/.bashrc" ; then
408
+ andand_return_warning
351
409
  fi
410
+
352
411
  check_rubyopt_conditions
412
+
353
413
  printf "\nInstallation of RVM to $rvm_path/ is complete.\n\n"
354
414
  fi
355
415
 
416
+ thank_you
417
+
356
418
  exit 0
@@ -2,6 +2,8 @@
2
2
 
3
3
  # __rvm_select implementation version patch_level
4
4
  __rvm_select() {
5
+
6
+ # Set Variable Defaults
5
7
  rvm_ruby_interpreter=${rvm_ruby_interpreter:-""}
6
8
  rvm_head_flag=${rvm_head_flag:-0}
7
9
  rvm_install_on_use_flag=${rvm_install_on_use_flag:-0}
@@ -10,6 +12,7 @@ __rvm_select() {
10
12
  rvm_ruby_revision=${rvm_ruby_revision:-""}
11
13
  rvm_ruby_name=${rvm_ruby_name:-""}
12
14
  rvm_ruby_gem_home=${rvm_ruby_gem_home:-""}
15
+
13
16
  export GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION
14
17
 
15
18
  if [[ -z "${rvm_ruby_string:-""}" ]] ; then
@@ -27,16 +30,20 @@ __rvm_select() {
27
30
  case "$rvm_ruby_interpreter" in
28
31
  macruby)
29
32
  if [[ "Darwin" = "$(uname)" ]] ; then
33
+
30
34
  rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version}
35
+
31
36
  if [[ $rvm_head_flag -eq 1 ]] ; then
32
37
  rvm_ruby_version="" ; rvm_ruby_tag=""
33
38
  rvm_ruby_revision="head"
34
39
  __rvm_db "macruby_repo_url" "rvm_ruby_repo_url"
35
40
  rvm_url="$rvm_ruby_repo_url"
41
+
36
42
  elif [[ "nightly" = "$rvm_ruby_version" ]] ; then
37
43
  __rvm_db "macruby_nightly_url" "rvm_url"
38
44
  rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}"
39
45
  rvm_ruby_package_file="$rvm_ruby_package_name"
46
+
40
47
  else
41
48
  __rvm_db "macruby_version" "rvm_ruby_version"
42
49
  __rvm_db "macruby_url" "rvm_url"
@@ -55,6 +62,7 @@ __rvm_select() {
55
62
  rvm_ruby_interpreter="rbx"
56
63
  rvm_ruby_version=${rvm_ruby_version:-$(__rvm_db "rbx_version")}
57
64
  rvm_ruby_repo_url=${rvm_rbx_repo_url:-$(__rvm_db "rubinius_repo_url")}
65
+
58
66
  if [[ $rvm_head_flag -eq 0 ]] ; then
59
67
  rvm_ruby_patch_level=${rvm_ruby_patch_level:-$(__rvm_db "rbx_patch_level")}
60
68
  rvm_ruby_string="${rvm_ruby_string/-prc/-rc}"
@@ -62,6 +70,7 @@ __rvm_select() {
62
70
  rvm_ruby_package_file="$(echo "rubinius-${rvm_ruby_version}-${rvm_ruby_patch_level}.${rvm_archive_extension}" | sed 's#-p*#-#' )"
63
71
  __rvm_db "rbx_url" "rvm_url"
64
72
  rvm_url="$rvm_url/$rvm_ruby_package_file"
73
+
65
74
  else
66
75
  rvm_ruby_patch_level="" ; rvm_ruby_version=""
67
76
  fi
@@ -69,10 +78,12 @@ __rvm_select() {
69
78
 
70
79
  jruby)
71
80
  rvm_ruby_patch_level=""
81
+
72
82
  if [[ $rvm_head_flag -eq 1 ]] ; then
73
83
  rvm_ruby_version="head"
74
84
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
75
85
  rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
86
+
76
87
  else
77
88
  rvm_archive_extension="tar.gz"
78
89
  rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "jruby_version")"}"
@@ -82,6 +93,7 @@ __rvm_select() {
82
93
  rvm_url="${jruby_url}/${rvm_ruby_version}/${rvm_ruby_package_file}.tar.gz"
83
94
  jruby_url=""
84
95
  fi
96
+
85
97
  alias jruby_ng="jruby --ng"
86
98
  alias jruby_ng_server="jruby --ng-server"
87
99
  ;;
@@ -89,10 +101,12 @@ __rvm_select() {
89
101
  maglev)
90
102
  rvm_ruby_patch_level=""
91
103
  maglev_url="$(__rvm_db "maglev_url")"
104
+
92
105
  if [[ $rvm_head_flag -eq 1 ]] ; then
93
106
  rvm_ruby_version="head"
94
107
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
95
108
  rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "maglev_repo_url")}"
109
+
96
110
  else
97
111
  system="$(uname -s)"
98
112
  arch="$(uname -m)"
@@ -108,11 +122,13 @@ __rvm_select() {
108
122
 
109
123
  ironruby)
110
124
  rvm_ruby_patch_level=""
125
+
111
126
  if [[ ${rvm_head_flag:-0} -eq 1 ]] ; then
112
127
  rvm_ruby_version="head"
113
128
  rvm_ruby_package_name="${rvm_ruby_string}"
114
129
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
115
130
  rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
131
+
116
132
  else
117
133
  rvm_archive_extension="zip"
118
134
  rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ironruby_version")"}
@@ -120,12 +136,14 @@ __rvm_select() {
120
136
  rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}.${rvm_archive_extension}"
121
137
  rvm_url="$(__rvm_db "ironruby_${rvm_ruby_version}_url")${rvm_ruby_package_file}"
122
138
  fi
139
+
123
140
  export rvm_ruby_version rvm_ruby_string rvm_ruby_package_name rvm_ruby_repo_url rvm_url rvm_archive_extension
124
141
  ;;
125
142
 
126
143
  ree)
127
144
  rvm_ruby_interpreter=ree
128
145
  rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ree_version")"}
146
+
129
147
  if [[ ! -z "$rvm_ruby_patch_level" ]] ; then
130
148
  rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | sed 's#^p##')"
131
149
  fi
@@ -134,6 +152,7 @@ __rvm_select() {
134
152
  if [[ ! -z "$rvm_ruby_revision" ]] ; then
135
153
  rvm_ruby_patch_level="" ; rvm_ruby_package_file=""
136
154
  rvm_ruby_package_name="ree-$rvm_ruby_version-$rvm_ruby_revision"
155
+
137
156
  else
138
157
  rvm_ruby_package_file="ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level"
139
158
  rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
@@ -158,8 +177,10 @@ __rvm_select() {
158
177
  ruby)
159
178
  if [[ -z "${rvm_ruby_version:-""}" && ${rvm_head_flag:-0} -eq 0 ]]; then
160
179
  "$rvm_scripts_path/log" "fail" "Unknown ruby version: $rvm_ruby_version"
180
+
161
181
  else
162
182
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
183
+
163
184
  if [[ ${rvm_head_flag:-0} -eq 0 ]]; then
164
185
  rvm_archive_extension="tar.bz2"
165
186
  fi
@@ -168,8 +189,10 @@ __rvm_select() {
168
189
 
169
190
  current)
170
191
  ruby_binary="$(command -v ruby)"
192
+
171
193
  if [[ $? -eq 0 ]] && "$rvm_scripts_path/match" "$ruby_binary" "rvm" ; then
172
194
  rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
195
+
173
196
  else
174
197
  rvm_ruby_interpreter="system"
175
198
  fi
@@ -183,6 +206,7 @@ __rvm_select() {
183
206
  if [[ ! -z "$MY_RUBY_HOME" ]] ; then
184
207
  rvm_ruby_string=$(basename $MY_RUBY_HOME)
185
208
  __rvm_select
209
+
186
210
  else
187
211
  if [[ -z "$rvm_ruby_string" ]] ; then
188
212
  "$rvm_scripts_path/log" "fail" "Ruby implementation '$rvm_ruby_interpreter' is not known."
@@ -194,6 +218,7 @@ __rvm_select() {
194
218
  __rvm_gemset_select
195
219
 
196
220
  if [[ -n "$rvm_ruby_interpreter" && "system" != "$rvm_ruby_interpreter" && "default" != "$rvm_ruby_interpreter" ]] ; then
221
+
197
222
  if [[ ! -z "$rvm_ruby_version" ]] ; then
198
223
  rvm_release_version="${rvm_ruby_version/.*/}"
199
224
  rvm_major_version=${rvm_ruby_version%.*} ; rvm_major_version=${rvm_major_version#*.}
@@ -247,6 +272,7 @@ __rvm_use() {
247
272
  local new_path=""
248
273
 
249
274
  if [[ $rvm_ruby_selected_flag -eq 0 ]] ; then __rvm_select "$@" ; fi
275
+
250
276
  if [[ -z "$rvm_ruby_interpreter" ]] ; then rvm_ruby_interpreter="system" ; fi
251
277
 
252
278
  if [[ "system" = "$rvm_ruby_interpreter" ]] ; then
@@ -254,8 +280,11 @@ __rvm_use() {
254
280
  unset GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME RUBY_VERSION IRBRC
255
281
 
256
282
  new_path="$rvm_bin_path:$(__rvm_remove_rvm_from_path ; printf "$PATH")"
283
+
257
284
  if [[ -s $rvm_config_path/system ]] ; then
285
+
258
286
  \grep "MY_RUBY_HOME='$rvm_rubies_path" "$rvm_config_path/system" > /dev/null
287
+
259
288
  if [[ $? -eq 0 ]] ; then
260
289
  [[ -f "$rvm_config_path/system" ]] && \rm -f $rvm_config_path/system # 'system' should *not* point to an rvm ruby.
261
290
  else
@@ -266,8 +295,11 @@ __rvm_use() {
266
295
  # Check binaries, remove under the condition they're symlinks.
267
296
  local binary full_binary_path
268
297
  if [[ "$rvm_selfcontained" = "0" ]] ; then
298
+
269
299
  for binary in ruby gem irb ri rdoc rake erb testrb ; do
300
+
270
301
  full_binary_path="$rvm_bin_path/$binary"
302
+
271
303
  [[ -L "$full_binary_path" ]] && \rm -f "$full_binary_path"
272
304
  done
273
305
  fi
@@ -539,6 +571,7 @@ __rvm_ruby_string() {
539
571
  patch_level="$(__rvm_db "${rvm_ruby_interpreter}_${rvm_ruby_version}_patch_level")"
540
572
 
541
573
  if [[ -n "${patch_level:-""}" ]] ; then
574
+
542
575
  if [[ "ree" = "$rvm_ruby_interpreter" ]] || [[ "rbx" = "$rvm_ruby_interpreter" ]] ; then
543
576
  rvm_ruby_patch_level="${patch_level}"
544
577
  else
@@ -547,10 +580,13 @@ __rvm_ruby_string() {
547
580
  fi
548
581
 
549
582
  if [[ -n "${rvm_ruby_patch_level:-""}" ]] ; then
583
+
550
584
  rvm_ruby_patch_level="$(echo $rvm_ruby_patch_level | sed 's#^pp#p#')"
551
585
  rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_patch_level}"
586
+
552
587
  if [[ "ree" = "${rvm_ruby_interpreter:-""}" ]] || [[ "rbx" = "${rvm_ruby_interpreter:-""}" ]] ; then
553
588
  rvm_ruby_string="$(echo $rvm_ruby_string | sed 's#-p*#-#')"
589
+
554
590
  else
555
591
  rvm_ruby_string="$(echo $rvm_ruby_string | sed 's#-pp#-p#')"
556
592
  rvm_ruby_string="$(echo $rvm_ruby_string | sed 's#-prc#-rc#')"
@@ -575,9 +611,11 @@ __rvm_gemset_select() {
575
611
  rvm_ruby_global_gems_path="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}global"
576
612
 
577
613
  if [[ -z "${rvm_gemset_name:-""}" ]] ; then
614
+
578
615
  # No longer defaulting to 'sticky' gem sets.
579
616
  # Set 'rvm_sticky_flag=1' in ~/.rvmrc to enable.
580
617
  if [[ ${rvm_sticky_flag:-0} -eq 1 ]] ; then
618
+
581
619
  if [[ -n "${GEM_HOME:-""}" ]] ; then
582
620
  rvm_gemset_name=$(echo $GEM_HOME | xargs basename | awk -F${rvm_gemset_separator} '{print $2}')
583
621
  fi
@@ -589,26 +627,33 @@ __rvm_gemset_select() {
589
627
 
590
628
  if [[ -n "${rvm_gemset_name:-""}" ]] && ! "$rvm_scripts_path/match" "$rvm_gemset_name" "^[0-9]\.[0-9]" ; then
591
629
  rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
630
+
592
631
  else
593
632
  if [[ -n "${rvm_ruby_string:-""}" ]] && [[ "${rvm_ruby_interpreter:-""}" != "system" ]] ; then
594
633
  rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
634
+
595
635
  elif [[ -z "${GEM_HOME:-""}" ]] && [[ -n "$(command -v gem)" ]] ; then
596
636
  rvm_ruby_gem_home=$(gem env gemdir)
637
+
597
638
  elif [[ -n "${GEM_HOME:-""}" ]] ; then
598
639
  rvm_ruby_gem_home="$GEM_HOME"
640
+
599
641
  else
600
642
  rvm_ruby_gem_home=""
601
643
  fi
602
644
  fi
603
645
  else
604
646
  local gemset=$(echo "$rvm_ruby_gem_home" | awk -F'@' '{print $NF}')
647
+
605
648
  if [[ -z "${rvm_ruby_string:-""}" && -n "${GEM_HOME:-""}" && -n "${GEM_HOME/@*/}" ]] ; then
606
649
  rvm_ruby_string=$(basename ${GEM_HOME/@*/})
607
650
  fi
608
651
 
609
652
  if [[ -n "${rvm_ruby_string:-""}" ]] ; then
653
+
610
654
  if [[ -z "${rvm_ruby_gem_home:-""}" || -n "${gemset:-""}" ]] ; then
611
655
  rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
656
+
612
657
  elif [[ -n "${gemset:-""}" && "${rvm_gemset_name:-""}" != "${gemset:-""}" ]] ; then
613
658
  rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
614
659
  fi
@@ -641,7 +686,7 @@ __rvm_gemset_select() {
641
686
  \mkdir -p "$rvm_ruby_gem_home"
642
687
  if [[ -n "${rvm_ruby_gem_home:-""}" ]] && echo "$rvm_ruby_gem_home" | \grep -q 'rvm'; then
643
688
  if __rvm_using_gemset_globalcache && [[ ! -L "$rvm_ruby_gem_home/cache" ]]; then
644
- mv "$rvm_ruby_gem_home/cache/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
689
+ \mv "$rvm_ruby_gem_home/cache/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
645
690
  \rm -rf "$rvm_ruby_gem_home/cache"
646
691
  \ln -nfs "$rvm_gems_cache_path" "$rvm_ruby_gem_home/cache"
647
692
  fi
@@ -652,12 +697,16 @@ __rvm_gemset_select() {
652
697
 
653
698
  # Use a gemset specified by 'rvm_ruby_gem_home'
654
699
  __rvm_gemset_use() {
655
- rvm_verbose_flag=${rvm_verbose_flag:-0}
656
- rvm_ruby_gem_home=${rvm_ruby_gem_home:-""}
700
+ if [[ -z "${rvm_gemset_name:-""}" ]] ; then
701
+ "$rvm_scripts_path/log" "error" "Gemset was not given.\n Usage:\n rvm gemset use <gemsetname>\n"
702
+ return 1
703
+ fi
704
+
705
+ if [[ -n "${rvm_ruby_gem_home:-""}" ]] ; then
657
706
 
658
- if [[ -n "$rvm_ruby_gem_home" ]] ; then
659
707
  if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
660
- if [[ "$rvm_gemset_create_on_use_flag" -eq 1 ]] || [[ "$rvm_create_flag" -eq 1 ]]; then
708
+
709
+ if [[ ${rvm_gemset_create_on_use_flag:-0} -eq 1 || ${rvm_create_flag:-0} -eq 1 ]] ; then
661
710
  "$rvm_scripts_path/gemsets" create "$rvm_gemset_name"
662
711
  else
663
712
  "$rvm_scripts_path/log" "error" "Gemset '$rvm_gemset_name' does not exist, rvm gemset create '$rvm_gemset_name' first."
@@ -665,11 +714,11 @@ __rvm_gemset_use() {
665
714
  fi
666
715
  fi
667
716
 
668
- if [[ "$rvm_interactive_flag" -eq 1 ]] || [[ "$rvm_verbose_flag" -eq 1 ]] ; then
717
+ if [[ ${rvm_interactive_flag:-0} -eq 1 && ${rvm_verbose_flag:-1} -ne 0 ]] ; then
669
718
  "$rvm_scripts_path/log" "info" "Now using gemset '${rvm_gemset_name:-default}'"
670
719
  fi
671
720
 
672
- rvm_ruby_gem_home="$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}${rvm_gemset_name}"
721
+ rvm_ruby_gem_home="$(echo "${GEM_HOME:-""}" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}${rvm_gemset_name}"
673
722
  GEM_HOME="$rvm_ruby_gem_home"
674
723
  BUNDLE_PATH="$rvm_ruby_gem_home"
675
724
  GEM_PATH="$rvm_ruby_gem_home/bin:$(echo "$GEM_HOME" | sed 's/'${rvm_gemset_separator}'.*$//')${rvm_gemset_separator}global/bin"