rvm 0.1.18 → 0.1.19

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.
@@ -12,15 +12,23 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
12
12
  if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
13
13
  if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
14
14
 
15
+ if [[ -z "$rvm_prefix" ]] ; then
16
+ if [[ "root" = "$(whoami)" ]] ; then
17
+ rvm_prefix="/usr/local"
18
+ else
19
+ rvm_prefix="$HOME"
20
+ fi
21
+ fi
22
+
15
23
  if [[ -z "$rvm_path" ]] ; then
16
24
  unset rvm_path
17
25
  if [[ "root" = "$(whoami)" ]] ; then
18
- rvm_path="/usr/local/rvm"
26
+ rvm_path="$rvm_prefix/rvm"
19
27
  else
20
28
  if [[ -d "$HOME/.rvm" ]] && [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
21
29
  rvm_path="$HOME/.rvm"
22
- elif [[ -d "/usr/local/rvm" ]] && [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
23
- rvm_path="/usr/local/rvm"
30
+ elif [[ -d "$rvm_prefix/rvm" ]] && [[ -s "$rvm_prefix/rvm/scripts/rvm" ]] ; then
31
+ rvm_path="$rvm_prefix/rvm"
24
32
  else
25
33
  rvm_path="$HOME/.rvm"
26
34
  fi
@@ -48,7 +56,6 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
48
56
  source $rvm_scripts_path/version
49
57
  source $rvm_scripts_path/selector
50
58
  source $rvm_scripts_path/cli
51
- source $rvm_scripts_path/libraries
52
59
  source $rvm_scripts_path/cd
53
60
 
54
61
  rvm_loaded_flag=1
@@ -61,8 +68,8 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
61
68
  source "$HOME/.rvm/default"
62
69
  elif [[ -s "$rvm_config_path/default" ]] ; then
63
70
  source "$rvm_config_path/default"
64
- elif [[ -s "/usr/local/rvm/config/default" ]] ; then
65
- source "/usr/local/rvm/config/default"
71
+ elif [[ -s "$rvm_prefix/rvm/config/default" ]] ; then
72
+ source "$rvm_prefix/rvm/config/default"
66
73
  fi
67
74
  else
68
75
  echo -e "\$rvm_path is not set. rvm cannot load."
@@ -35,17 +35,17 @@ while [[ $# -gt 0 ]] ; do
35
35
  esac
36
36
  done
37
37
 
38
- __rvm_load_rvmrc
39
-
40
- if [[ -z "$rvm_path" ]] ; then
41
- unset rvm_path
38
+ if [[ -z "$rvm_prefix" ]] ; then
39
+ __rvm_load_rvmrc
42
40
  if [[ "root" = "$(whoami)" ]] ; then
43
- rvm_path="/usr/local/rvm"
41
+ rvm_prefix="/usr/local/"
44
42
  else
45
- rvm_path="$HOME/.rvm"
43
+ rvm_prefix="$HOME/."
46
44
  fi
47
45
  fi
48
46
 
47
+ if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
48
+
49
49
  source scripts/initialize
50
50
  __rvm_initialize
51
51
 
@@ -69,7 +69,7 @@ rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
69
69
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
70
70
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
71
71
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
72
- rvm_symlink_path="${rvm_symlink_path:-/usr/local/bin}"
72
+ rvm_symlink_path="${rvm_symlink_path:-$rvm_prefix/bin}"
73
73
 
74
74
  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 $rvm_symlink_path $HOME/.gem/cache
75
75
 
@@ -92,6 +92,11 @@ if [[ ! -s "$rvm_config_path/user" ]] ; then
92
92
  echo '# Users settings file, overrides db file settings and persists across installs.' >> $rvm_config_path/user
93
93
  fi
94
94
 
95
+ scripts="monitor match log install color db fetch log set libraries"
96
+ for script_name in $(echo $scripts) ; do
97
+ chmod +x $rvm_scripts_path/$script_name
98
+ done
99
+
95
100
  #
96
101
  # Bin Scripts
97
102
  #
@@ -167,6 +172,7 @@ echo -e "\nThank you for using rvm. I hope that it makes your work easier and mo
167
172
  echo -e "If you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know."
168
173
  echo -e "My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST."
169
174
  echo -e "If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back."
175
+ echo -e "Be sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'."
170
176
  echo -e "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!"
171
177
  echo -e "\n ~ Wayne"
172
178
  echo -e "\n********************************************************************************"
@@ -176,13 +182,14 @@ if [[ "root" != "$(whoami)" ]] ; then
176
182
  echo -e "\n1) Place the folowing line at the end of your shell's loading files(.bashrc and then .bash_profile for bash and .zshrc for zsh), after all path/variable settings:"
177
183
  echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
178
184
  echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
179
- echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must split your .bashrc"
185
+ echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must remove it and split your .bashrc"
180
186
  echo -e "\n Put everything *except the return code line(s)* into your .bash_profile, and everything above that code in your .bashrc."
187
+ echo -e "\n Be *sure* to REMOVE the '&& return' statement line."
181
188
  echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
182
189
  echo -e "\n4) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
183
190
  fi
184
191
 
185
- if grep '&& return' ~/.bashrc ; then
192
+ if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then
186
193
  echo -e "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc. Please remove it and refactor your profiles to be correct. If you have questions about this please visit #rvm on irc.freenode.net.\n\n"
187
194
  fi
188
195
 
@@ -186,7 +186,7 @@ __rvm_select() {
186
186
  fi
187
187
  esac
188
188
 
189
- __rvm_gems_select
189
+ __rvm_gemset_select
190
190
 
191
191
  if [[ ! -z "$rvm_ruby_interpreter" ]] && [[ "system" != "$rvm_ruby_interpreter" ]] && [[ "default" != "$rvm_ruby_interpreter" ]] ; then
192
192
  if [[ ! -z "$rvm_ruby_version" ]] ; then
@@ -207,15 +207,15 @@ __rvm_select() {
207
207
  export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
208
208
  fi
209
209
 
210
- if [[ ! -z "$rvm_gem_set_name" ]] ; then
211
- rvm_ruby_gem_home="${rvm_ruby_gem_home}%${rvm_gem_set_name}"
210
+ if [[ ! -z "$rvm_gemset_name" ]] ; then
211
+ rvm_ruby_gem_home="${rvm_ruby_gem_home}%${rvm_gemset_name}"
212
212
  fi
213
213
 
214
214
  rvm_ruby_selected_flag=1
215
215
 
216
216
  mkdir -p $rvm_ruby_log_path
217
217
 
218
- export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_configure_flags rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gem_set_name rvm_gems_path rvm_ruby_gem_home rvm_path rvm_src_path rvm_bin_path rvm_ruby_binary rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_src_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_string
218
+ export rvm_ruby_interpreter rvm_ruby_version rvm_ruby_repo_url rvm_ruby_package_name rvm_url rvm_ruby_patch_level rvm_ruby_configure rvm_ruby_configure_flags rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_gemset_name rvm_gems_path rvm_ruby_gem_home rvm_path rvm_src_path rvm_bin_path rvm_ruby_binary rvm_ruby_home rvm_log_path rvm_ruby_log_path rvm_src_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_string
219
219
  else
220
220
  rvm_ruby_interpreter="${rvm_ruby_interpreter:-system}"
221
221
  fi
@@ -319,7 +319,7 @@ __rvm_use() {
319
319
 
320
320
  echo "export PATH=\"$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_bin_path:\$PATH\"" > $rvm_config_path/default
321
321
 
322
- for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gem_set_name MAGLEV_HOME ; do
322
+ for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME IRBRC rvm_ruby_string rvm_gemset_name MAGLEV_HOME ; do
323
323
  eval "export $variable"
324
324
  eval value=\$${variable}
325
325
  if [[ ! -z "$value" ]] ; then
@@ -340,7 +340,7 @@ __rvm_use() {
340
340
  if [[ ! -z "$rvm_rvmrc_flag" ]] ; then __rvm_set_rvmrc ; fi
341
341
  # Export ruby string and gem set name for extrnal scripts to take advantage of them.
342
342
  if [[ ! -z "$rvm_ruby_string" ]] ; then export rvm_ruby_string ; fi
343
- if [[ ! -z "$rvm_gem_set_name" ]] ; then export rvm_gem_set_name ; fi
343
+ if [[ ! -z "$rvm_gemset_name" ]] ; then export rvm_gemset_name ; fi
344
344
  if [[ ! -z "$new_path" ]] ; then export PATH="$new_path" ; unset new_path ; fi
345
345
 
346
346
  if [[ "maglev" = "$rvm_ruby_interpreter" ]] ; then
@@ -357,7 +357,7 @@ __rvm_use() {
357
357
 
358
358
  __rvm_ruby_string() {
359
359
  # rvm_ruby_string may designate any of the following items:
360
- # * rvm_gem_set_name
360
+ # * rvm_gemset_name
361
361
  # * rvm_ruby_interpreter
362
362
  # * rvm_ruby_version
363
363
  # * rvm_ruby_patch_level
@@ -366,7 +366,7 @@ __rvm_ruby_string() {
366
366
  # * rvm_ruby_patch
367
367
 
368
368
  set_name=$(echo "$rvm_ruby_string" | awk -F'%' '{print $2}')
369
- if [[ ! -z "$set_name" ]] ; then rvm_gem_set_name="$set_name" ; fi
369
+ if [[ ! -z "$set_name" ]] ; then rvm_gemset_name="$set_name" ; fi
370
370
  ruby_string=$(echo "$rvm_ruby_string" | awk -F'%' '{print $1}')
371
371
 
372
372
  __rvm_unset_ruby_variables
@@ -378,11 +378,11 @@ __rvm_ruby_string() {
378
378
  export rvm_head_flag=1
379
379
  elif [[ "default" = "$string" ]] ; then
380
380
  rvm_ruby_interpreter="default"
381
- unset rvm_ruby_patch_level rvm_ruby_tag rvm_head_flag rvm_ruby_revision rvm_ruby_version rvm_gem_set_name
381
+ unset rvm_ruby_patch_level rvm_ruby_tag rvm_head_flag rvm_ruby_revision rvm_ruby_version rvm_gemset_name
382
382
  return
383
383
  elif [[ "system" = "$string" ]] ; then
384
384
  rvm_ruby_interpreter="system"
385
- unset rvm_ruby_patch_level rvm_ruby_tag rvm_head_flag rvm_ruby_revision rvm_ruby_version rvm_gem_set_name
385
+ unset rvm_ruby_patch_level rvm_ruby_tag rvm_head_flag rvm_ruby_revision rvm_ruby_version rvm_gemset_name
386
386
  return
387
387
  elif [[ "nightly" = "$string" ]] ; then
388
388
  rvm_ruby_version="nightly"
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env bash
2
+
3
+ source $rvm_scripts_path/initialize
4
+ source $rvm_scripts_path/utility
5
+ source $rvm_scripts_path/selector
6
+
7
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
8
+
9
+ trap "if [[ -d $rvm_tmp_path/ ]] && [[ -s $rvm_tmp_path/$$ ]] ; then rm -f $rvm_tmp_path/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
10
+
11
+ action="$1" ; shift
12
+ args="$*"
13
+ if [[ -z "$action" ]] ; then
14
+ $rvm_scripts_path/log "error" "Action must be specified."
15
+ exit 1
16
+ fi
17
+
18
+ # Perform an action using one of a selected ruby's specified binaries.
19
+ __rvm_ruby_do() {
20
+ __rvm_select
21
+ __rvm_use
22
+
23
+ binary="$(echo $action | sed 's#do$##')"
24
+ if [[ -x "$rvm_ruby_home/bin/$binary" ]] ; then
25
+ rm -f "$rvm_path/gems/cache"
26
+ ln -nfs "$HOME/.gem/cache" "$rvm_path/gems/cache"
27
+ binary="$rvm_ruby_home/bin/$binary"
28
+ elif [[ -x "$rvm_ruby_global_gems_path/bin/$binary" ]] ; then
29
+ binary="$rvm_ruby_global_gems_path/bin/$binary"
30
+ elif [[ -x "$rvm_ruby_gem_home/bin/$binary" ]] ; then
31
+ binary="$rvm_ruby_gem_home/bin/$binary"
32
+ elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(which $binary)" ]] ; then
33
+ binary="$(basename $(which $binary 2>/dev/null) 2>/dev/null)"
34
+ else
35
+ $rvm_scripts_path/log "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
36
+ __rvm_unset_ruby_variables
37
+ return 1
38
+ fi
39
+
40
+ if [[ ! -z "$rvm_ruby_mode" ]] ; then
41
+ rvm_ruby_string="${rvm_ruby_string}-${rvm_ruby_mode}"
42
+ rvm_ruby_mode="--$(echo $rvm_ruby_mode | sed 's/^m//')"
43
+ fi
44
+
45
+ load_path="$(dirname $(which $binary 2>/dev/null) 2>/dev/null):$rvm_ruby_load_path"
46
+ # TODO: the else case below should be run if $args =~ /\.rb$/
47
+ if [[ "ruby" = "$(basename $binary)" ]] && [[ "$rvm_benchmark_flag" -ne 1 ]] ; then
48
+ if $rvm_scripts_path/match "$args" "\.rb$" ; then
49
+ if [[ -z "$prefix" ]] ; then prefix="-S" ; fi
50
+ if ! $rvm_scripts_path/match "$args" "$prefix" ; then
51
+ args="$prefix $args"
52
+ fi
53
+ fi
54
+ rvm_command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path $args"
55
+ elif [[ "gem" = "$(basename $binary)" ]] && $rvm_scripts_path/match "$args" '^install' ; then
56
+ #$rvm_scripts_path/gem install $args
57
+ rvm_command="$rvm_scripts_path/gemsets $rvm_ruby_mode $args $rvm_gem_options"
58
+ else
59
+ rvm_command="$binary $rvm_ruby_mode $args"
60
+ fi
61
+
62
+ if [[ ! -z "$rvm_json_flag" ]] || [[ ! -z "$rvm_yaml_flag" ]] || [[ ! -z "$rvm_summary_flag" ]] ; then
63
+ mkdir -p ./log/$rvm_ruby_string/
64
+ touch ./log/$rvm_ruby_string/$action.log ./log/$rvm_ruby_string/$action.error.log
65
+ eval "$rvm_command" >> ./log/$rvm_ruby_string/$action.log 2>> ./log/$rvm_ruby_string/$action.error.log
66
+ else
67
+ $rvm_scripts_path/log "info" "$rvm_ruby_string: $($rvm_ruby_home/bin/ruby -v $rvm_ruby_mode | tr "\n" ' ')"
68
+ eval "$rvm_command"
69
+ fi
70
+ result=$?
71
+
72
+ string=$(basename $rvm_ruby_gem_home)
73
+ if [[ $result -eq 0 ]]; then
74
+ eval "successes=(${successes[*]} $string)"
75
+ else
76
+ eval "errors=(${errors[*]} $string)"
77
+ fi
78
+ eval "rubies=(${rubies[*]} $string)"
79
+ eval "statuses=(${statuses[*]} $result)"
80
+ unset string
81
+ __rvm_unset_ruby_variables
82
+ }
83
+
84
+ # Output the summary in a human readable format.
85
+ __rvm_summary() {
86
+ export successes errors statuses
87
+ summary="\nSummary:\n\n"
88
+ if [[ ${#successes[*]} -gt 0 ]] ; then
89
+ summary="$summary \033[0;32m${#successes[*]} successful: $(echo "${successes[*]}" | sed 's# #, #g')\033[0m\n"
90
+ fi
91
+ if [[ ${#errors[*]} -gt 0 ]] ; then
92
+ summary="$summary \033[0;31m${#errors[*]} errors: $(echo "${errors[*]}" | sed 's# #, #g')\033[0m\n"
93
+ fi
94
+ total=${#rubies[*]}
95
+ if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
96
+ echo -e "$summary" | tee -a log/summary.log
97
+ return ${#errors[*]}
98
+ }
99
+
100
+ # Output the summary in a yaml format.
101
+ __rvm_yaml() {
102
+ export successes errors statuses
103
+ yaml="totals:\n rubies: ${#rubies[*]}\n successes: ${#successes[*]}\n errors: ${#errors[*]}\nsuccesses:"
104
+ for var in ${successes[*]} ; do yaml="$yaml\n - $var" ; done
105
+ yaml="$yaml\nerrors:"
106
+ for var in ${errors[*]} ; do yaml="$yaml\n - $var" ; done
107
+ yaml="$yaml\nrubies:"
108
+ total=${#rubies[*]}
109
+ if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
110
+ for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
111
+ if [[ ! -z "$rvm_debug_flag" ]] ; then
112
+ $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
113
+ fi
114
+ yaml="$yaml\n \"${rubies[$index]}\": ${statuses[$index]}"
115
+ done ; unset index array_start
116
+ mkdir -p log
117
+ echo -e "$yaml" | tee -a log/summary.yaml
118
+
119
+ return ${#errors[*]}
120
+ }
121
+
122
+ # Output the summary in a json format.
123
+ __rvm_json() {
124
+ json="{"
125
+ json="$json\n \"totals\": { \"rubies\": ${#rubies[*]}, \"successes\": ${#successes[*]}, \"errors\": ${#errors[*]}},"
126
+ json="$json\n \"successful\": [ "$(echo ${successes[*]} | sed 's# #", "#g')" ],"
127
+ json="$json\n \"errors\": [ "$(echo ${errors[*]} | sed 's# #", "#g')" ],"
128
+ json="$json\n \"rubies\": {"
129
+
130
+ total=${#rubies[*]}
131
+ if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
132
+ for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
133
+ if [[ ! -z "$rvm_debug_flag" ]] ; then
134
+ $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
135
+ fi
136
+ json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}"
137
+ if (( $index + 1 < $total + $array_start )) ; then json="$json, " ; fi
138
+ done ; unset index array_start
139
+ json="$json\n }\n}"
140
+
141
+ mkdir -p log
142
+ echo -e "$json" | tee -a log/summary.json
143
+
144
+ return ${#errors[*]}
145
+ }
146
+
147
+ # Loop over a set or all rvm installed rubies to perform some action.
148
+ # Record the results and report based on CLI selections.
149
+ #__rvm_do() {
150
+ rubies=() ; successes=() ; errors=() ; statuses=()
151
+ # TODO: Extract the common functionality out of the if below
152
+ if [[ ! -z "$rvm_ruby_string" ]] ; then
153
+ unset rvm_ruby_interpreter rvm_ruby_version
154
+ __rvm_ruby_do
155
+ elif [[ ! -z "$rvm_ruby_version" ]] ;then
156
+ for rvm_ruby_string in $(echo $rvm_ruby_version | tr ',' ' ') ; do
157
+ __rvm_ruby_do
158
+ done
159
+ elif [[ ! -z "$rvm_ruby_interpreter" ]] ; then
160
+ unset rvm_ruby_string rvm_ruby_version
161
+ __rvm_ruby_do
162
+ else # all
163
+ for full_binary in $rvm_rubies_path/*/bin/ruby ; do
164
+ if [[ -x "$full_binary" ]] ; then
165
+ rvm_ruby_string="$(dirname $full_binary | xargs dirname | xargs basename)"
166
+ __rvm_ruby_do
167
+ fi
168
+ done ; unset full_binary
169
+ fi
170
+
171
+ if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
172
+ if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
173
+ if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
174
+
175
+ $rvm_scripts_path/hook "after_do"
176
+
177
+ exit ${#errors[*]}
178
+ #}
179
+
@@ -35,17 +35,17 @@ while [[ $# -gt 0 ]] ; do
35
35
  esac
36
36
  done
37
37
 
38
- __rvm_load_rvmrc
39
-
40
- if [[ -z "$rvm_path" ]] ; then
41
- unset rvm_path
38
+ if [[ -z "$rvm_prefix" ]] ; then
39
+ __rvm_load_rvmrc
42
40
  if [[ "root" = "$(whoami)" ]] ; then
43
- rvm_path="/usr/local/rvm"
41
+ rvm_prefix="/usr/local/"
44
42
  else
45
- rvm_path="$HOME/.rvm"
43
+ rvm_prefix="$HOME/."
46
44
  fi
47
45
  fi
48
46
 
47
+ if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
48
+
49
49
  source scripts/initialize
50
50
  __rvm_initialize
51
51
 
@@ -69,7 +69,7 @@ rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
69
69
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
70
70
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
71
71
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
72
- rvm_symlink_path="${rvm_symlink_path:-/usr/local/bin}"
72
+ rvm_symlink_path="${rvm_symlink_path:-$rvm_prefix/bin}"
73
73
 
74
74
  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 $rvm_symlink_path $HOME/.gem/cache
75
75
 
@@ -92,6 +92,11 @@ if [[ ! -s "$rvm_config_path/user" ]] ; then
92
92
  echo '# Users settings file, overrides db file settings and persists across installs.' >> $rvm_config_path/user
93
93
  fi
94
94
 
95
+ scripts="monitor match log install color db fetch log set libraries"
96
+ for script_name in $(echo $scripts) ; do
97
+ chmod +x $rvm_scripts_path/$script_name
98
+ done
99
+
95
100
  #
96
101
  # Bin Scripts
97
102
  #
@@ -167,6 +172,7 @@ echo -e "\nThank you for using rvm. I hope that it makes your work easier and mo
167
172
  echo -e "If you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know."
168
173
  echo -e "My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST."
169
174
  echo -e "If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back."
175
+ echo -e "Be sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'."
170
176
  echo -e "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!"
171
177
  echo -e "\n ~ Wayne"
172
178
  echo -e "\n********************************************************************************"
@@ -176,13 +182,14 @@ if [[ "root" != "$(whoami)" ]] ; then
176
182
  echo -e "\n1) Place the folowing line at the end of your shell's loading files(.bashrc and then .bash_profile for bash and .zshrc for zsh), after all path/variable settings:"
177
183
  echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
178
184
  echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
179
- echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must split your .bashrc"
185
+ echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must remove it and split your .bashrc"
180
186
  echo -e "\n Put everything *except the return code line(s)* into your .bash_profile, and everything above that code in your .bashrc."
187
+ echo -e "\n Be *sure* to REMOVE the '&& return' statement line."
181
188
  echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
182
189
  echo -e "\n4) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
183
190
  fi
184
191
 
185
- if grep '&& return' ~/.bashrc ; then
192
+ if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then
186
193
  echo -e "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc. Please remove it and refactor your profiles to be correct. If you have questions about this please visit #rvm on irc.freenode.net.\n\n"
187
194
  fi
188
195
 
@@ -22,6 +22,8 @@ __rvm_db() {
22
22
  unset key value variable
23
23
  }
24
24
 
25
+ is_a_function() { type $1 | head -n 1 | grep -q "function" ; }
26
+
25
27
  # Ouput rvm environment information.
26
28
  __rvm_info() {
27
29
 
@@ -123,8 +125,8 @@ __rvm_strings() {
123
125
  results="$results $(__rvm_select ; echo $rvm_ruby_string)"
124
126
  unset rvm_ruby_string
125
127
  fi
126
- done
127
- echo $results
128
+ done
129
+ echo $results
128
130
  unset results
129
131
  return 0
130
132
  }
@@ -179,7 +181,7 @@ __rvm_run() {
179
181
  __rvm_cleanup_variables() {
180
182
  __rvm_unset_ruby_variables
181
183
 
182
- if [[ "$rvm_sticky_flag" = "1" ]] ; then export rvm_gem_set_name ; else unset rvm_gem_set_name ; fi
184
+ if [[ "$rvm_sticky_flag" = "1" ]] ; then export rvm_gemset_name ; else unset rvm_gemset_name ; fi
183
185
 
184
186
  unset rvm_action rvm_irbrc_file rvm_command rvm_error_message rvm_url rvm_force_flag rvm_all_flag rvm_reconfigure_flag rvm_make_flags rvm_bin_flag rvm_import_flag rvm_export_flag rvm_self_flag rvm_gem_flag rvm_rubygems_flag rvm_debug_flag rvm_delete_flag rvm_summary_flag rvm_test_flag _rvm_spec_flag rvm_json_flag rvm_yaml_flag rvm_shebang_flag rvm_env_flag rvm_tail_flag rvm_use_flag rvm_dir_flag rvm_list_flag rvm_empty_flag rvm_file_name rvm_benchmark_flag rvm_clear_flag rvm_name_flag rvm_verbose_flag rvm_user_flag rvm_system_flag rvm_ruby_configure_flags rvm_uninstall_flag rvm_install_flag rvm_llvm_flag rvm_ruby_bits rvm_ruby_patch rvm_sticky_flag
185
187
  }
@@ -204,6 +206,21 @@ __rvm_load_rvmrc() {
204
206
  if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
205
207
  }
206
208
 
209
+ # Wrap the specified ruby code file in a Benchmark.bmbm block and execute it.
210
+ __rvm_benchmark() {
211
+ code="require \"benchmark\" \n Benchmark.bmbm do |benchmark| \n benchmark.report(\"${rvm_ruby_file}\") do \n"
212
+ echo -e "$code" > "$rvm_tmp_path/$$.rb"
213
+ unset code
214
+ cat $rvm_ruby_file >> "$rvm_tmp_path/$$.rb"
215
+ echo -e "\n end \nend\n" >> "$rvm_tmp_path/$$.rb"
216
+ rvm_ruby_args="$rvm_tmp_path/$$.rb"
217
+ rvm_benchmark_flag=1
218
+ action="ruby"
219
+ if [[ ! -z "$rvm_debug_flag" ]] ; then echo -e "$rvm_tmp_path/$$.rb:\n$(cat $rvm_tmp_path/$$.rb)" ; fi
220
+ $rvm_scripts_path/set $rvm_action $rvm_ruby_args
221
+ }
222
+
223
+
207
224
  # Loop over the currently installed rubies and refresh their binscripts.
208
225
  __rvm_bin_scripts() {
209
226
  for rvm_ruby_binary in $rvm_rubies_path/*/bin/ruby ; do
@@ -244,7 +261,7 @@ __rvm_load_defaults() {
244
261
  if [[ ! -s "$rvm_config_path/system" ]] ; then
245
262
  for variable in RUBY_VERSION GEM_HOME GEM_PATH BUNDLE_PATH MY_RUBY_HOME ; do
246
263
  eval value=\$${variable}
247
- if [[ -z "$value" ]] ; then
264
+ if [[ -z "${value/ /}" ]] ; then
248
265
  echo "unset ${variable}" >> $rvm_config_path/system
249
266
  else
250
267
  eval "export $variable"
@@ -315,7 +332,7 @@ __rvm_implode() {
315
332
  if [[ -d "$rvm_path" ]] ; then
316
333
  $rvm_scripts_path/log "info" "Hai! Removing $rvm_path"
317
334
  rm -rf $rvm_path/
318
- $rvm_scripts_path/log "info" "$rvm_path has been removed."
335
+ echo "$rvm_path has been removed."
319
336
  else
320
337
  $rvm_scripts_path/log "info" "It appears that $rvm_path is already non existant."
321
338
  fi
@@ -349,15 +366,16 @@ __rvm_list_strings() {
349
366
  # This is not meant to be used with scripting. This is for interactive mode usage only.
350
367
  __rvm_list() {
351
368
  action="$(echo $rvm_ruby_args | awk '{print $1}')"
369
+
352
370
  if [[ "known" = "$action" ]] ; then
353
371
  __rvm_list_known
354
372
  elif [[ "default" = "$action" ]] ; then
355
373
  __rvm_list_default
356
- elif [[ "rubies" = "$action" ]] ; then
374
+ elif [[ -z "$action" ]] || [[ "rubies" = "$action" ]] ; then
357
375
  __rvm_list_rubies
358
376
  elif [[ "strings" = "$action" ]] ; then
359
377
  __rvm_list_strings
360
- else
378
+ else # help
361
379
  echo -e "Usage: rvm list {known,default,rubies,strings}"
362
380
  fi
363
381
  }
@@ -389,7 +407,7 @@ __rvm_list_known() {
389
407
  echo -e "jruby-1.2.0\njruby-1.3.1\njruby(-1.4.0) # the default\njruby-head"
390
408
  echo -e "rbx(-prc1) # default\nrbx-head"
391
409
  echo -e "ree-1.8.6\nree(-1.8.7) # the default\nree-1.8.6-head\nree-1.8.7-head"
392
- echo -e "maglev(-22891)\nmaglev-head"
410
+ echo -e "maglev(-22907)\nmaglev-head"
393
411
  echo -e "mput(-head) # shyouhei head, the default mput"
394
412
  echo -e "ironruby-0.9.3 # (1.0 RC1)\nironruby-head"
395
413
  if [[ "Darwin" = "$(uname)" ]] ; then
@@ -515,184 +533,6 @@ __rvm_reboot() {
515
533
  fi ; unset response
516
534
  }
517
535
 
518
- # Perform an action using one of a selected ruby's specified binaries.
519
- __rvm_ruby_do() {
520
- __rvm_select
521
- __rvm_use
522
-
523
- binary="$(echo $rvm_action | sed 's#do$##')"
524
- if [[ -x "$rvm_ruby_home/bin/$binary" ]] ; then
525
- rm -f "$rvm_path/gems/cache"
526
- ln -nfs "$HOME/.gem/cache" "$rvm_path/gems/cache"
527
- binary="$rvm_ruby_home/bin/$binary"
528
- elif [[ -x "$rvm_ruby_global_gems_path/bin/$binary" ]] ; then
529
- binary="$rvm_ruby_global_gems_path/bin/$binary"
530
- elif [[ -x "$rvm_ruby_gem_home/bin/$binary" ]] ; then
531
- binary="$rvm_ruby_gem_home/bin/$binary"
532
- elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(which $binary)" ]] ; then
533
- binary="$(basename $(which $binary 2>/dev/null) 2>/dev/null)"
534
- else
535
- $rvm_scripts_path/log "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
536
- __rvm_unset_ruby_variables
537
- return 1
538
- fi
539
-
540
- if [[ ! -z "$rvm_ruby_mode" ]] ; then
541
- rvm_ruby_string="$rvm_ruby_string-$rvm_ruby_mode"
542
- rvm_ruby_mode="--$(echo $rvm_ruby_mode | sed 's/^m//')"
543
- fi
544
-
545
- load_path="$(dirname $(which $binary 2>/dev/null) 2>/dev/null):$rvm_ruby_load_path"
546
- # TODO: the else case below should be run if $rvm_ruby_args =~ /\.rb$/
547
- if [[ "ruby" = "$(basename $binary)" ]] && [[ "$rvm_benchmark_flag" -ne 1 ]] ; then
548
- if $rvm_scripts_path/match "$rvm_ruby_args" "\.rb$" ; then
549
- if [[ -z "$prefix" ]] ; then prefix="-S" ; fi
550
- if ! $rvm_scripts_path/match "$rvm_ruby_args" "$prefix" ; then
551
- rvm_ruby_args="$prefix $rvm_ruby_args"
552
- fi
553
- fi
554
- rvm_command="$binary $rvm_ruby_mode $rvm_ruby_require -I$load_path $rvm_ruby_args"
555
- elif [[ "gem" = "$(basename $binary)" ]] && $rvm_scripts_path/match "$rvm_ruby_args" '^install' ; then
556
- #$rvm_scripts_path/gem install $rvm_ruby_args
557
- rvm_command="$rvm_scripts_path/gems $rvm_ruby_mode $rvm_ruby_args $rvm_gem_options"
558
- else
559
- rvm_command="$binary $rvm_ruby_mode $rvm_ruby_args"
560
- fi
561
-
562
- if [[ ! -z "$rvm_json_flag" ]] || [[ ! -z "$rvm_yaml_flag" ]] || [[ ! -z "$rvm_summary_flag" ]] ; then
563
- mkdir -p ./log/$rvm_ruby_string/
564
- touch ./log/$rvm_ruby_string/$rvm_action.log ./log/$rvm_ruby_string/$rvm_action.error.log
565
- eval "$rvm_command" >> ./log/$rvm_ruby_string/$rvm_action.log 2>> ./log/$rvm_ruby_string/$rvm_action.error.log
566
- else
567
- $rvm_scripts_path/log "info" "$rvm_ruby_string: $($rvm_ruby_home/bin/ruby -v $rvm_ruby_mode | tr "\n" ' ')"
568
- eval "$rvm_command"
569
- fi
570
- result=$?
571
-
572
- if [[ $result -eq 0 ]]; then
573
- eval "successes=(${successes[*]} $rvm_ruby_string)"
574
- else
575
- eval "errors=(${errors[*]} $rvm_ruby_string)"
576
- fi
577
- eval "rubies=(${rubies[*]} $rvm_ruby_string)"
578
- eval "statuses=(${statuses[*]} $result)"
579
- __rvm_unset_ruby_variables
580
- }
581
-
582
- # Loop over a set or all rvm installed rubies to perform some action.
583
- # Record the results and report based on CLI selections.
584
- __rvm_do() {
585
- __rvm_state
586
-
587
- rubies=() ; successes=() ; errors=() ; statuses=()
588
- # TODO: Extract the common functionality out of the if below
589
- if [[ ! -z "$rvm_ruby_string" ]] ; then
590
- unset rvm_ruby_interpreter rvm_ruby_version
591
- __rvm_ruby_do
592
- elif [[ ! -z "$rvm_ruby_version" ]] ;then
593
- for rvm_ruby_string in $(echo $rvm_ruby_version | tr ',' ' ') ; do
594
- __rvm_ruby_do
595
- done
596
- elif [[ ! -z "$rvm_ruby_interpreter" ]] ; then
597
- unset rvm_ruby_string rvm_ruby_version
598
- __rvm_ruby_do
599
- else # all
600
- for full_binary in $rvm_rubies_path/*/bin/ruby ; do
601
- if [[ -x "$full_binary" ]] ; then
602
- rvm_ruby_string="$(dirname $full_binary | xargs dirname | xargs basename)"
603
- __rvm_ruby_do
604
- fi
605
- done ; unset full_binary
606
- fi
607
-
608
- if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
609
- if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
610
- if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
611
-
612
- __rvm_state
613
-
614
- $rvm_scripts_path/hook "after_do"
615
-
616
- return ${#errors[*]}
617
- }
618
-
619
- # Output the summary in a human readable format.
620
- __rvm_summary() {
621
- export successes errors statuses
622
- summary="\nSummary:\n\n"
623
- if [[ ${#successes[*]} -gt 0 ]] ; then
624
- summary="$summary \033[0;32m${#successes[*]} successful: $(echo "${successes[*]}" | sed 's# #, #g')\033[0m\n"
625
- fi
626
- if [[ ${#errors[*]} -gt 0 ]] ; then
627
- summary="$summary \033[0;31m${#errors[*]} errors: $(echo "${errors[*]}" | sed 's# #, #g')\033[0m\n"
628
- fi
629
- total=${#rubies[*]}
630
- if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
631
- echo -e "$summary" | tee -a log/summary.log
632
- return ${#errors[*]}
633
- }
634
-
635
- # Output the summary in a yaml format.
636
- __rvm_yaml() {
637
- export successes errors statuses
638
- yaml="totals:\n rubies: ${#rubies[*]}\n successes: ${#successes[*]}\n errors: ${#errors[*]}\nsuccesses:"
639
- for var in ${successes[*]} ; do yaml="$yaml\n - $var" ; done
640
- yaml="$yaml\nerrors:"
641
- for var in ${errors[*]} ; do yaml="$yaml\n - $var" ; done
642
- yaml="$yaml\nrubies:"
643
- total=${#rubies[*]}
644
- if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
645
- for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
646
- if [[ ! -z "$rvm_debug_flag" ]] ; then
647
- $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
648
- fi
649
- yaml="$yaml\n \"${rubies[$index]}\": ${statuses[$index]}"
650
- done ; unset index array_start
651
- mkdir -p log
652
- echo -e "$yaml" | tee -a log/summary.yaml
653
-
654
- return ${#errors[*]}
655
- }
656
-
657
- # Output the summary in a json format.
658
- __rvm_json() {
659
- json="{"
660
- json="$json\n \"totals\": { \"rubies\": ${#rubies[*]}, \"successes\": ${#successes[*]}, \"errors\": ${#errors[*]}},"
661
- json="$json\n \"successful\": [ "$(echo ${successes[*]} | sed 's# #", "#g')" ],"
662
- json="$json\n \"errors\": [ "$(echo ${errors[*]} | sed 's# #", "#g')" ],"
663
- json="$json\n \"rubies\": {"
664
-
665
- total=${#rubies[*]}
666
- if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
667
- for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
668
- if [[ ! -z "$rvm_debug_flag" ]] ; then
669
- $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
670
- fi
671
- json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}"
672
- if (( $index + 1 < $total + $array_start )) ; then json="$json, " ; fi
673
- done ; unset index array_start
674
- json="$json\n }\n}"
675
-
676
- mkdir -p log
677
- echo -e "$json" | tee -a log/summary.json
678
-
679
- return ${#errors[*]}
680
- }
681
-
682
- # Wrap the specified ruby code file in a Benchmark.bmbm block and execute it.
683
- __rvm_benchmark() {
684
- code="require \"benchmark\" \n Benchmark.bmbm do |benchmark| \n benchmark.report(\"${rvm_ruby_file}\") do \n"
685
- echo -e "$code" > "$rvm_tmp_path/$$.rb"
686
- unset code
687
- cat $rvm_ruby_file >> "$rvm_tmp_path/$$.rb"
688
- echo -e "\n end \nend\n" >> "$rvm_tmp_path/$$.rb"
689
- rvm_ruby_args="$rvm_tmp_path/$$.rb"
690
- rvm_benchmark_flag=1
691
- rvm_action="ruby"
692
- if [[ ! -z "$rvm_debug_flag" ]] ; then echo -e "$rvm_tmp_path/$$.rb:\n$(cat $rvm_tmp_path/$$.rb)" ; fi
693
- __rvm_do
694
- }
695
-
696
536
  # Create the irbrc for the currently selected ruby installation.
697
537
  __rvm_irbrc() {
698
538
  if [[ -d "$rvm_ruby_home" ]] && [[ ! -s "$rvm_ruby_irbrc" ]] ; then
@@ -777,27 +617,27 @@ __rvm_make_flags() {
777
617
  fi
778
618
  }
779
619
 
780
- # Select a gems(et) based on CLI set options and environment.
620
+ # Select a gemset based on CLI set options and environment.
781
621
  # This only sets 'rvm_ruby_gem_home'
782
- __rvm_gems_select() {
622
+ __rvm_gemset_select() {
783
623
  if ! which gem > /dev/null 2>&1 ; then return 0 ; fi
784
624
 
785
625
  rvm_ruby_global_gems_path="$rvm_gems_path/$rvm_ruby_string%global"
786
626
 
787
- if [[ -z "$rvm_gem_set_name" ]] ; then
627
+ if [[ -z "$rvm_gemset_name" ]] ; then
788
628
  # No longer defaulting to 'sticky' gem sets.
789
629
  # Set 'rvm_sticky_flag=1' in ~/.rvmrc to enable.
790
630
  if [[ ! -z "$rvm_sticky_flag" ]] ; then
791
631
  if [[ ! -z "$GEM_HOME" ]] ; then
792
- rvm_gem_set_name=$(echo $GEM_HOME | xargs basename | awk -F'%' '{print $2}')
632
+ rvm_gemset_name=$(echo $GEM_HOME | xargs basename | awk -F'%' '{print $2}')
793
633
  fi
794
634
  if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
795
- rvm_gem_set_name=$(echo $rvm_ruby_gem_home | xargs basename | awk -F'%' '{print $2}')
635
+ rvm_gemset_name=$(echo $rvm_ruby_gem_home | xargs basename | awk -F'%' '{print $2}')
796
636
  fi
797
637
  fi
798
638
 
799
- if [[ ! -z "$rvm_gem_set_name" ]] && ! $rvm_scripts_path/match "$rvm_gem_set_name" "^[0-9]\.[0-9]" ; then
800
- rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string%$rvm_gem_set_name"
639
+ if [[ ! -z "$rvm_gemset_name" ]] && ! $rvm_scripts_path/match "$rvm_gemset_name" "^[0-9]\.[0-9]" ; then
640
+ rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string%$rvm_gemset_name"
801
641
  else
802
642
  if [[ ! -z "$rvm_ruby_string" ]] && [[ "$rvm_ruby_interpreter" != "system" ]] ; then
803
643
  rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
@@ -809,14 +649,14 @@ __rvm_gems_select() {
809
649
  unset rvm_ruby_gem_home
810
650
  fi
811
651
  fi
812
- if [[ -z "$rvm_gem_set_name" ]] ; then unset rvm_gem_set_name ; fi
652
+ if [[ -z "$rvm_gemset_name" ]] ; then unset rvm_gemset_name ; fi
813
653
  else
814
- rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string%$rvm_gem_set_name"
654
+ rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string%$rvm_gemset_name"
815
655
  fi
816
656
 
817
657
  # If the gemset does not exist, then notify the user as such and abort the action.
818
- if [[ ! -d "$rvm_ruby_gem_home" ]] && [[ ! -z "$rvm_gem_set_name" ]] && [[ -z "$rvm_create_flag" ]]; then
819
- $rvm_scripts_path/log "error" "Gemset '$rvm_gem_set_name' does not exist, rvm gems create '$rvm_gem_set_name' first."
658
+ if [[ ! -d "$rvm_ruby_gem_home" ]] && [[ ! -z "$rvm_gemset_name" ]] && [[ -z "$rvm_create_flag" ]]; then
659
+ $rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gems create '$rvm_gemset_name' first."
820
660
  return 1
821
661
  fi
822
662
 
@@ -832,11 +672,11 @@ __rvm_gems_select() {
832
672
  fi
833
673
 
834
674
  # Some sanity checking.
835
- if [[ ! -e "$HOME/.gem/cache" ]] ; then mkdir -p $HOME/.gem/cache ; fi
836
- chmod u+w "$HOME/.gem"
675
+ if [[ ! -e "$rvm_gems_cache_path" ]] ; then mkdir -p $rvm_gems_cache_path ; fi
676
+ chmod u+w "$rvm_gems_cache_path"
837
677
  rm -f "$rvm_gems_path/cache"
838
- ln -nfs "$HOME/.gem/cache" "$rvm_gems_path/cache"
839
- chmod u+w "$HOME/.gem/cache"
678
+ ln -nfs "$rvm_gems_cache_path" "$rvm_gems_path/cache"
679
+ chmod u+w "$rvm_gems_cache_path"
840
680
  # /TODO
841
681
 
842
682
  # Careful not to nuke system gems cache.
@@ -860,18 +700,18 @@ __rvm_gems_select() {
860
700
  fi ; export rvm_ruby_gem_path rvm_ruby_gem_home
861
701
  }
862
702
 
863
- # Use a gems(et) specified by 'rvm_ruby_gem_home'
864
- __rvm_gems_use() {
703
+ # Use a gemset specified by 'rvm_ruby_gem_home'
704
+ __rvm_gemset_use() {
865
705
  if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
866
706
 
867
707
  if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
868
708
  if [[ ! -d "$rvm_ruby_gem_home" ]] ; then
869
- $rvm_scripts_path/log "error" "Gemset '$rvm_gem_set_name' does not exist, rvm gems create '$rvm_gem_set_name' first."
709
+ $rvm_scripts_path/log "error" "Gemset '$rvm_gemset_name' does not exist, rvm gems create '$rvm_gemset_name' first."
870
710
  return 1
871
711
  fi
872
712
 
873
713
  if [[ "$rvm_interactive" = 1 ]] ; then
874
- $rvm_scripts_path/log "info" "gems(et) : ${rvm_gem_set_name:-default}"
714
+ $rvm_scripts_path/log "info" "gemset : ${rvm_gemset_name:-default}"
875
715
  fi
876
716
 
877
717
  export GEM_HOME="$rvm_ruby_gem_home"