rvm 0.1.27 → 0.1.29

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.
data/scripts/package CHANGED
@@ -4,8 +4,20 @@
4
4
  # ruby dependency packages:
5
5
  #
6
6
 
7
+ for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do
8
+ if [[ -f "$rvmrc" ]] ; then
9
+ if grep -q '^\s*rvm .*$' $rvmrc ; then
10
+ $rvm_scripts_path/log "error" "$rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
11
+ return 1
12
+ else
13
+ source "$rvmrc"
14
+ fi
15
+ fi
16
+ done
17
+
7
18
  source $rvm_scripts_path/initialize
8
19
  source $rvm_scripts_path/utility
20
+ __rvm_load_rvmrc
9
21
 
10
22
  trap "rm -f $rvm_tmp_path/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
11
23
  if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
@@ -37,7 +49,7 @@ install_package() {
37
49
 
38
50
  builtin cd "$rvm_src_path/$package-$version"
39
51
 
40
- __rvm_run "$package/configure" "${configure:-"./configure --prefix=$rvm_usr_path"} $configure_flags" "Configuring $package in $rvm_src_path/$package-$version."
52
+ __rvm_run "$package/configure" "${configure:-"./configure --prefix=${prefix_path:-"$rvm_usr_path"}"} $configure_flags" "Configuring $package in $rvm_src_path/$package-$version."
41
53
 
42
54
  unset configure_flags
43
55
 
@@ -79,20 +91,27 @@ openssl() {
79
91
  else
80
92
  export openssl_os="os/compiler darwin-i386-cc"
81
93
  fi
82
- package="openssl" ; version="0.9.8k" ; archive_format="tar.gz"
94
+ package="openssl" ; version="0.9.8n" ; archive_format="tar.gz"
83
95
  package_url="http://www.openssl.org/source"
84
96
  configure="./config --prefix=$rvm_usr_path zlib no-asm no-krb5 shared"
85
97
  install_package
86
98
  }
87
99
 
88
100
  zlib() {
89
- package="zlib" ; version="1.2.4" ; archive_format="tar.gz"
101
+ package="zlib" ; version="1.2.5" ; archive_format="tar.gz"
90
102
  package_url="http://www.zlib.net"
91
103
  install_package
92
104
  }
93
105
 
94
- ncurses() {
106
+ autoconf() {
107
+ package_url="ftp.gnu.org/gnu/autoconf"
108
+ package="autoconf" ; version="2.65" ; archive_format="tar.gz"
109
+
110
+ prefix_path="${rvm_symlink_path:-"${rvm_path:-"$HOME/.rvm"}/bin"}"
111
+ install_package
112
+ }
95
113
 
114
+ ncurses() {
96
115
  package_url="http://ftp.gnu.org/pub/gnu/ncurses"
97
116
  package="ncurses" ; version="5.7" ; archive_format="tar.gz"
98
117
  configure_flags="--with-shared --disable-rpath --without-debug --without-ada --enable-safe-sprintf --enable-sigwinch --without-progs"
@@ -111,6 +130,16 @@ gettext() {
111
130
  install_package
112
131
  }
113
132
 
133
+ libxml2() {
134
+ package_url="ftp://xmlsoft.org/libxml2/"
135
+ package="libxml2" ; version="2.7.3" ; archive_format="tar.gz"
136
+ if [[ "Darwin" = "$(uname)" ]] ; then
137
+ configure="./configure --prefix=${rvm_usr_path} --build=i686-apple-darwin$(uname -r) --host=i686-apple-darwin$(uname -r)"
138
+ fi
139
+ install_package
140
+ unset prefix_path
141
+ }
142
+
114
143
  glib() {
115
144
  package="glib" ; version="2.23.1" ; archive_format="tar.gz"
116
145
  package_url="http://ftp.gnome.org/pub/gnome/sources/glib/2.23"
@@ -146,7 +175,7 @@ llvm() {
146
175
  }
147
176
 
148
177
  if [[ ! -z "$library" ]] ; then
149
- if [[ " readline iconv curl openssl zlib ncurses pkgconfig gettext glib mono llvm " =~ "$library" ]] ; then
178
+ if [[ " readline iconv curl openssl zlib autoconf ncurses pkgconfig gettext glib mono llvm libxml2 " =~ "$library" ]] ; then
150
179
  ${library}
151
180
  else
152
181
  $rvm_scripts_path/log "error" "Package '${library}' is unknown."
data/scripts/rvm CHANGED
@@ -9,8 +9,16 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
9
9
 
10
10
  mkdir -p $HOME/.gem/cache
11
11
 
12
- if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
13
- if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
12
+ for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do
13
+ if [[ -f "$rvmrc" ]] ; then
14
+ if grep -q '^\s*rvm .*$' $rvmrc ; then
15
+ echo -e "Error: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
16
+ return 1
17
+ else
18
+ source "$rvmrc"
19
+ fi
20
+ fi
21
+ done
14
22
 
15
23
  if [[ -z "$rvm_prefix" ]] ; then
16
24
  if [[ "root" = "$(whoami)" ]] ; then
data/scripts/rvm-install CHANGED
@@ -29,7 +29,7 @@ spinner() {
29
29
  index=$((($spinner_counter % 8)))
30
30
  echo -e -n "\r${array[$index]}"
31
31
  let "spinner_counter=spinner_counter+1"
32
- which perl > /dev/null 2>&1 && perl -e 'sleep 0.5'
32
+ command -v perl > /dev/null 2>&1 && perl -e 'sleep 0.5'
33
33
  }
34
34
 
35
35
  if echo "$*" | grep -q 'trace' ; then echo "$*" ; env | grep '^rvm_' ; set -x ; fi
@@ -56,6 +56,7 @@ fi
56
56
  if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
57
57
 
58
58
  source scripts/initialize
59
+
59
60
  if grep -q 'scripts/rvm' $HOME/.bash* || grep -q 'scripts/rvm' $HOME/.zsh*; then
60
61
  if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then
61
62
  export upgrade_flag=1
@@ -102,7 +103,7 @@ fi
102
103
 
103
104
  spinner
104
105
 
105
- 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
106
+ 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
106
107
 
107
108
  for file in README LICENCE ; do
108
109
  spinner
@@ -112,7 +113,7 @@ done
112
113
  #
113
114
  # Scripts
114
115
  #
115
- for dir_name in config scripts examples lib hooks ; do
116
+ for dir_name in config scripts examples lib hooks help ; do
116
117
  spinner
117
118
  mkdir -p "$rvm_path/$dir_name"
118
119
  if [[ -d "$source_path/$dir_name" ]] ; then
@@ -265,17 +266,28 @@ if [[ "$upgrade_flag" -eq 1 ]] ; then
265
266
  else
266
267
  if [[ "root" != "$(whoami)" ]] ; then
267
268
  echo -e "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
268
- 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:"
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:"
269
270
  echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
270
271
  echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
271
- echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must remove it and split your .bashrc"
272
- echo -e "\n Put everything *except the return code line(s)* into your .bash_profile, and everything above that code in your .bashrc."
273
- echo -e "\n Be *sure* to REMOVE the '&& return' statement line."
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'."
274
278
  echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
275
- echo -e "\n4) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
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"
276
281
  fi
277
282
  if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then
278
- 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"
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 [[ ! -z "$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"
279
291
  fi
280
292
  echo -e "Installation of RVM to $rvm_path/ is complete.\n\n"
281
293
  fi
data/scripts/selector CHANGED
@@ -31,7 +31,7 @@ __rvm_select() {
31
31
  else
32
32
  __rvm_db "macruby_version" "rvm_ruby_version"
33
33
  __rvm_db "macruby_url" "rvm_url"
34
- rvm_ruby_package_name="MacRuby%200.5.zip"
34
+ rvm_ruby_package_name="MacRuby%20${rvm_ruby_version}.zip"
35
35
  rvm_ruby_package_file="$rvm_ruby_package_name"
36
36
  rvm_url="$rvm_url/$rvm_ruby_package_name"
37
37
  fi
@@ -68,12 +68,14 @@ __rvm_select() {
68
68
  rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
69
69
  rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "jruby_repo_url")}"
70
70
  else
71
- rvm_archive_extension="zip"
71
+ rvm_archive_extension="tar.gz"
72
72
  rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "jruby_version")"}"
73
+ jruby_url="$(__rvm_db "jruby_url")"
73
74
  rvm_ruby_package_file="${rvm_ruby_interpreter}-bin-${rvm_ruby_version}"
74
75
  rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
75
76
  rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
76
- rvm_url="http://jruby.org.s3.amazonaws.com/downloads/${rvm_ruby_version}/${rvm_ruby_package_file}.tar.gz"
77
+ rvm_url="${jruby_url}/${rvm_ruby_version}/${rvm_ruby_package_file}.tar.gz"
78
+ unset jruby_url
77
79
  fi
78
80
  alias jruby_ng="jruby --ng"
79
81
  alias jruby_ng_server="jruby --ng-server"
@@ -104,20 +106,20 @@ __rvm_select() {
104
106
  ironruby)
105
107
  unset rvm_ruby_patch_level
106
108
  if [[ "$rvm_head_flag" -eq 1 ]] ; then
107
- export rvm_ruby_version="head"
108
- export rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
109
- export rvm_ruby_package_name="${rvm_ruby_string}"
110
- export rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
111
- export rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
109
+ rvm_ruby_version="head"
110
+ rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
111
+ rvm_ruby_package_name="${rvm_ruby_string}"
112
+ rvm_ruby_repo_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
113
+ rvm_url="${rvm_ruby_repo_url:-$(__rvm_db "ironruby_repo_url")}"
112
114
  else
113
- export rvm_archive_extension="tar.gz"
114
- export rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ironruby_version")"}
115
- export rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
116
- sha1=$(curl -s http://github.com/api/v2/yaml/repos/show/ironruby/ironruby/tags | awk '/'${rvm_ruby_version}'/{print $NF}')
117
- export rvm_ruby_package_file="ironruby-ironruby-${sha1:0:7}.${rvm_archive_extension}"
118
- export rvm_ruby_package_name="ironruby-ironruby-${sha1:0:7}"
119
- export rvm_url="$(__rvm_db "ironruby_url")v${rvm_ruby_version}"
115
+ rvm_archive_extension="zip"
116
+ rvm_ruby_version=${rvm_ruby_version:-"$(__rvm_db "ironruby_version")"}
117
+ rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
118
+ rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
119
+ rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}.${rvm_archive_extension}"
120
+ rvm_url="$(__rvm_db "ironruby_${rvm_ruby_version}_url")${rvm_ruby_package_file}"
120
121
  fi
122
+ export rvm_ruby_version rvm_ruby_string rvm_ruby_package_name rvm_ruby_repo_url rvm_url rvm_archive_extension
121
123
  ;;
122
124
 
123
125
  ree)
@@ -164,8 +166,8 @@ __rvm_select() {
164
166
  ;;
165
167
 
166
168
  current)
167
- ruby_binary="$(which binary 2>/dev/null)"
168
- if $rvm_scripts_path/match "$ruby_binary" "rvm" ; then
169
+ ruby_binary="$(command -v ruby)"
170
+ if [[ $? -eq 0 ]] && $rvm_scripts_path/match "$ruby_binary" "rvm" ; then
169
171
  rvm_ruby_string="$(dirname "$ruby_binary" | xargs dirname | xargs basename)"
170
172
  else
171
173
  rvm_ruby_interpreter="system"
@@ -373,6 +375,12 @@ __rvm_ruby_string() {
373
375
 
374
376
  __rvm_unset_ruby_variables
375
377
 
378
+ # Alias'd rubies
379
+ if [[ -z "$alias_name" ]] ; then
380
+ value="$($rvm_scripts_path/db "$rvm_config_path/alias" "$ruby_string" 2>/dev/null)"
381
+ if [[ ! -z "$value" ]] ; then ruby_string="$value" ; fi
382
+ fi
383
+
376
384
  for string in $(echo $ruby_string | tr '-' ' ') ; do
377
385
  if [[ "head" = "$string" ]] ; then
378
386
  rvm_ruby_revision="head"
data/scripts/set CHANGED
@@ -22,15 +22,13 @@ __rvm_ruby_do() {
22
22
 
23
23
  binary="$(echo $action | sed 's#do$##')"
24
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
25
  binary="$rvm_ruby_home/bin/$binary"
28
26
  elif [[ -x "$rvm_ruby_global_gems_path/bin/$binary" ]] ; then
29
27
  binary="$rvm_ruby_global_gems_path/bin/$binary"
30
28
  elif [[ -x "$rvm_ruby_gem_home/bin/$binary" ]] ; then
31
29
  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)"
30
+ elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(command -v $binary)" ]] ; then
31
+ binary="$(basename $(command -v $binary) 2>/dev/null)"
34
32
  else
35
33
  $rvm_scripts_path/log "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
36
34
  __rvm_unset_ruby_variables
@@ -42,7 +40,7 @@ __rvm_ruby_do() {
42
40
  rvm_ruby_mode="--$(echo $rvm_ruby_mode | sed 's/^m//')"
43
41
  fi
44
42
 
45
- load_path="$(dirname $(which $binary 2>/dev/null) 2>/dev/null):$rvm_ruby_load_path"
43
+ load_path="$(dirname $(command -v $binary) 2>/dev/null):$rvm_ruby_load_path"
46
44
  # TODO: the else case below should be run if $args =~ /\.rb$/
47
45
  if [[ "ruby" = "$(basename $binary)" ]] && [[ "$rvm_benchmark_flag" -ne 1 ]] ; then
48
46
  if $rvm_scripts_path/match "$args" "\.rb$" ; then
@@ -64,7 +62,9 @@ __rvm_ruby_do() {
64
62
  touch ./log/$rvm_ruby_string/$action.log ./log/$rvm_ruby_string/$action.error.log
65
63
  eval "$rvm_command" >> ./log/$rvm_ruby_string/$action.log 2>> ./log/$rvm_ruby_string/$action.error.log
66
64
  else
67
- $rvm_scripts_path/log "info" "$rvm_ruby_string: $($rvm_ruby_home/bin/ruby -v $rvm_ruby_mode | tr "\n" ' ')"
65
+ if [[ "$rvm_verbose_flag" != "0" ]] ; then
66
+ $rvm_scripts_path/log "info" "$rvm_ruby_string: $($rvm_ruby_home/bin/ruby -v $rvm_ruby_mode | tr "\n" ' ')"
67
+ fi
68
68
  eval "$rvm_command"
69
69
  fi
70
70
  result=$?
@@ -146,7 +146,7 @@ __rvm_json() {
146
146
 
147
147
  # Loop over a set or all rvm installed rubies to perform some action.
148
148
  # Record the results and report based on CLI selections.
149
- #__rvm_do() {
149
+
150
150
  rubies=() ; successes=() ; errors=() ; statuses=()
151
151
  # TODO: Extract the common functionality out of the if below
152
152
  if [[ ! -z "$rvm_ruby_string" ]] ; then
@@ -175,5 +175,3 @@ if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
175
175
  $rvm_scripts_path/hook "after_do"
176
176
 
177
177
  exit ${#errors[*]}
178
- #}
179
-
data/scripts/update CHANGED
@@ -29,7 +29,7 @@ spinner() {
29
29
  index=$((($spinner_counter % 8)))
30
30
  echo -e -n "\r${array[$index]}"
31
31
  let "spinner_counter=spinner_counter+1"
32
- which perl > /dev/null 2>&1 && perl -e 'sleep 0.5'
32
+ command -v perl > /dev/null 2>&1 && perl -e 'sleep 0.5'
33
33
  }
34
34
 
35
35
  if echo "$*" | grep -q 'trace' ; then echo "$*" ; env | grep '^rvm_' ; set -x ; fi
@@ -56,6 +56,7 @@ fi
56
56
  if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
57
57
 
58
58
  source scripts/initialize
59
+
59
60
  if grep -q 'scripts/rvm' $HOME/.bash* || grep -q 'scripts/rvm' $HOME/.zsh*; then
60
61
  if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then
61
62
  export upgrade_flag=1
@@ -102,7 +103,7 @@ fi
102
103
 
103
104
  spinner
104
105
 
105
- 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
106
+ 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
106
107
 
107
108
  for file in README LICENCE ; do
108
109
  spinner
@@ -112,7 +113,7 @@ done
112
113
  #
113
114
  # Scripts
114
115
  #
115
- for dir_name in config scripts examples lib hooks ; do
116
+ for dir_name in config scripts examples lib hooks help ; do
116
117
  spinner
117
118
  mkdir -p "$rvm_path/$dir_name"
118
119
  if [[ -d "$source_path/$dir_name" ]] ; then
@@ -265,17 +266,28 @@ if [[ "$upgrade_flag" -eq 1 ]] ; then
265
266
  else
266
267
  if [[ "root" != "$(whoami)" ]] ; then
267
268
  echo -e "\n$(tput setaf 1)You must now finish the install manually:$(tput sgr0)"
268
- 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:"
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:"
269
270
  echo -e "\n if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
270
271
  echo -e "\n2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly)."
271
- echo -e "\n This means that if you see '[ -z "$PS1" ] && return' then you must remove it and split your .bashrc"
272
- echo -e "\n Put everything *except the return code line(s)* into your .bash_profile, and everything above that code in your .bashrc."
273
- echo -e "\n Be *sure* to REMOVE the '&& return' statement line."
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'."
274
278
  echo -e "\n If you wish to DRY up your config you can 'source ~/.bashrc' at the top of your .bash_profile."
275
- echo -e "\n4) Then $(tput setaf 1)CLOSE THIS SHELL$(tput sgr0) and open a new one in order to use rvm.\n"
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"
276
281
  fi
277
282
  if [[ -s $HOME/.bashrc ]] && grep '&& return' $HOME/.bashrc ; then
278
- 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"
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 [[ ! -z "$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"
279
291
  fi
280
292
  echo -e "Installation of RVM to $rvm_path/ is complete.\n\n"
281
293
  fi
data/scripts/utility CHANGED
@@ -26,64 +26,56 @@ is_a_function() { type $1 | head -n 1 | grep -q "function" ; }
26
26
 
27
27
  # Ouput rvm environment information.
28
28
  __rvm_info() {
29
-
30
29
  if [[ ! -z "$rvm_ruby_args" ]] ; then
31
- echo $(rvm_ruby_string="$rvm_ruby_args"; __rvm_select ; __rvm_use ; __rvm_environment_info)
32
- echo -e $info ; unset info
30
+ cat < <(rvm_ruby_string="$rvm_ruby_args"; __rvm_select ; __rvm_use ; __rvm_environment_info; echo -e "$environment_info")
33
31
  else
34
32
  __rvm_environment_info
33
+ echo -e "$environment_info"
35
34
  fi
36
-
37
35
  }
38
36
 
39
37
  __rvm_environment_info() {
40
- if [[ ! -z "$(/usr/bin/which ruby 2>/dev/null)" ]] ; then full_version=$(ruby -v) ; fi
41
- echo -e "system:\n uname: \"$(uname -a)\""
42
-
43
- if [[ ! -z "$ZSH_VERSION" ]] ; then echo -e " shell: \"zsh\"\n version: \"$ZSH_VERSION\"" ; fi
44
- if [[ ! -z "$BASH_VERSION" ]] ; then echo -e " shell: \"bash\"\n version: \"$BASH_VERSION\"" ; fi
45
-
46
- cat <<Ruby
47
-
48
- ruby:
49
- interpreter: "$(echo $full_version | awk '{print $1}')"
50
- version: "$(echo $full_version | awk '{print $2}')"
51
- date: "$(echo $full_version | sed 's/^.*(\([0-9]\{4\}\(-[0-9][0-9]\)\{2\}\).*$/\1/')"
52
- platform: "$(echo $full_version | sed 's/^.*\[//' | sed 's/\].*$//')"
53
- patchlevel: "$(echo $full_version | sed 's/^.*(//' | sed 's/).*$//')"
54
- full_version: "$full_version"
55
-
56
- Ruby
57
-
58
- cat <<Homes
59
- homes:
60
- gem: "${GEM_HOME:-'not set'}"
61
- ruby: "${MY_RUBY_HOME:-'not set'}"
62
- Homes
63
-
64
- cat <<Binaries
65
- binaries:
66
- ruby: "$(which ruby 2>/dev/null)"
67
- irb: "$(which irb 2>/dev/null)"
68
- gem: "$(which gem 2>/dev/null)"
69
- rake: "$(which rake 2>/dev/null)"
70
- Binaries
38
+ environment_info="" ; full_version=""
39
+ ruby=$(command -v ruby)
40
+ if [[ $? -eq 0 ]] && [[ -x "$ruby" ]] ; then full_version="$($ruby -v)" ; fi
71
41
 
72
- cat <<Environment
73
-
74
- environment:
75
- GEM_HOME: "$GEM_HOME"
76
- GEM_PATH: "$GEM_PATH"
77
- BUNDLE_PATH: "$BUNDLE_PATH"
78
- MY_RUBY_HOME: "$MY_RUBY_HOME"
79
- IRBRC: "$IRBRC"
80
- Environment
81
-
82
- gemset="$(echo $GEM_HOME | awk -F${rvm_gemset_separator:-'@'} '{print $2}')"
83
- echo -e " gemset: \"$gemset\"\n"
84
-
85
- if [[ ! -z "$MAGLEV_HOME" ]] ; then info="$info\n MAGLEV_HOME: \"$MAGLEV_HOME\"" ; fi
42
+ environment_info="$environment_info\nsystem:\n uname: \"$(uname -a)\""
86
43
 
44
+ if [[ ! -z "$ZSH_VERSION" ]] ; then
45
+ environment_info="$environment_info\n shell: \"zsh\"\n version: \"$ZSH_VERSION\""
46
+ fi
47
+ if [[ ! -z "$BASH_VERSION" ]] ; then
48
+ environment_info="$environment_info\n shell: \"bash\"\n version: \"$BASH_VERSION\""
49
+ fi
50
+ environment_info="$environment_info\n\nrvm:"
51
+ environment_info="$environment_info\n type: \"$(head -n 1 < <(type rvm))\""
52
+ environment_info="$environment_info\n version: \"$(__rvm_version | tr "\n" ' ' | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')\""
53
+ environment_info="$environment_info\n\nruby:"
54
+ environment_info="$environment_info\n interpreter: \"$(echo "${full_version}" | awk '{print $1}')\""
55
+ environment_info="$environment_info\n version: \"$(echo "${full_version}" | awk '{print $2}')\""
56
+ environment_info="$environment_info\n date: \"$(echo "${full_version}" | sed 's/^.*(\([0-9]\{4\}\(-[0-9][0-9]\)\{2\}\).*$/\1/')\""
57
+ environment_info="$environment_info\n platform: \"$(echo "${full_version}" | sed 's/^.*\[//' | sed 's/\].*$//')\""
58
+ environment_info="$environment_info\n patchlevel: \"$(echo "${full_version}" | sed 's/^.*(//' | sed 's/).*$//')\""
59
+ environment_info="$environment_info\n full_version: \"${full_version}\""
60
+ environment_info="$environment_info\n\nhomes:"
61
+ environment_info="$environment_info\n gem: \"${GEM_HOME:-'not set'}\""
62
+ environment_info="$environment_info\n ruby: \"${MY_RUBY_HOME:-'not set'}\""
63
+ environment_info="$environment_info\n\nbinaries:"
64
+ environment_info="$environment_info\n ruby: \"$(command -v ruby)\""
65
+ environment_info="$environment_info\n irb: \"$(command -v irb)\""
66
+ environment_info="$environment_info\n gem: \"$(command -v gem)\""
67
+ environment_info="$environment_info\n rake: \"$(command -v rake)\""
68
+ environment_info="$environment_info\n\nenvironment:"
69
+ environment_info="$environment_info\n GEM_HOME: \"$GEM_HOME\""
70
+ environment_info="$environment_info\n GEM_PATH: \"$GEM_PATH\""
71
+ environment_info="$environment_info\n BUNDLE_PATH: \"$BUNDLE_PATH\""
72
+ environment_info="$environment_info\n MY_RUBY_HOME: \"$MY_RUBY_HOME\""
73
+ environment_info="$environment_info\n IRBRC: \"$IRBRC\""
74
+ environment_info="$environment_info\n RUBYOPT: \"$RUBYOPT\""
75
+ environment_info="$environment_info\n gemset: \"$(echo $GEM_HOME | awk -F${rvm_gemset_separator:-'@'} '{print $2}')\"\n"
76
+ if [[ ! -z "$MAGLEV_HOME" ]] ; then
77
+ environment_info="$environment_info\n MAGLEV_HOME: \"$MAGLEV_HOME\""
78
+ fi
87
79
  unset full_version
88
80
  }
89
81
 
@@ -119,7 +111,7 @@ __rvm_debug() {
119
111
 
120
112
  for file_name in $(echo $debug_files); do
121
113
  if [[ -f "$file_name" ]] && [[ -s "$file_name" ]] ; then
122
- $rvm_scripts_path/log "debug" "$file_name (filtered):\n$(cat $file_name | awk '!/assword|_key/')\n"
114
+ $rvm_scripts_path/log "debug" "$file_name \(filtered\):\n$(cat $file_name | awk '!/assword|_key/')\n"
123
115
  fi
124
116
  done
125
117
 
@@ -134,7 +126,6 @@ __rvm_strings() {
134
126
  return 1
135
127
  else
136
128
  results="$results $(__rvm_select ; echo $rvm_ruby_string)"
137
- unset rvm_ruby_string
138
129
  fi
139
130
  done
140
131
  echo $results
@@ -199,7 +190,7 @@ __rvm_cleanup_variables() {
199
190
 
200
191
  # Unset ruby-specific variables
201
192
  __rvm_unset_ruby_variables() {
202
- unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_string rvm_ruby_string rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path
193
+ unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path rvm_ruby_name rvm_ruby_alias
203
194
  }
204
195
 
205
196
  __rvm_set_rvmrc() {
@@ -220,8 +211,16 @@ __rvm_set_rvmrc() {
220
211
 
221
212
  }
222
213
  __rvm_load_rvmrc() {
223
- if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
224
- if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
214
+ for rvmrc in /etc/rvmrc $HOME/.rvmrc ; do
215
+ if [[ -f "$rvmrc" ]] ; then
216
+ if grep -q '^\s*rvm .*$' $rvmrc ; then
217
+ $rvm_scripts_path/log "error" "$rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
218
+ return 1
219
+ else
220
+ source "$rvmrc"
221
+ fi
222
+ fi
223
+ done
225
224
  }
226
225
 
227
226
  # Wrap the specified ruby code file in a Benchmark.bmbm block and execute it.
@@ -291,14 +290,13 @@ __rvm_load_defaults() {
291
290
 
292
291
  __rvm_db "system_ruby" "rvm_system_ruby"
293
292
  if [[ ! -z "$rvm_system_ruby" ]] ; then
294
- rvm_system_ruby=$(which ruby 2>/dev/null)
293
+ rvm_system_ruby=$(command -v ruby)
295
294
  if [[ $? -ne 0 ]] ; then
296
295
  $rvm_scripts_path/log "info" "System ruby not found, no system default will be stored."
297
296
  else
298
297
  $rvm_scripts_path/db "$rvm_config_path/user" "system_ruby" "$rvm_system_ruby"
299
-
300
298
  # Now store system system & user gem paths
301
- if [[ ! -z "$(which gem 2>/dev/null)" ]] ; then
299
+ if [[ ! -z "$(command -v gem)" ]] ; then
302
300
  __rvm_db "system_user_gem_path" "rvm_system_user_gem_path"
303
301
  if [[ -z "$rvm_system_user_gem_path" ]] ; then
304
302
  rvm_system_user_gem_path=$( rvm system ; gem env gemdir user; )
@@ -425,7 +423,7 @@ __rvm_list_known() {
425
423
  echo -e "jruby-1.2.0\njruby-1.3.1\njruby(-1.4.0) # the default\njruby-head"
426
424
  echo -e "rbx(-prc1) # default\nrbx-head"
427
425
  echo -e "ree-1.8.6\nree(-1.8.7) # the default\nree-1.8.6-head\nree-1.8.7-head"
428
- echo -e "maglev(-23191)\nmaglev-head"
426
+ echo -e "maglev(-23400)\nmaglev-head"
429
427
  echo -e "mput(-head) # shyouhei head, the default mput"
430
428
  echo -e "ironruby-0.9.3\nironruby-1.0-rc2\nironruby-head"
431
429
  if [[ "Darwin" = "$(uname)" ]] ; then
@@ -435,7 +433,7 @@ __rvm_list_known() {
435
433
 
436
434
  __rvm_list_rubies() {
437
435
  echo
438
- ruby=$(which ruby 2>/dev/null) ; current_ruby=""
436
+ ruby=$(command -v ruby) ; current_ruby=""
439
437
  if [[ ! -z "$ruby" ]] && [[ ! -z "$(echo $ruby | awk '/rvm/')" ]] ; then
440
438
  current_ruby="$(echo $ruby | xargs dirname | xargs dirname | xargs basename 2> /dev/null)"
441
439
  fi
@@ -462,18 +460,18 @@ __rvm_list_rubies() {
462
460
  fi ; unset version
463
461
  fi
464
462
 
465
- system_ruby="$(rvm system ; which ruby 2>/dev/null)"
466
- if [[ ! -z "$system_ruby" ]] && [[ -x "$system_ruby" ]]; then
463
+ system_ruby="$(rvm system ; command -v ruby)"
464
+ if [[ ! -z "$system_ruby" ]] && [[ -x "$system_ruby" ]] ; then
467
465
  echo -e "\nSystem Ruby\n"
468
466
  system_version=$($system_ruby -v)
469
- string="[ $(file $system_ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
467
+ binary=$(ls -l "$system_ruby" | awk '{print $NF}') # Account for symbolic links.
468
+ string="[ $(file $binary | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
469
+
470
470
  if [[ ! -z "$system_ruby" ]] && [[ "$current_ruby" = "$system_version" ]] ; then echo -n "=> " ; else echo -n " " ; fi
471
471
  echo -e "$(tput setaf 2)system$(tput sgr0) $string"
472
- else
473
- $rvm_scripts_path/log "info" "No system ruby found."
474
472
  fi
475
473
 
476
- unset current_ruby version selected system_ruby system_version string
474
+ unset current_ruby version selected system_ruby system_version string binary
477
475
  echo
478
476
  }
479
477
 
@@ -532,7 +530,7 @@ __rvm_update_rvm() {
532
530
  }
533
531
 
534
532
  __rvm_reboot() {
535
- $rvm_scripts_path/log "warn" "Do you wish to reset rvm? ('yes', or 'no')"
533
+ $rvm_scripts_path/log "warn" "Do you wish to reboot rvm? ('yes', or 'no')"
536
534
  read response
537
535
  if [[ "yes" = "$response" ]] ; then
538
536
  builtin cd $rvm_path
@@ -571,10 +569,10 @@ __rvm_pushpop() {
571
569
  # Meant for use before and after an operation that might reset the currently selected ruby.
572
570
  __rvm_state() {
573
571
  if [[ -z "$rvm_state" ]] ; then
574
- if [[ -z "$(which ruby 2>/dev/null | awk /$(basename $rvm_rubies_path)/)" ]] ; then
572
+ if [[ -z "$(command -v ruby | awk /$(basename $rvm_rubies_path)/)" ]] ; then
575
573
  rvm_state=system
576
574
  else
577
- rvm_state="$(dirname "$(which ruby 2>/dev/null)" | xargs dirname | xargs basename)"
575
+ rvm_state="$(dirname "$(command -v ruby)" | xargs dirname | xargs basename)"
578
576
  fi
579
577
  else
580
578
  rvm_ruby_string="$rvm_state"
@@ -587,7 +585,7 @@ __rvm_state() {
587
585
  # Output an inspection of selected 'binary' scripts, based on CLI selection.
588
586
  __rvm_inspect() {
589
587
  for binary in $rvm_ruby_args ; do
590
- actual_file="$(which $binary 2>/dev/null)"
588
+ actual_file="$(command -v $binary)"
591
589
  $rvm_scripts_path/log "info" "$actual_file:"
592
590
  if [[ ! -z "$rvm_shebang_flag" ]] ; then cat $actual_file | head -n 1 ; fi
593
591
  if [[ ! -z "$rvm_env_flag" ]] ; then cat $actual_file | awk '/ENV/' ; fi
@@ -638,7 +636,7 @@ __rvm_make_flags() {
638
636
  # Select a gemset based on CLI set options and environment.
639
637
  # This only sets 'rvm_ruby_gem_home'
640
638
  __rvm_gemset_select() {
641
- which gem > /dev/null 2>&1
639
+ command -v gem > /dev/null
642
640
  if [[ $? -gt 0 ]] ; then return 0 ; fi # Stop if no 'gem' command is available.
643
641
 
644
642
  rvm_ruby_global_gems_path="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}global"
@@ -664,7 +662,7 @@ __rvm_gemset_select() {
664
662
  else
665
663
  if [[ ! -z "$rvm_ruby_string" ]] && [[ "$rvm_ruby_interpreter" != "system" ]] ; then
666
664
  rvm_ruby_gem_home="$rvm_gems_path/$rvm_ruby_string"
667
- elif [[ -z "$GEM_HOME" ]] && [[ ! -z "$(which gem 2>/dev/null)" ]] ; then
665
+ elif [[ -z "$GEM_HOME" ]] && [[ ! -z "$(command -v gem)" ]] ; then
668
666
  rvm_ruby_gem_home=$(gem env gemdir)
669
667
  elif [[ ! -z "$GEM_HOME" ]] ; then
670
668
  rvm_ruby_gem_home="$GEM_HOME"
@@ -674,8 +672,20 @@ __rvm_gemset_select() {
674
672
  fi
675
673
  if [[ -z "$rvm_gemset_name" ]] ; then unset rvm_gemset_name ; fi
676
674
  else
677
- if [[ -z "$rvm_ruby_gem_home" ]] || [[ ! -z "$(echo $rvm_ruby_gem_home | grep ${rvm_gemset_separator})" ]] ; then
678
- rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
675
+ gemset=$(echo "$rvm_ruby_gem_home" | awk -F'@' '{print $NF}')
676
+ if [[ -z "$rvm_ruby_string" ]] && [[ ! -z "${GEM_HOME/@*/}" ]] ; then
677
+ rvm_ruby_string=$(basename ${GEM_HOME/@*/})
678
+ fi
679
+
680
+ if [[ ! -z "$rvm_ruby_string" ]] ; then
681
+ if [[ -z "$rvm_ruby_gem_home" ]] || [[ ! -z "$gemset" ]] ; then
682
+ rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
683
+ elif [[ ! -z "$gemset" ]] && [[ "$rvm_gemset_name" != "$gemset" ]] ; then
684
+ rvm_ruby_gem_home="$rvm_gems_path/${rvm_ruby_string}${rvm_gemset_separator}${rvm_gemset_name}"
685
+ fi ; unset gemset
686
+ else
687
+ $rvm_scripts_path/log "error" "Gemsets can not be used with non rvm controlled rubies (currently)."
688
+ return 1
679
689
  fi
680
690
  fi
681
691
 
@@ -766,3 +776,15 @@ __rvm_mono_env() {
766
776
  export PKG_CONFIG_PATH="$rvm_usr_path/lib/pkgconfig:$PKG_CONFIG_PATH"
767
777
  PATH="$rvm_usr_path/bin:$PATH"
768
778
  }
779
+
780
+ __rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything() {
781
+ for index in {1..750} ; do perl -e 'sleep 0.2'; echo -n '.' ; done ; printf "%d" 0x2A ; echo
782
+ }
783
+
784
+ __rvm_ultimate_question() {
785
+ echo "I do not know the Ultimate Question, "
786
+ echo "however I can help you build a more "
787
+ echo "powerful Ruby which can compute the "
788
+ echo "Ultimate Question."
789
+ }
790
+