rvm 0.1.32 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
data/scripts/help ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+
3
+ source $rvm_scripts_path/initialize
4
+
5
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
6
+
7
+ 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
8
+
9
+ rvm_help_path="${rvm_help_path:-"$rvm_path/help"}"
10
+
11
+ command="$(echo $* | awk '{print $1}')"
12
+ action="$(echo $* | awk '{print $2}')"
13
+ # Reserved for future use:
14
+ args=$(echo "$*" | awk '{$1=""; $2="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
15
+
16
+ if [[ ! -z "$command" ]] && [[ -s "${rvm_help_path}/${command}" ]] ; then
17
+ if [[ ! -z "$action" ]] && [[ -s "${rvm_help_path}/${command}/${action}" ]] ; then
18
+ cat "${rvm_help_path}/${command}/${action}" | ${PAGER:-less}
19
+ else
20
+ cat "${rvm_help_path}/${command}" | ${PAGER:-less}
21
+ fi
22
+ else
23
+ cat "${rvm_path:-$HOME/.rvm}/README" | ${PAGER:-less}
24
+ $rvm_scripts_path/log "info" "\nCommands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ; \ls | tr "\n" ' ')"
25
+ fi
26
+
27
+ $rvm_scripts_path/log "info" "\nFor additional information please visit RVM's documentation website:\n\n http://rvm.beginrescueend.com/"
28
+ $rvm_scripts_path/log "info" "\nIf you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:\n\n http://webchat.freenode.net/?channels=rvm\n"
29
+
30
+ exit $?
data/scripts/info ADDED
@@ -0,0 +1,142 @@
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
+ source $rvm_scripts_path/version
7
+
8
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
9
+ rvm_ruby_gem_home="${rvm_ruby_gem_home:-$GEM_HOME}"
10
+
11
+ if [[ ! -d "$rvm_ruby_gem_home" ]] && command -v gem > /dev/null 2>&1; then rvm_ruby_gem_home="$(gem env home)" ; fi
12
+
13
+ info_system() {
14
+ rvm_info="$rvm_info\n system:\n uname: \"$(uname -a)\""
15
+
16
+ if [[ ! -z "$ZSH_VERSION" ]] ; then
17
+ rvm_info="$rvm_info\n shell: \"zsh\"\n version: \"$ZSH_VERSION\""
18
+ fi
19
+
20
+ if [[ ! -z "$BASH_VERSION" ]] ; then
21
+ rvm_info="$rvm_info\n shell: \"bash\"\n version: \"$BASH_VERSION\""
22
+ fi
23
+ rvm_info="$rvm_info\n"
24
+ }
25
+
26
+ info_rvm() {
27
+ rvm_info="$rvm_info\n rvm:"
28
+ rvm_info="$rvm_info\n type: \"$(head -n 1 < <(type rvm))\""
29
+ rvm_info="$rvm_info\n version: \"$(__rvm_version | tr "\n" ' ' | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')\""
30
+ rvm_info="$rvm_info\n"
31
+ }
32
+
33
+ info_ruby() {
34
+ ruby=$(command -v ruby)
35
+ if [[ $? -eq 0 ]] && [[ -x "$ruby" ]] ; then full_version="$($ruby -v)" ; fi
36
+ rvm_info="$rvm_info\n ruby:"
37
+ rvm_info="$rvm_info\n interpreter: \"$(printf "${full_version}" | awk '{print $1}')\""
38
+ rvm_info="$rvm_info\n version: \"$(printf "${full_version}" | awk '{print $2}')\""
39
+ rvm_info="$rvm_info\n date: \"$(printf "${full_version}" | sed 's/^.*(\([0-9]\{4\}\(-[0-9][0-9]\)\{2\}\).*$/\1/')\""
40
+ rvm_info="$rvm_info\n platform: \"$(printf "${full_version}" | sed 's/^.*\[//' | sed 's/\].*$//')\""
41
+ rvm_info="$rvm_info\n patchlevel: \"$(printf "${full_version}" | sed 's/^.*(//' | sed 's/).*$//')\""
42
+ rvm_info="$rvm_info\n full_version: \"${full_version}\""
43
+ rvm_info="$rvm_info\n"
44
+ }
45
+
46
+ info_homes() {
47
+ rvm_info="$rvm_info\n homes:"
48
+ rvm_info="$rvm_info\n gem: \"${GEM_HOME:-'not set'}\""
49
+ rvm_info="$rvm_info\n ruby: \"${MY_RUBY_HOME:-'not set'}\""
50
+ rvm_info="$rvm_info\n"
51
+ }
52
+
53
+ info_binaries() {
54
+ rvm_info="$rvm_info\n binaries:"
55
+ rvm_info="$rvm_info\n ruby: \"$(command -v ruby)\""
56
+ rvm_info="$rvm_info\n irb: \"$(command -v irb)\""
57
+ rvm_info="$rvm_info\n gem: \"$(command -v gem)\""
58
+ rvm_info="$rvm_info\n rake: \"$(command -v rake)\""
59
+ rvm_info="$rvm_info\n"
60
+ }
61
+
62
+ info_environment() {
63
+ rvm_info="$rvm_info\n environment:"
64
+ rvm_info="$rvm_info\n GEM_HOME: \"$GEM_HOME\""
65
+ rvm_info="$rvm_info\n GEM_PATH: \"$GEM_PATH\""
66
+ rvm_info="$rvm_info\n BUNDLE_PATH: \"$BUNDLE_PATH\""
67
+ rvm_info="$rvm_info\n MY_RUBY_HOME: \"$MY_RUBY_HOME\""
68
+ rvm_info="$rvm_info\n IRBRC: \"$IRBRC\""
69
+ rvm_info="$rvm_info\n RUBYOPT: \"$RUBYOPT\""
70
+ rvm_info="$rvm_info\n gemset: \"$(printf $GEM_HOME | awk -F${rvm_gemset_separator:-'@'} '{print $2}')\"\n"
71
+ if [[ ! -z "$MAGLEV_HOME" ]] ; then
72
+ rvm_info="$rvm_info\n MAGLEV_HOME: \"$MAGLEV_HOME\""
73
+ fi
74
+ rvm_info="$rvm_info\n"
75
+ }
76
+
77
+ info_debug() {
78
+ rvm_info=$(__rvm_version)
79
+ rvm_info="$rvm_info\n$($rvm_scripts_path/info "$rvm_ruby_string" "" )"
80
+ rvm_info="$rvm_info\nPATH:\n$(printf $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}' )"
81
+ rvm_info="$rvm_info\nuname -a: $(uname -a)"
82
+ rvm_info="$rvm_info\npermissions: $(\ls -la $rvm_path{,/rubies})"
83
+
84
+ if [[ "Darwin" = "$(uname)" ]] ; then
85
+ rvm_info="$rvm_info\nuname -r: $(uname -r)"
86
+ rvm_info="$rvm_info\nuname -m: $(uname -m)"
87
+ rvm_info="$rvm_info\nsw_vers: $(sw_vers | tr "\n" ',')"
88
+ rvm_info="$rvm_info\nARCHFLAGS: $ARCHFLAGS"
89
+ rvm_info="$rvm_info\nLDFLAGS: $LDFLAGS"
90
+ rvm_info="$rvm_info\nCFLAGS: $CFLAGS"
91
+ rvm_info="$rvm_info\n/Developer/SDKs/*:$(/usr/bin/basename -a /Developer/SDKs/* | tr "\n" ',')"
92
+ fi
93
+
94
+ for file_name in $(echo $rc_files) ; do
95
+ if [[ -s "$file_name" ]] ; then
96
+ rvm_info="$rvm_info\n$( "$file_name:\n$(grep 'rvm' $file_name 2>/dev/null)" )"
97
+ fi
98
+ done
99
+
100
+ if [[ "root" = "$(whoami)" ]] ; then
101
+ debug_files="$rvm_config_path/alias $rvm_config_path/system $rvm_config_path/db /etc/rvmrc /etc/gemrc"
102
+ else
103
+ debug_files="$rvm_config_path/alias $rvm_config_path/system $rvm_config_path/db $HOME/.rvmrc $HOME/.gemrc"
104
+ fi
105
+
106
+ for file_name in $(echo $debug_files); do
107
+ if [[ -f "$file_name" ]] && [[ -s "$file_name" ]] ; then
108
+ rvm_info="$rvm_info\n$file_name \(filtered\):\n$(cat $file_name | awk '!/assword|_key/')\n"
109
+ fi
110
+ done
111
+
112
+ rvm_info="$rvm_info\ngem sources:\n$(gem sources | awk '/gems/')"
113
+ }
114
+
115
+ info_sections() {
116
+ for section in $(echo $sections | tr ',' ' ') ; do
117
+ unset rvm_info ; "info_${section}" ; printf "$rvm_info"
118
+ done
119
+ }
120
+
121
+ args="$*"
122
+ ruby_strings="$(echo "$args" | awk '{print $1}')"
123
+ sections=$(echo "$args" | awk '{$1="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
124
+ all_sections="system rvm ruby homes binaries environment"
125
+
126
+ if $rvm_scripts_path/match "$all_sections debug" "${ruby_strings/,*/}" ; then
127
+ sections="$ruby_strings"
128
+ ruby_strings=""
129
+ fi
130
+
131
+ if [[ -z "$sections" ]] ; then sections="$all_sections" ; fi
132
+
133
+ if [[ -z "$ruby_strings" ]] ; then
134
+ printf "${rvm_ruby_string}:\n"
135
+ info_sections
136
+ else
137
+ for ruby_string in $(printf $ruby_strings | tr ',' ' ') ; do
138
+ rvm_ruby_string="${ruby_string}" ; __rvm_select ; __rvm_use
139
+ printf "${rvm_ruby_string}:\n"
140
+ info_sections
141
+ done
142
+ fi
data/scripts/initialize CHANGED
@@ -17,14 +17,16 @@ rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
17
17
  rvm_docs_path="${rvm_docs_path:-"$rvm_path/docs"}"
18
18
  rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
19
19
  rvm_gems_path="${rvm_gems_path:-"$rvm_path/gems"}"
20
+ rvm_gemsets_path="${rvm_gemsets_path:-"$rvm_path/gemsets"}"
20
21
  rvm_gems_cache_path="${rvm_gems_cache_path:-"$rvm_gems_path/cache"}"
21
22
  rvm_rubies_path="${rvm_rubies_path:-"$rvm_path/rubies"}"
22
23
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
24
+ rvm_environments_path="${rvm_environments_path:-"$rvm_path/environments"}"
25
+ rvm_wrappers_path="${rvm_wrappers_path:-"$rvm_path/wrappers"}"
23
26
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
24
27
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
25
28
  rvm_usr_path="${rvm_usr_path:-"$rvm_path/usr"}"
26
- rvm_symlink_path="${rvm_symlink_path:-$rvm_prefix/bin}"
27
29
  rvm_gemset_separator="${rvm_gemset_separator:-"@"}"
28
30
 
29
- export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_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_symlink_path
31
+ export rvm_path rvm_rubies_path rvm_scripts_path rvm_archives_path rvm_src_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
30
32
 
data/scripts/install CHANGED
@@ -11,7 +11,7 @@ source scripts/version
11
11
  source scripts/utility
12
12
 
13
13
  usage() {
14
- echo -e "
14
+ printf "
15
15
  Usage:
16
16
  ${0} [options]
17
17
 
@@ -27,7 +27,7 @@ spinner_counter=0
27
27
  spinner() {
28
28
  array=('/' '-' '\\' '|' '/' '-' '\\' '|')
29
29
  index=$((($spinner_counter % 8)))
30
- echo -e -n "\r${array[$index]}"
30
+ printf "\r${array[$index]}"
31
31
  let "spinner_counter=spinner_counter+1"
32
32
  command -v perl > /dev/null 2>&1 && perl -e 'sleep 0.5'
33
33
  }
@@ -86,19 +86,17 @@ rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
86
86
  rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
87
87
  rvm_hooks_path="${rvm_hooks_path:-"$rvm_path/hooks"}"
88
88
  rvm_tmp_path="${rvm_tmp_path:-"$rvm_path/tmp"}"
89
- rvm_symlink_path="${rvm_symlink_path:-$rvm_prefix/bin}"
90
89
 
91
90
  export rvm_gemset_separator="@" # TODO: Remove this after a while.
92
91
 
93
- echo -e "\n$(tput setaf 2)RVM$(tput sgr0) - shell scripts which allow management of multiple ruby interpreters and environments."
94
- echo -e "\n $(tput setaf 2)RTFM: $(tput sgr0) http://rvm.beginrescueend.com/"
95
- echo -e "\n $(tput setaf 2)HELP: $(tput sgr0) http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)"
92
+ printf "\n$(tput setaf 2)RVM:$(tput sgr0) shell scripts which allow management of multiple ruby interpreters and environments."
93
+ printf "\n$(tput setaf 2)RTFM: $(tput sgr0) http://rvm.beginrescueend.com/"
94
+ printf "\n$(tput setaf 2)HELP: $(tput sgr0) http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)"
96
95
 
97
- echo -e "\n********************************************************************************"
98
96
  if [[ "$upgrade_flag" -eq 1 ]] ;then
99
- echo -e -n " Upgrading the RVM installation in $rvm_path/"
97
+ printf "\n\n Upgrading the RVM installation in $rvm_path/"
100
98
  else
101
- echo -e -n " Installing rvm to $rvm_path/"
99
+ printf "\n\n Installing rvm to $rvm_path/"
102
100
  fi
103
101
 
104
102
  spinner
@@ -150,19 +148,19 @@ chmod +x $rvm_bin_path/*
150
148
  #
151
149
  spinner
152
150
  if [[ ! -z "$rvm_auto_flag" ]] ; then
153
- echo -e "Checking rc files... ($rvm_rc_files)"
151
+ printf "Checking rc files... ($rvm_rc_files)"
154
152
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
155
153
  for rcfile in $(echo $rvm_rc_files) ; do
156
154
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
157
155
  if [[ -s "$HOME/.profile" ]] ; then
158
156
  if ! grep -q '.profile' "$rcfile" ; then
159
157
  echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
160
- echo -e "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
158
+ printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
161
159
  fi
162
160
  fi
163
161
  if ! grep -q "scripts\/rvm" "$rcfile" ; then
164
162
  echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
165
- echo -e "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile
163
+ printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile
166
164
  fi
167
165
  done
168
166
  fi
@@ -196,12 +194,12 @@ done
196
194
  # Migrate old gemset directories to new gemset pattern.
197
195
  #
198
196
  spinner
199
- echo -e -n "\r*" # Stop spinner.
197
+ printf "\r*" # Stop spinner.
200
198
 
201
199
  for gemset in $rvm_path/gems/*\%* ; do
202
200
  new_path=${gemset/\%/${rvm_gemset_separator}}
203
201
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
204
- echo -e " Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
202
+ printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
205
203
  mv $gemset $new_path
206
204
  fi
207
205
  done
@@ -209,22 +207,26 @@ done
209
207
  for gemset in $rvm_path/gems/*\+* ; do
210
208
  new_path=${gemset/\+/${rvm_gemset_separator}}
211
209
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
212
- echo -e " Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
210
+ printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
213
211
  mv $gemset $new_path
214
212
  fi
215
213
  done
216
214
  for gemset in $rvm_path/gems/*\@ ; do
217
215
  new_path=$(echo $gemset | sed -e 's#\@$##')
218
216
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
219
- echo -e " Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator."
217
+ printf "\n Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator."
220
218
  mv $gemset $new_path
221
219
  fi
222
220
  done
223
221
 
224
- # Upgrade any default file.
225
- if [[ -s $rvm_config_path/default ]] && grep -q '\%' $rvm_config_path/default ; then
226
- sed -e "s#\%#${rvm_gemset_separator}#g" $rvm_config_path/default > $rvm_config_path/default.new
227
- mv $rvm_config_path/default.new $rvm_config_path/default
222
+ # Move from legacy defaults to the new, alias based system.
223
+ if [[ -s "$rvm_config_path/default" ]]; then
224
+ original_version="$(basename "$(grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
225
+ if [[ -n "$original_version" ]]; then
226
+ $rvm_scripts_path/alias create default "$original_version" &> /dev/null
227
+ fi
228
+ unset original_version
229
+ rm -rf "$rvm_config_path/default"
228
230
  fi
229
231
 
230
232
  #
@@ -232,64 +234,60 @@ fi
232
234
  #
233
235
 
234
236
  if [[ "root" = "$(whoami)" ]] ; then
235
- echo -e "\n Symlinking rvm to $rvm_symlink_path/rvm ..."
236
- mkdir -p $rvm_symlink_path
237
- ln -nfs $rvm_bin_path/rvm $rvm_symlink_path/rvm
238
- ln -nfs $rvm_bin_path/rvmsudo $rvm_symlink_path/rvmsudo
239
- chmod +x $rvm_symlink_path/rvm
240
- chmod +x $rvm_symlink_path/rvmsudo
237
+ printf "\n Symlinking rvm to $rvm_bin_path/rvm ..."
238
+ mkdir -p $rvm_bin_path
239
+ chmod +x $rvm_bin_path/rvm
240
+ chmod +x $rvm_bin_path/rvmsudo
241
241
  fi
242
242
 
243
243
  if [[ "$upgrade_flag" -eq 0 ]] ; then
244
- echo -e "\n********************************************************************************"
245
244
  ./scripts/notes
246
245
  fi
247
246
 
248
- echo -e "\n********************************************************************************"
249
247
  name="$(awk -F= '/^[[:space:]]*name/{print $2}' ~/.gitconfig 2>/dev/null)"
250
- echo -e "\n${name:-"$(whoami)"},\n"
251
- echo -e "\nThank you for using rvm. I hope that it makes your work easier and more enjoyable."
252
- 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."
253
- echo -e "My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST."
254
- 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."
255
- echo -e "Be sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'."
256
- echo -e "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!"
257
- echo -e "\n ~ Wayne"
258
- echo -e "\n********************************************************************************"
248
+ printf "\n\n${name:-"$(whoami)"},\n"
249
+ printf "\nThank you for using rvm. I hope that it makes your work easier and more enjoyable."
250
+ printf "\nIf you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know."
251
+ printf "\nMy irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST."
252
+ printf "\nIf I do not respond right away, please hang around after asking your question, I will respond as soon as I am back."
253
+ printf "\nBe sure to get head often as rvm development happens fast, you can do this by typing 'rvm update --head'."
254
+ printf "\n w$(tput setaf 2)⦿‿⦿$(tput sgr0)t!"
255
+ printf "\n ~ Wayne\n"
259
256
 
260
257
  if [[ "$upgrade_flag" -eq 1 ]] ; then
261
- echo -e "\n$(tput setaf 6)**** NOTICE *************************************************************************************"
262
- echo -e "* Gemset separator has changed, it is now @ and will remain unless any rubies error using it. *"
263
- echo -e "* If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' *"
264
- echo -e "*************************************************************************************************$(tput sgr0)\n"
265
- echo -e "Upgrade of RVM in $rvm_path/ is complete.\n"
258
+ printf "\n$(tput setaf 6)Upgrade Notes\n"
259
+ printf "\n * Gemset separator is '@' and will remain unless any rubies error using it."
260
+ printf "\n * If you encounter any issues with a ruby your best bet is to 'rvm remove X ; rvm install X' "
261
+ printf "\n * Do not forget that 'rvm notes' tells you OS dependency packages for installing rubies."
262
+ printf "\n$(tput sgr0)\n"
263
+ printf "\nUpgrade of RVM in $rvm_path/ is complete.\n\n"
266
264
  else
267
265
  if [[ "root" != "$(whoami)" ]] ; then
268
- echo -e "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
269
- echo -e "\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:"
270
- echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
271
- echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
272
- echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:"
273
- echo -e "\n if [[ ! -z "$PS1" ]] ; then"
274
- echo -e "\n ... original content that was below the && return line ..."
275
- echo -e "\n fi # <= be sure to close the if."
276
- echo -e "\n #EOF .bashrc"
277
- echo -e "\n Be absolutely *sure* to REMOVE the '&& return'."
278
- echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
279
- echo -e "\n placing all non-interactive items in the .bashrc"
280
- echo -e "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
266
+ printf "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
267
+ 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:"
268
+ printf "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
269
+ printf "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
270
+ printf "\n This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:"
271
+ printf "\n if [[ ! -z "$PS1" ]] ; then"
272
+ printf "\n ... original content that was below the && return line ..."
273
+ printf "\n fi # <= be sure to close the if."
274
+ printf "\n #EOF .bashrc"
275
+ printf "\n Be absolutely *sure* to REMOVE the '&& return'."
276
+ printf "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
277
+ printf "\n placing all non-interactive items in the .bashrc"
278
+ printf "\n3) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
281
279
  fi
282
280
  if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then
283
- echo -e "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
284
- This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to:
285
- if [[ -n "\$PS1" ]] ; then
286
- ... original content that was below the && return line ...
287
- fi # <= be sure to close the if.
288
- #EOF .bashrc
289
-
290
- If you have any questions about this please visit #rvm on irc.freenode.net.\n"
281
+ printf "\n\nWARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc."
282
+ printf "\n This means that if you see '[ -z "\$PS1" ] && return' then you must change this line to:"
283
+ printf "\n if [[ -n "\$PS1" ]] ; then"
284
+ printf "\n ... original content that was below the && return line ..."
285
+ printf "\n fi # <= be sure to close the if."
286
+ printf "\n #EOF .bashrc"
287
+ printf "\nEven if you use zsh you should still adjust the .bashrc as above."
288
+ printf "\nIf you have any questions about this please visit #rvm on irc.freenode.net.\n"
291
289
  fi
292
- echo -e "Installation of RVM to $rvm_path/ is complete.\n\n"
290
+ printf "\nInstallation of RVM to $rvm_path/ is complete.\n\n"
293
291
  fi
294
292
 
295
293
  exit 0
data/scripts/list ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
4
+
5
+ # Query for valid rvm ruby strings
6
+ # This is meant to be used with scripting.
7
+ __rvm_list_strings() {
8
+ echo $(\ls $rvm_rubies_path)
9
+ }
10
+
11
+ __rvm_list_default() {
12
+ strings="$(echo $rvm_ruby_args | awk '{print $2}')"
13
+ if [[ "$strings" = "string" ]] ; then
14
+ $rvm_scripts_path/alias show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename
15
+ else
16
+ if [[ -L "$rvm_rubies_path/default" ]]; then
17
+ version=$($rvm_scripts_path/alias show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename)
18
+ if [[ ! -z "$version" ]] ; then
19
+ printf "\n\nDefault Ruby (for new shells)\n"
20
+ string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
21
+ printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
22
+ fi ; unset version
23
+ fi
24
+ fi
25
+ }
26
+
27
+ __rvm_list_known() {
28
+ while read -r tag
29
+ do
30
+ prefix="$(echo ${tag/\//} | sed 's#^v1_##' | awk -F'_' '{print "(ruby-)1."$1"."$2}' | sed 's#p$##')"
31
+ echo "${prefix}-t${tag/\//}"
32
+ unset prefix tag
33
+ done < <(svn list http://svn.ruby-lang.org/repos/ruby/tags/ | awk '/^v1_[8|9]/')
34
+ printf "\n(ruby-)1.8.6(-p399)\n(ruby-)1.8.6-head\n(ruby-)1.8.7(-p249)\n(ruby-)1.8.7-head\n(ruby-)1.9.1(-p243)\n(ruby-)1.9.1(-p376)\n(ruby-)1.9.1-head\n(ruby-)1.9.2-preview1\n(ruby-)1.9.2-head\nruby-head\n"
35
+ printf "\njruby-1.2.0\njruby-1.3.1\njruby-1.4.0\njruby(-1.5.0) # the default\njruby-head"
36
+ printf "\nrbx(-1.0.0) # default\nrbx-head"
37
+ printf "\nree-1.8.6\nree(-1.8.7) # the default\nree-1.8.6-head\nree-1.8.7-head"
38
+ printf "\nmaglev(-23530)\nmaglev-head"
39
+ printf "\nmput(-head) # shyouhei head, the default mput"
40
+ printf "\nironruby-0.9.3\nironruby-1.0-rc2\nironruby-head"
41
+ if [[ "Darwin" = "$(uname)" ]] ; then
42
+ printf "\nmacruby(-nightly) # the default macruby\nmacruby-head # Build from the macruby git repository"
43
+ fi
44
+ }
45
+
46
+ __rvm_list_rubies() {
47
+ echo
48
+ ruby=$(command -v ruby) ; current_ruby=""
49
+ if [[ ! -z "$ruby" ]] && [[ ! -z "$(echo $ruby | awk '/rvm/')" ]] ; then
50
+ current_ruby="$(echo $ruby | xargs dirname | xargs dirname | xargs basename 2> /dev/null)"
51
+ fi
52
+
53
+ printf "rvm rubies\n"
54
+ for version in $(\ls $rvm_rubies_path/ 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
55
+ if [[ ! -z "$(echo $version | awk '/^jruby-/')" ]] ; then
56
+ string="[ $($rvm_rubies_path/$version/bin/ruby -v | awk '{print $NF}') ]"
57
+ elif [[ ! -z "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then
58
+ string="[ x86_64 ]"
59
+ else
60
+ string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
61
+ fi
62
+ printf "\n"
63
+ if [[ "$version" = "$current_ruby" ]]; then
64
+ printf "=> "
65
+ else
66
+ printf " "
67
+ fi
68
+ printf "$(tput setaf 2)$version$(tput sgr0) $string"
69
+ done ; unset version
70
+
71
+ if [[ -f "$rvm_config_path/default" ]] && [[ -s $rvm_config_path/default ]] ; then
72
+ version=$(grep 'MY_RUBY_HOME' $rvm_config_path/default | head -n 1 | awk -F"'" '{print $2}' | xargs basename)
73
+ if [[ ! -z "$version" ]] ; then
74
+ printf "\n\nDefault Ruby (for new shells)\n"
75
+ string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
76
+ printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
77
+ fi ; unset version
78
+ fi
79
+ printf "\n"
80
+
81
+ unset current_ruby version selected system_ruby system_version string binary
82
+ echo
83
+ }
84
+
85
+ # List all rvm installed rubies, default ruby and system ruby.
86
+ # Display the rubies, indicate their architecture and indicate which is currently used.
87
+ # This is not meant to be used with scripting. This is for interactive mode usage only.
88
+ action="$(echo "$1" | awk '{print $1}')"
89
+
90
+ if [[ "known" = "$action" ]] ; then
91
+ __rvm_list_known
92
+ elif [[ "default" = "$action" ]] ; then
93
+ __rvm_list_default
94
+ elif [[ -z "$action" ]] || [[ "rubies" = "$action" ]] ; then
95
+ __rvm_list_rubies
96
+ elif [[ "strings" = "$action" ]] ; then
97
+ __rvm_list_strings
98
+ else # help
99
+ printf "\nUsage: rvm list {known,default,rubies,strings}"
100
+ fi
101
+
102
+ exit $?