rvm 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/install CHANGED
@@ -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
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 0
4
- :patch: 3
4
+ :patch: 4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rvm}
8
- s.version = "1.0.3"
8
+ s.version = "1.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wayne E. Seguin"]
@@ -75,21 +75,30 @@ __rvm_parse_args() {
75
75
 
76
76
  if [[ -z "$next_token" ]] ; then
77
77
  rvm_ruby_args="help"
78
+
78
79
  elif [[ "clear" = "$next_token" ]] ; then
79
80
  __rvm_gemset_clear
80
81
  rvm_ruby_args="clear"
82
+
81
83
  elif [[ "use" = "$next_token" ]] ; then
82
84
  rvm_use_flag=1
83
- rvm_ruby_args="$@" ; shift
84
- rvm_gemset_name="$next_token" ; shift
85
- if [[ ! -z "$(echo $rvm_gemset_name | \grep $rvm_gemset_separator)" ]] ; then
86
- rvm_ruby_string=$(echo $rvm_gemset_name | sed 's/\(.*\)'${rvm_gemset_separator}'.*/\1/')
87
- rvm_gemset_name=$(echo $rvm_gemset_name | sed 's/.*'${rvm_gemset_separator}'\(.*\)/\1/')
88
- if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then
85
+ rvm_ruby_args="$@"
86
+ rvm_gemset_name="$next_token"
87
+ shift # Clear next_token
88
+
89
+ if [[ $# -gt 0 ]] ; then rvm_gemset_name="$1" ; else rvm_gemset_name="" ; fi
90
+
91
+ if echo $rvm_gemset_name | \grep -q $rvm_gemset_separator ; then
92
+ rvm_ruby_string=$(echo $rvm_gemset_name | sed -e 's/\(.*\)'${rvm_gemset_separator}'.*/\1/')
93
+ rvm_gemset_name=$(echo $rvm_gemset_name | sed -e 's/.*'${rvm_gemset_separator}'\(.*\)/\1/')
94
+
95
+ if [[ "${rvm_ruby_string:-""}" != "${rvm_gemset_name:-""}" ]] ; then
89
96
  rvm_ruby_string="$rvm_ruby_string${rvm_gemset_separator}$rvm_gemset_name"
90
97
  fi
98
+
91
99
  rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator}$rvm_gemset_name"
92
100
  fi
101
+
93
102
  elif [[ "delete" = "$next_token" ]] ; then
94
103
  rvm_delete_flag=1
95
104
  rvm_ruby_args="$@" ; shift
@@ -102,6 +111,7 @@ __rvm_parse_args() {
102
111
  fi
103
112
  rvm_ruby_gem_home="$rvm_ruby_gem_home${rvm_gemset_separator}$rvm_gemset_name"
104
113
  fi
114
+
105
115
  else
106
116
  rvm_gemset_name="${rvm_gemset_name:-""}"
107
117
  if [[ "$rvm_ruby_string" != "$rvm_gemset_name" ]] ; then __rvm_ruby_string ; fi
@@ -155,14 +165,18 @@ __rvm_parse_args() {
155
165
 
156
166
  do|ruby|rake|gem|rubydo|rakedo|gemdo)
157
167
  if [[ "do" = "${rvm_action:-""}" ]] ; then rvm_action="ruby" ; fi
158
- rvm_action=$(echo $rvm_token | sed 's#do##g')
168
+
169
+ rvm_action=${rvm_token//do}
170
+
159
171
  if [[ "rake" = "${rvm_action:-""}" || "gem" = "${rvm_action:-""}" || "ruby" = "${rvm_action:-""}" ]] ; then
172
+
160
173
  if [[ -z "$next_token" ]] ; then
174
+
161
175
  if [[ "gem" = "${rvm_action:-""}" ]] ; then
162
176
  rvm_action="error"
163
177
  rvm_error_message="'rvm $rvm_action' must be followed by arguments."
164
178
  elif [[ "ruby" = "${rvm_action:-""}" ]] ; then
165
- if echo "$rvm_ruby_strings":-""} | \grep -q ',' ; then
179
+ if echo "${rvm_ruby_strings:-""}" | \grep -q ',' ; then
166
180
  rvm_action="ruby"
167
181
  rvm_ruby_args=""
168
182
  else
@@ -170,14 +184,17 @@ __rvm_parse_args() {
170
184
  rvm_error_message="rvm X,Y,Z '$rvm_action' must be followed by arguments."
171
185
  fi
172
186
  fi
187
+
173
188
  elif [[ "-S" = "$next_token" ]] ; then
174
189
  rvm_action="ruby"
175
190
  rvm_ruby_args="$flag $(__rvm_quote_args "$@")"
176
191
  rvm_parse_break=1
192
+
177
193
  elif [[ "-e" = "$next_token" ]] ; then
178
194
  rvm_action="ruby"
179
195
  rvm_ruby_args="$flag $(__rvm_quote_args "$@")"
180
196
  rvm_parse_break=1
197
+
181
198
  else
182
199
  rvm_ruby_args="$(__rvm_quote_args "$@")"
183
200
  rvm_parse_break=1
@@ -185,10 +202,12 @@ __rvm_parse_args() {
185
202
  else
186
203
  if "$rvm_scripts_path"/match "$next_token" "^-" ; then
187
204
  unset rvm_ruby_strings
205
+
188
206
  else
189
207
  if "$rvm_scripts_path"/match "$next_token" "^[0-9]" ; then
190
208
  rvm_ruby_strings="${1//,/ }" ; shift
191
209
  unset rvm_ruby_interpreter
210
+
192
211
  else
193
212
  if [[ "ruby rbx jruby macruby ree rubinius maglev mput shyouhei ironruby" =~ $next_token ]] ; then
194
213
  rvm_ruby_strings=$next_token
@@ -523,13 +542,9 @@ rvm() {
523
542
  __rvm_initialize
524
543
  __rvm_parse_args "$@"
525
544
 
526
- rvm_reload_flag=${rvm_reload_flag:-0}
527
- rvm_use_flag=${rvm_reload_flag:-0}
528
- rvm_delete_flag=${rvm_delete_flag:-0}
529
545
  rvm_action="${rvm_action:-usage}"
530
546
 
531
- export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive_flag rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_patch_names rvm_patch_original_pwd rvm_clang_flag rvm_install_arguments
532
- export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_patches_path rvm_patches_path rvm_patchsets_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_ruby_aliases rvm_quiet_flag rvm_silent_flag
547
+ export BUNDLE_PATH GEM_HOME GEM_PATH rvm_ruby_string rvm_action rvm_bin_flag rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_file_name rvm_gemset_name rvm_head_flag rvm_install_on_use_flag rvm_interactive_flag rvm_llvm_flag rvm_make_flags rvm_proxy rvm_remove_flag rvm_ruby_args rvm_ruby_configure_flags rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_name rvm_ruby_version rvm_system_flag rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_patch_names rvm_patch_original_pwd rvm_clang_flag rvm_install_arguments rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_patches_path rvm_patches_path rvm_patchsets_path rvm_log_path rvm_bin_path rvm_gems_path rvm_config_path rvm_tmp_path rvm_hooks_path rvm_gems_cache_path rvm_gemset_separator rvm_ruby_aliases rvm_quiet_flag rvm_silent_flag
533
548
 
534
549
  result=0
535
550
 
@@ -589,20 +604,23 @@ rvm() {
589
604
 
590
605
  gemset)
591
606
  #if "$rvm_scripts_path/match" $rvm_ruby_args use ; then
592
- if [[ "$rvm_use_flag" -eq 1 ]] ; then
607
+ if [[ ${rvm_use_flag:-0} -eq 1 ]] ; then
593
608
  __rvm_gemset_select
594
609
  result=$? ; if [[ $result -eq 0 ]] ; then
595
610
  __rvm_gemset_use
596
611
  fi
597
612
  else
598
613
  export rvm_ruby_strings
614
+
599
615
  "$rvm_scripts_path/gemsets" $rvm_ruby_args ; result=$?
616
+
600
617
  rvm_ruby_strings=""
601
618
 
602
619
  # Clear the gemset.
603
- if [[ $rvm_delete_flag -eq 1 ]] ; then
604
- gem_prefix="$(echo $GEM_HOME | sed 's/'${rvm_gemset_separator}'.*$//')"
605
- if [[ "$GEM_HOME" = "${gem_prefix}${rvm_gemset_separator}${rvm_gemset_name}" ]] ; then
620
+ if [[ ${rvm_delete_flag:-0} -eq 1 ]] ; then
621
+ gem_prefix="$(echo "${GEM_HOME:-""}" | sed 's/'${rvm_gemset_separator}'.*$//')"
622
+
623
+ if [[ "${GEM_HOME:-""}" = "${gem_prefix}${rvm_gemset_separator}${rvm_gemset_name}" ]] ; then
606
624
  rvm_ruby_gem_home="$gem_prefix"
607
625
  GEM_HOME="$rvm_ruby_gem_home"
608
626
  BUNDLE_PATH="$rvm_ruby_gem_home"
@@ -647,7 +665,7 @@ rvm() {
647
665
  result=1
648
666
  esac
649
667
 
650
- if [[ ! -z "$rvm_reload_flag" ]] ; then
668
+ if [[ ${rvm_reload_flag:-0} -eq 1 ]] ; then
651
669
  source "$rvm_scripts_path/rvm"
652
670
  # Note: Not using builtin on purpose. Done so we can trigger a reload the rvmrc.
653
671
  __rvm_project_rvmrc
@@ -655,7 +673,7 @@ rvm() {
655
673
 
656
674
  __rvm_teardown
657
675
 
658
- if [[ $rvm_trace_flag -eq 1 ]] ; then
676
+ if [[ ${rvm_trace_flag:-0} -eq 1 ]] ; then
659
677
  set +x
660
678
  rvm_trace_flag=0
661
679
  fi