rvm 0.0.96 → 0.0.97

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ add(){
10
10
  fi
11
11
  }
12
12
 
13
- if [[ ! -z "$(which ruby 2>/dev/null | awk '/rvm/{print}')" ]] ; then
13
+ if which ruby 2>/dev/null | grep -q 'rvm' ; then
14
14
  unset format
15
15
  while [[ $# -gt 0 ]] ; do
16
16
  token="$1" ; shift
@@ -31,18 +31,11 @@ if [[ ! -z "$(which ruby 2>/dev/null | awk '/rvm/{print}')" ]] ; then
31
31
  fi
32
32
 
33
33
  ruby_string=$(dirname "$(which ruby 2>/dev/null)" | xargs dirname | xargs basename)
34
- if [[ ! -z "$interpreter_flag" ]] ; then
35
- interpreter="$(echo $ruby_string | awk -F'-' '{print $1}')"
36
- fi
37
- if [[ ! -z "$version_flag" ]] ; then
38
- version="$(echo $ruby_string | awk -F'-' '{print $2}')"
39
- fi
40
- if [[ ! -z "$patchlevel_flag" ]] ; then
41
- patchlevel=$(echo $ruby_string | awk -F'-' '{print $3}')
42
- fi
43
- if [[ ! -z "$architecture_flag" ]] ; then
44
- architecture="$(echo "$(ruby -v)" | sed 's/^.*\[//' | sed 's/\].*$//')"
45
- fi
34
+
35
+ (( $interpreter_flag )) && interpreter="$(echo $ruby_string | awk -F'-' '{print $1}')"
36
+ (( $version_flag )) && version="$(echo $ruby_string | awk -F'-' '{print $2}')"
37
+ (( $patchlevel_flag )) && patchlevel=$(echo $ruby_string | awk -F'-' '{print $3}')
38
+ (( $architecture_flag )) && architecture="$(echo "$(ruby -v)" | sed 's/^.*\[//' | sed 's/\].*$//')"
46
39
 
47
40
  command="prompt=\"[$format]\""
48
41
  eval "$command"
data/install CHANGED
@@ -66,11 +66,15 @@ echo -e "\n Checking rc files ($rvm_rc_files) ..."
66
66
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
67
67
  for rcfile in $(echo $rvm_rc_files) ; do
68
68
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
69
-
70
- grep "scripts\/rvm" "$rcfile" > /dev/null 2>&1
71
- if [[ $? -gt 0 ]] ; then
69
+ if [[ -s "$HOME/.profile" ]] ; then
70
+ if ! grep -q '.profile' "$rcfile" ; then
71
+ echo " Adding 'if [[ -s $HOME/.profile ]] ; then source $HOME ; fi' to $rcfile."
72
+ echo -e "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
73
+ fi
74
+ fi
75
+ if ! grep -q "scripts\/rvm" "$rcfile" ; then
72
76
  echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
73
- echo -e "\n# rvm-install added line:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
77
+ echo -e "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
74
78
  fi
75
79
  done
76
80
  fi
data/lib/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 96
4
+ :patch: 97
data/rvm.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rvm}
8
- s.version = "0.0.96"
8
+ s.version = "0.0.97"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wayne E. Seguin"]
data/scripts/cli CHANGED
@@ -12,7 +12,7 @@ __rvm_version() { __rvm_meta ; echo "rvm ${rvm_meta_version} by ${rvm_meta_autho
12
12
  __rvm_usage() { cat "${rvm_path:-$HOME/.rvm}/README" | ${PAGER:-less} ; }
13
13
 
14
14
  __rvm_parse_args() {
15
- if [[ ! -z "$(echo "$*" | awk '/trace/')" ]] ; then echo "$*" ; fi
15
+ if echo "$*" | grep -q 'trace' ; then echo "$*" ; fi
16
16
 
17
17
  while [[ $# -gt 0 ]] ; do
18
18
  rvm_token="$1" ; shift
@@ -307,7 +307,7 @@ __rvm_parse_args() {
307
307
  elif $rvm_scripts_path/match "$rvm_token" "^[0-9].[0-9]" ; then
308
308
  rvm_ruby_string="$rvm_token"
309
309
  rvm_action="${rvm_action:-use}"
310
- elif $rvm_scripts_path/match "$rvm_token" "^ree" ; then
310
+ elif $rvm_scripts_path/match "$rvm_token" "^ree-" ; then
311
311
  rvm_ruby_string="$rvm_token"
312
312
  rvm_action="${rvm_action:-use}"
313
313
  else
@@ -389,7 +389,7 @@ rvm() {
389
389
  $rvm_scripts_path/monitor ; result=$?
390
390
  ;;
391
391
  notes) $rvm_scripts_path/notes ; result=$? ;;
392
- reload) rvm_reload_flag=1 ;;
392
+ reload) unset rvm_loaded_flag ; rvm_reload_flag=1 ;;
393
393
  fetch|install|uninstall|remove)
394
394
  if [[ ! -z "$rvm_ruby_string" ]] ; then
395
395
  $rvm_scripts_path/manage "$rvm_action" "$rvm_ruby_string"
data/scripts/fetch CHANGED
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- fetch_command=$(which curl 2>/dev/null)
4
- if [[ $? -ne 0 ]] ; then
3
+ if ! which curl &> /dev/null; then
5
4
  $rvm_scripts_path/log "fail" "rvm requires curl, which does not seem to exist in your path :("
6
5
  exit 1
7
6
  else
8
- fetch_command="$fetch_command -O -L --create-dirs -C - " # -s for silent
7
+ fetch_command="curl -O -L --create-dirs -C - " # -s for silent
9
8
  fi
10
9
 
11
10
  pushd "$rvm_archives_path" > /dev/null 2>&1
data/scripts/gems CHANGED
@@ -1,19 +1,16 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- #source $rvm_path/scripts/rvm
4
3
  source $rvm_path/scripts/utility
5
- #source $rvm_path/scripts/selector
6
4
 
7
5
  color_green=$($rvm_scripts_path/color "green")
8
6
  color_red=$($rvm_scripts_path/color "red")
9
7
  color_yellow=$($rvm_scripts_path/color "yellow")
10
8
  color_none=$($rvm_scripts_path/color "none")
11
9
 
12
- if [[ -z "$rvm_ruby_gem_home" ]] ; then rvm_ruby_gem_home="$(gem env home)" ; fi
13
- if [[ "$rvm_trace_flag" -eq 1 ]] ; then set -x ; export rvm_trace_flag ; fi
14
-
15
- trap "rm -f $rvm_path/tmp/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
10
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
11
+ if [[ -d "$rvm_ruby_gem_home" ]] && which gem &> /dev/null ; then rvm_ruby_gem_home="$(gem env home)" ; fi
16
12
 
13
+ trap "if [[ -d $rvm_path/tmp/ ]] && [[ -f $rvm_path/tmp/$$ ]] ; then rm -f $rvm_path/tmp/$$ > /dev/null 2>&1 ; fi ; exit" 0 1 2 3 15
17
14
 
18
15
  __rvm_gems_name() {
19
16
  echo "$rvm_gem_set_name"
@@ -117,46 +114,49 @@ __rvm_gems_load() {
117
114
 
118
115
  while read -r line
119
116
  do # Keep this on 2nd line :(
120
- #
121
- # Parse the line
122
- #
123
- gem="$(echo $line | awk -F';' '{print $1}')"
124
- gem_prefix="$(echo $line | awk -F';' '{print $2}')"
125
- if $rvm_scripts_path/match "$gem" "\.gem$" ; then
126
- gem_name="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{$NF=NULL;print}')"
127
- gem_version="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{print $NF}' )"
128
- gem_postfix="$(basename $gem | sed "s#.*\.gem##")"
129
- else
130
- gem_name="$(echo $gem | awk '{print $1}')"
131
- if $rvm_scripts_path/match "$gem" "--version" ; then
132
- gem_version="$(echo $gem | sed 's#.*--version[=]*[ ]*##' | awk '{print $1}')"
133
- gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##" | sed "s#--version[=]*[ ]*${gem_version/ /}##")"
134
- elif $rvm_scripts_path/match "$gem" "-v" ; then
135
- gem_version="$(echo $gem | sed 's#.*-v[=]*[ ]*##' | awk '{print $1}')"
136
- gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##" | sed "s#-v[=]*[ ]*${gem_version/ /}##")"
137
- else
138
- unset gem_version # no version
139
- fi
140
- fi
141
-
142
- if [[ -f "$gem" ]] ; then
143
- gem_file_name="$gem"
144
- elif $rvm_scripts_path/match "$gem" ".gem$" ; then
145
- gem_file_name="$gem"
146
- elif [[ -z "${gem_version/ /}" ]] ; then # no v/Users/wayne/projects/db0/rvm/scripts/gems
147
- gem_file_name="${gem_name/ /}*.gem"
148
- else # version
149
- gem_file_name="${gem_name/ /}-${gem_version/ /}.gem"
150
- fi
117
+ __rvm_parse_gem_line $line
151
118
  __rvm_gem_install
152
119
  done < <(awk '/^[\.\/a-zA-Z]/{print}' "$rvm_file_name")
153
120
  else
154
121
  $rvm_scripts_path/log "error" "$rvm_file_name does not exist to load from."
155
122
  fi
156
123
  }
124
+
125
+ __rvm_parse_gem_line() {
126
+ line="$*"
127
+ gem="$(echo $line | awk -F';' '{print $1}')"
128
+ gem_prefix="$(echo $line | awk -F';' '{print $2}')"
129
+ if $rvm_scripts_path/match "$gem" "\.gem$" ; then
130
+ gem_name="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{$NF=NULL;print}')"
131
+ gem_version="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{print $NF}' )"
132
+ gem_postfix="$(basename $gem | sed "s#.*\.gem##")"
133
+ else
134
+ gem_name="$(echo $gem | awk '{print $1}')"
135
+ if $rvm_scripts_path/match "$gem" "--version" ; then
136
+ gem_version="$(echo $gem | sed 's#.*--version[=]*[ ]*##' | awk '{print $1}')"
137
+ gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##" | sed "s#--version[=]*[ ]*${gem_version/ /}##")"
138
+ elif $rvm_scripts_path/match "$gem" "-v" ; then
139
+ gem_version="$(echo $gem | sed 's#.*-v[=]*[ ]*##' | awk '{print $1}')"
140
+ gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##" | sed "s#-v[=]*[ ]*${gem_version/ /}##")"
141
+ else
142
+ unset gem_version # no version
143
+ fi
144
+ fi
145
+
146
+ if [[ -f "$gem" ]] ; then
147
+ gem_file_name="$gem"
148
+ elif $rvm_scripts_path/match "$gem" ".gem$" ; then
149
+ gem_file_name="$gem"
150
+ elif [[ -z "${gem_version/ /}" ]] ; then # no v/Users/wayne/projects/db0/rvm/scripts/gems
151
+ gem_file_name="${gem_name/ /}*.gem"
152
+ else # version
153
+ gem_file_name="${gem_name/ /}-${gem_version/ /}.gem"
154
+ fi
155
+ }
157
156
  __rvm_gem_install() {
157
+ __rvm_parse_gem_line $*
158
158
 
159
- installed_gem="$(ls ${rvm_ruby_gem_home}/specifications/${gem_file_name}*spec 2>/dev/null | head -n 1)"
159
+ installed_gem="$(ls ${rvm_ruby_gem_home}/specifications/${gem_file_name}spec 2>/dev/null | head -n 1)"
160
160
  if [[ -z "$rvm_force_flag" ]] && [[ -f "$installed_gem" ]] ; then
161
161
  unset gem
162
162
  $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$yellow exists, skipping (--force to re-install)"
@@ -204,20 +204,20 @@ __rvm_gem_install() {
204
204
 
205
205
  $rvm_scripts_path/log "warn" "$gem_name $gem_version is not installed, installing..."
206
206
  if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
207
- command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home' $gem_prefix gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
207
+ command="GEM_HOME='$rvm_ruby_gem_home' GEM_PATH='$rvm_ruby_gem_home' $gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
208
208
  else
209
- command="$gem_prefix gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
209
+ command="$gem_prefix $rvm_ruby_home/bin/gem install --no-rdoc --no-ri -q $gem $gem_postfix $vars"
210
210
  fi
211
- if [[ -f "$gem" ]] ; then command="${command} -l" ; fi
212
- eval $command > /dev/null 2>&1
211
+
212
+ eval $command >> "$rvm_path/log/$rvm_ruby_string/gem.install.log" 2>> "$rvm_path/log/$rvm_ruby_string/gem.install.error.log"
213
213
  result=$?
214
214
  if [[ $result -eq 0 ]] ; then
215
- $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$color_none installed."
215
+ $rvm_scripts_path/log "info" "$color_green$gem_name $gem_version$color_none installed."
216
216
  else
217
- $rvm_scripts_path/log "error" "$color_red$gem_name $gem_version$color_none failed to install."
217
+ $rvm_scripts_path/log "error" "$color_red$gem_name $gem_version$color_none failed to install, output logged to $rvm_path/log/$rvm_ruby_string/gem.install.error.log"
218
218
  fi
219
- fi
220
- unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string
219
+ fi ; unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string
220
+ return $result
221
221
  }
222
222
 
223
223
  __rvm_gems_gemdir() {
@@ -260,8 +260,7 @@ elif [[ "list" = "$action" ]] ; then
260
260
  elif [[ "gemdir" = "$action" ]] ; then
261
261
  __rvm_gems_gemdir
262
262
  elif [[ "install" = "$action" ]] ; then
263
- gem_file_name="$1"
264
- __rvm_gem_install
263
+ __rvm_gem_install $*
265
264
  else
266
265
  $rvm_scripts_path/log "error" "gems must be passed an action as the first parameter {load,dump,delete,name,list,gemdir,install}"
267
266
  fi
data/scripts/install CHANGED
@@ -66,11 +66,15 @@ echo -e "\n Checking rc files ($rvm_rc_files) ..."
66
66
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
67
67
  for rcfile in $(echo $rvm_rc_files) ; do
68
68
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
69
-
70
- grep "scripts\/rvm" "$rcfile" > /dev/null 2>&1
71
- if [[ $? -gt 0 ]] ; then
69
+ if [[ -s "$HOME/.profile" ]] ; then
70
+ if ! grep -q '.profile' "$rcfile" ; then
71
+ echo " Adding 'if [[ -s $HOME/.profile ]] ; then source $HOME ; fi' to $rcfile."
72
+ echo -e "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
73
+ fi
74
+ fi
75
+ if ! grep -q "scripts\/rvm" "$rcfile" ; then
72
76
  echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
73
- echo -e "\n# rvm-install added line:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
77
+ echo -e "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
74
78
  fi
75
79
  done
76
80
  fi
data/scripts/libraries CHANGED
@@ -4,15 +4,14 @@
4
4
  # ruby supporting libraries:
5
5
  #
6
6
  __rvm_readline_install() {
7
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
7
+ (( $rvm_make_flags_flag )) && __rvm_make_flags
8
8
  __rvm_pushpop $rvm_src_path
9
9
  package="readline" ; version="5.2" ; archive_format="tar.gz"
10
10
  # TODO: Figure out how to list, grab and apply the patches
11
11
  #ftp://ftp.cwru.edu/pub/bash/readline-6.0.tar.gz
12
12
  for version in 5.2 6.0 ; do
13
13
  $rvm_scripts_path/log "info" "Retrieving $package-$version.$archive_format"
14
- $rvm_scripts_path/fetch "ftp://ftp.gnu.org/gnu/readline/$package-$version.$archive_format"
15
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
14
+ $rvm_scripts_path/fetch "ftp://ftp.gnu.org/gnu/readline/$package-$version.$archive_format" || (result=$? && return $result)
16
15
  __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
17
16
  builtin cd "$rvm_src_path/$package-$version"
18
17
  if [[ "Darwin" = "$(uname)" ]] ; then
@@ -31,18 +30,17 @@ __rvm_readline_install() {
31
30
  __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
32
31
  __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
33
32
  fi
34
-
35
33
  done
36
34
  __rvm_pushpop
37
35
  }
38
36
 
39
37
  __rvm_iconv_install() {
40
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
38
+ (( $rvm_make_flags_flag )) && __rvm_make_flags
39
+ __rvm_pushpop $rvm_src_path
41
40
  __rvm_pushpop $rvm_src_path
42
41
  package="libiconv" ; version=1.13.1 ; archive_format="tar.gz"
43
42
  $rvm_scripts_path/log "info" "Retrieving $package-$version.$archive_format"
44
- $rvm_scripts_path/fetch "http://ftp.gnu.org/pub/gnu/libiconv/$package-$version.$archive_format"
45
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
43
+ $rvm_scripts_path/fetch "http://ftp.gnu.org/pub/gnu/libiconv/$package-$version.$archive_format" || (result=$? && return $result)
46
44
  __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
47
45
  builtin cd "$rvm_src_path/$package-$version"
48
46
  __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr" "Configuring $package."
@@ -52,17 +50,15 @@ __rvm_iconv_install() {
52
50
  __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
53
51
  __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
54
52
  fi
55
-
56
53
  __rvm_pushpop
57
54
  }
58
55
 
59
56
  __rvm_curl_install() {
60
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
57
+ (( $rvm_make_flags_flag )) && __rvm_make_flags
61
58
  __rvm_pushpop $rvm_src_path
62
59
  package="curl" ; version=7.19.7 ; archive_format="tar.gz"
63
60
  $rvm_scripts_path/log "info" "Retrieving $package-$version.$archive_format"
64
- $rvm_scripts_path/fetch "http://curl.haxx.se/download/$package-$version.$archive_format"
65
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
61
+ $rvm_scripts_path/fetch "http://curl.haxx.se/download/$package-$version.$archive_format" || (result=$? && return $result)
66
62
  __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
67
63
  builtin cd "$rvm_src_path/$package-$version"
68
64
  __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr" "Configuring $package."
@@ -72,12 +68,11 @@ __rvm_curl_install() {
72
68
  __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
73
69
  __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
74
70
  fi
75
-
76
71
  __rvm_pushpop
77
72
  }
78
73
 
79
74
  __rvm_openssl_install() {
80
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
75
+ (( $rvm_make_flags_flag )) && __rvm_make_flags
81
76
  if $rvm_scripts_path/match "$rvm_archflags" "x86_64" ; then
82
77
  openssl_os="os/compiler darwin64-x86_64-cc"
83
78
  else
@@ -86,8 +81,7 @@ __rvm_openssl_install() {
86
81
  __rvm_pushpop $rvm_src_path
87
82
  package="openssl" ; version="0.9.8k" ; archive_format="tar.gz"
88
83
  $rvm_scripts_path/log "info" "Retrieving $package-$version.$archive_format"
89
- $rvm_scripts_path/fetch "http://www.openssl.org/source/$package-$version.tar.gz"
90
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
84
+ $rvm_scripts_path/fetch "http://www.openssl.org/source/$package-$version.tar.gz" || (result=$? && return $result)
91
85
  __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
92
86
  builtin cd "$rvm_src_path/$package-$version"
93
87
  __rvm_run "$package/config" "./config --prefix=$rvm_path/usr zlib no-asm no-krb5 shared" "Configuring $package."
@@ -97,17 +91,15 @@ __rvm_openssl_install() {
97
91
  __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
98
92
  __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
99
93
  fi
100
-
101
94
  __rvm_pushpop
102
95
  }
103
96
 
104
97
  __rvm_zlib_install() {
105
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
98
+ (( $rvm_make_flags_flag )) && __rvm_make_flags
106
99
  __rvm_pushpop $rvm_src_path
107
100
  package="zlib" ; version="1.2.3" ; archive_format="tar.gz"
108
101
  $rvm_scripts_path/log "info" "Retrieving $package-$version.$archive_format"
109
- $rvm_scripts_path/fetch "http://www.zlib.net/$package-$version.tar.gz"
110
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
102
+ $rvm_scripts_path/fetch "http://www.zlib.net/$package-$version.tar.gz" || (result=$? && return $result)
111
103
  __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
112
104
  builtin cd "$rvm_src_path/$package-$version"
113
105
  __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr" "Configuring $package."
@@ -117,17 +109,15 @@ __rvm_zlib_install() {
117
109
  __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
118
110
  __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
119
111
  fi
120
-
121
112
  __rvm_pushpop
122
113
  }
123
114
 
124
115
  __rvm_ncurses_install() {
125
- if [[ "rvm_make_flags_flag" -eq 1 ]] ; then __rvm_make_flags ; fi
116
+ (( $rvm_make_flags_flag )) && __rvm_make_flags
126
117
  __rvm_pushpop $rvm_src_path
127
118
  package="ncurses" ; version="5.7" ; archive_format="tar.gz"
128
119
  $rvm_scripts_path/log "info" "Retrieving $package"
129
- $rvm_scripts_path/fetch "ftp://invisible-island.net/ncurses/ncurses.tar.gz"
130
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
120
+ $rvm_scripts_path/fetch "ftp://invisible-island.net/ncurses/ncurses.tar.gz" || (result=$? && return $result)
131
121
  __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package.$archive_format -C $rvm_src_path" "Extracting $package.$archive_format"
132
122
  builtin cd "$rvm_src_path/$package-$version"
133
123
  __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr --with-shared --disable-rpath --without-debug --without-ada --enable-safe-sprintf --enable-sigwinch --without-progs" "Configuring $package."
@@ -141,6 +131,7 @@ __rvm_ncurses_install() {
141
131
  }
142
132
 
143
133
  __rvm_install_llvm() {
134
+ (( $rvm_make_flags_flag )) && __rvm_make_flags
144
135
  builtin cd "$rvm_src_path"
145
136
  if [[ ! -d "$rvm_src_path/llvm/.svn" ]] ; then
146
137
  rm -rf "$rvm_src_path/llvm"
@@ -151,4 +142,3 @@ __rvm_install_llvm() {
151
142
  sudo env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make install
152
143
  fi
153
144
  }
154
-
data/scripts/manage CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- if [[ "$rvm_trace_flag" -eq 1 ]] ; then set -x ; export rvm_trace_flag ; fi
3
+ if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi
4
4
 
5
5
  original_ruby_version=$rvm_ruby_version
6
6
  original_ruby_string=$rvm_ruby_string
@@ -10,26 +10,25 @@ source $rvm_scripts_path/rvm
10
10
  trap "rm -f $rvm_path/tmp/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15
11
11
 
12
12
  __rvm_install_source() {
13
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
13
+ (( $rvm_ruby_selected_flag )) || __rvm_select $*
14
14
  $rvm_scripts_path/log "info" "Installing Ruby from source to: $rvm_ruby_home"
15
15
  mkdir -p "$rvm_ruby_log_path"
16
16
  __rvm_pushpop "$rvm_src_path"
17
17
  if [[ ! -z "$rvm_force_flag" ]] ; then rm -rf "$rvm_ruby_home" "$rvm_ruby_src_path" ; fi
18
18
 
19
19
  result=0
20
- __rvm_fetch_ruby
21
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
20
+ __rvm_fetch_ruby || (result=$? && return $result)
22
21
 
23
- builtin cd $rvm_ruby_src_path
24
- if [[ $? -gt 0 ]] ; then result=$? ; $rvm_scripts_path/log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; __rvm_pushpop ; return $result ; fi
22
+ builtin cd $rvm_ruby_src_path || (result=$? ; $rvm_scripts_path/log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; __rvm_pushpop ; return $result)
25
23
 
26
24
  if [[ -d "${rvm_path}/usr/bin" ]] ; then export PATH="${rvm_path}/usr/bin:${PATH}" ; fi
27
25
 
28
26
  if [[ -z "$rvm_ruby_configure" ]] && [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
29
- rvm_autoconf="$(which autoconf 2>/dev/null)"
30
- if [[ $? -gt 0 ]] ; then $rvm_scripts_path/log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi
31
- __rvm_run "autoconf" "$rvm_autoconf" "Running autoconf"
32
- # if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi # Don't barf on autoconf fail...
27
+ if which autoconf &> /dev/null ; then
28
+ __rvm_run "autoconf" "autoconf" "Running autoconf"
29
+ else
30
+ $rvm_scripts_path/log "fail" "rvm expects autoconf" result=$? ; return $result
31
+ fi
33
32
  fi
34
33
 
35
34
  if [[ "1.8.5" = "$rvm_ruby_version" ]] ; then
@@ -45,11 +44,9 @@ __rvm_install_source() {
45
44
  if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
46
45
  (($rvm_debug_flag)) && $rvm_scripts_path/log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
47
46
  elif [[ ! -z "$rvm_ruby_configure" ]] ; then
48
- __rvm_run "configure" "$rvm_ruby_configure"
49
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
47
+ __rvm_run "configure" "$rvm_ruby_configure" || (result=$? && return $result)
50
48
  elif [[ -s ./configure ]] ; then
51
- __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string, this may take a while depending on your cpu(s)..."
52
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
49
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string, this may take a while depending on your cpu(s)..." || (result=$? && return $result)
53
50
  unset configure_parameters
54
51
  else
55
52
  $rvm_scripts_path/log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
@@ -62,12 +59,10 @@ __rvm_install_source() {
62
59
  fi
63
60
 
64
61
  rvm_ruby_make=${rvm_ruby_make:-"make"}
65
- __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while, depending on your cpu(s)..."
66
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
62
+ __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while, depending on your cpu(s)..." || (result=$? && return $result)
67
63
 
68
64
  rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"}
69
- __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string"
70
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
65
+ __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string" || (result=$? && return $result)
71
66
 
72
67
  $rvm_scripts_path/log "info" "Installation of $rvm_ruby_string is complete."
73
68
 
@@ -83,8 +78,9 @@ __rvm_install_source() {
83
78
 
84
79
  __rvm_install_ruby() {
85
80
 
86
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
87
- if [[ ! -z "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
81
+ (( $rvm_ruby_selected_flag )) || __rvm_select $*
82
+
83
+ if [[ ! -z "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
88
84
 
89
85
  case "$rvm_ruby_interpreter" in
90
86
  macruby)
@@ -104,8 +100,7 @@ __rvm_install_ruby() {
104
100
  # TODO: Separated nightly from head.
105
101
  __rvm_db "macruby_nightly_url" "rvm_url"
106
102
  $rvm_scripts_path/log "info" "Retrieving the latest nightly macruby build..."
107
- $rvm_scripts_path/fetch "$rvm_url"
108
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
103
+ $rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
109
104
  mv "$rvm_archives_path/macruby_nightly-latest.pkg" "$rvm_archives_path/macruby_nightly.pkg"
110
105
  __rvm_run "macruby/extract" "sudo installer -pkg '$rvm_path/archives/macruby_nightly.pkg' -target '/'"
111
106
  mkdir -p "$rvm_ruby_home/bin"
@@ -148,11 +143,9 @@ RubyWrapper
148
143
  $rvm_scripts_path/log "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
149
144
  else
150
145
  $rvm_scripts_path/log "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
151
- $rvm_scripts_path/fetch "$rvm_url"
152
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
146
+ $rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
153
147
  rm -rf "$rvm_ruby_src_path"
154
- __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file..."
155
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
148
+ __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file..." || (result=$? && return $result)
156
149
  mv "$rvm_src_path/$rvm_ruby_package_file" "$rvm_ruby_src_path"
157
150
  fi
158
151
  builtin cd "$rvm_ruby_src_path"
@@ -167,8 +160,7 @@ RubyWrapper
167
160
  rvm_ree_options="${rvm_ree_options} --no-tcmalloc"
168
161
  fi
169
162
 
170
- __rvm_run "install" "./installer -a $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level $rvm_ree_options --dont-install-useful-gems $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..." # --no-tcmalloc
171
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
163
+ __rvm_run "install" "./installer -a $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level $rvm_ree_options --dont-install-useful-gems $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..." || (result=$? && return $result)
172
164
  chmod +x $rvm_ruby_home/bin/*
173
165
 
174
166
  __rvm_rubygems_setup
@@ -211,11 +203,9 @@ RubyWrapper
211
203
  if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.0/')" ]] && [[ -z "$rvm_head_flag" ]] ; then
212
204
  if [[ ! -f "$rvm_archives_path/$rvm_ruby_package_file.tar.gz" ]] ; then
213
205
  $rvm_scripts_path/log "info" "Downloading $rvm_ruby_file, this may take a while depending on your connection..."
214
- $rvm_scripts_path/fetch "$rvm_url"
215
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
206
+ $rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
216
207
  fi
217
- __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_file.tar.gz ..."
218
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
208
+ __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_file.tar.gz ..." || (result=$? && return $result)
219
209
  mv $rvm_src_path/rubinius-$rvm_ruby_version $rvm_ruby_src_path
220
210
  else
221
211
  __rvm_db "rubinius_repo_url" "rvm_ruby_repo_url"
@@ -306,21 +296,17 @@ RubyWrapper
306
296
  ;;
307
297
 
308
298
  jruby)
309
- if [[ -z "$(which java 2>/dev/null)" ]] ; then
299
+ if ! which java &> /dev/null ; then
310
300
  echo -e "java must be installed and in your path in order to install JRuby." ; return 1
311
301
  fi
312
302
 
313
303
  mkdir -p "$rvm_ruby_log_path" "$rvm_ruby_src_path"
314
304
  __rvm_pushpop $rvm_src_path
315
-
316
- __rvm_fetch_ruby
317
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
318
-
319
- __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
320
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
305
+ __rvm_fetch_ruby || (result=$? && return $result)
306
+ (( $rvm_head_flag )) || __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
321
307
 
322
308
  builtin cd "$rvm_ruby_src_path"
323
- if [[ "$rvm_head_flag" -eq 1 ]] || [[ ! -z "$rvm_ruby_revision" ]] ; then ant dist ; fi
309
+ (( $rvm_head_flag )) && (( $rvm_ruby_version )) && ant dist
324
310
 
325
311
  mkdir -p "$rvm_ruby_home/bin/"
326
312
  __rvm_run "nailgun" "builtin cd "$rvm_ruby_src_path/tool/nailgun" && ./configure --prefix=$rvm_ruby_home && make $rvm_make_flags"
@@ -352,13 +338,12 @@ RubyWrapper
352
338
  ;;
353
339
 
354
340
  ironruby|ir)
355
- if [[ -z "$(which mono 2>/dev/null)" ]] ; then
341
+ if ! which mono &> /dev/null ; then
356
342
  echo -e "mono must be installed and in your path in order to install IronRuby." ; return 1
357
343
  fi
358
344
 
359
345
  $rvm_scripts_path/log "info" "Retrieving IronRuby"
360
- $rvm_scripts_path/fetch "$rvm_url"
361
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
346
+ $rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
362
347
 
363
348
  __rvm_run "extract" "unzip $rvm_archives_path/$rvm_ruby_package_file ironruby/bin/* ironruby/lib/* -d $rvm_ruby_home" "Extracting $rvm_ruby_package_file ..."
364
349
  mv $rvm_ruby_home/ironruby/* $rvm_ruby_home
@@ -415,10 +400,11 @@ RubyWrapper
415
400
  fi
416
401
 
417
402
  if [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
418
- rvm_autoconf="$(which autoconf 2>/dev/null)"
419
- if [[ $? -gt 0 ]] ; then $rvm_scripts_path/log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi
420
- __rvm_run "autoconf" "$rvm_autoconf" "Running autoconf"
421
- # if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi # Don't barf on autoconf fail...
403
+ if which autoconf &> /dev/null ; then
404
+ __rvm_run "autoconf" "autoconf" "Running autoconf"
405
+ else
406
+ $rvm_scripts_path/log "fail" "rvm expects autoconf" ; result=$? ; return $result
407
+ fi
422
408
  fi
423
409
 
424
410
  if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
@@ -426,20 +412,17 @@ RubyWrapper
426
412
  elif [[ ! -z "rvm_ruby_configure" ]] ; then
427
413
  $rvm_ruby_configure
428
414
  elif [[ -s ./configure ]] ; then
429
- __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string using $rvm_ruby_configure_flags, this may take a while depending on your cpu(s)..."
430
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
415
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_string using $rvm_ruby_configure_flags, this may take a while depending on your cpu(s)..." || (result=$? && return $result)
431
416
  unset configure_parameters
432
417
  else
433
418
  $rvm_scripts_path/log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
434
419
  fi
435
420
 
436
421
  rvm_ruby_make=${rvm_ruby_make:-"/usr/bin/make"}
437
- __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while, depending on your cpu(s)..."
438
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
422
+ __rvm_run "make" "$rvm_ruby_make $rvm_make_flags" "Compiling $rvm_ruby_string, this may take a while, depending on your cpu(s)..." || (result=$? && return $result)
439
423
 
440
424
  rvm_ruby_make_install=${rvm_ruby_make_install:-"/usr/bin/make install"}
441
- __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string"
442
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
425
+ __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string" || (result=$? && return $result)
443
426
 
444
427
  $rvm_scripts_path/log "info" "Installation of $rvm_ruby_string is complete."
445
428
 
@@ -470,7 +453,7 @@ RubyWrapper
470
453
  }
471
454
 
472
455
  __rvm_fetch_ruby() {
473
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
456
+ (( $rvm_ruby_selected_flag )) || __rvm_select $*
474
457
 
475
458
  if [[ -z "$rvm_head_flag" ]] && [[ -z "$rvm_ruby_tag" ]] && [[ -z "$rvm_ruby_revision" ]] ; then
476
459
  rvm_ruby_package_name="${rvm_ruby_package_name:-"$rvm_ruby_string"}"
@@ -487,31 +470,26 @@ __rvm_fetch_ruby() {
487
470
  rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_url")/$rvm_ruby_package_file.$rvm_archive_extension"
488
471
  fi
489
472
  $rvm_scripts_path/log "info" "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
490
- $rvm_scripts_path/fetch "$rvm_url"
491
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
473
+ $rvm_scripts_path/fetch "$rvm_url" || (result=$? && return $result)
492
474
  fi
493
- __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..."
494
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
475
+ __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.$rvm_archive_extension -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..." || (result=$? && return $result)
495
476
  else
496
477
  if [[ ! -z "$(echo $rvm_url | awk '/^git/')" ]] ; then
497
478
  if [[ -d "$rvm_ruby_src_path/.git" ]] ; then
498
479
  builtin cd $rvm_ruby_src_path
499
480
  if [[ -z "$rvm_ruby_revision" ]] ; then
500
481
  $rvm_scripts_path/log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
501
- git pull origin master
502
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
482
+ git pull origin master || (result=$? && return $result)
503
483
  else
504
484
  if [[ -z "$rvm_ruby_sha" ]] ; then
505
485
  git checkout HEAD
506
486
  else
507
487
  git checkout $(echo $rvm_ruby_sha | sed 's#^s##')
508
- fi
509
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
488
+ fi || (result=$? && return $result)
510
489
  fi
511
490
  else
512
491
  $rvm_scripts_path/log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
513
- git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path
514
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
492
+ git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path || (result=$? && return $result)
515
493
  fi
516
494
  else
517
495
  if [[ ! -z "$rvm_head_flag" ]] || [[ "trunk" = "$rvm_ruby_revision" ]] ; then
@@ -537,14 +515,13 @@ __rvm_fetch_ruby() {
537
515
  else
538
516
  rm -rf $rvm_ruby_src_path
539
517
  __rvm_run "svn.checkout" "svn checkout -q ${rvm_rev/-r/-r } $rvm_url $rvm_ruby_src_path"
540
- fi
541
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
518
+ fi || (result=$? && return $result)
542
519
  fi
543
520
  fi
544
521
  }
545
522
 
546
523
  __rvm_uninstall_ruby() {
547
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
524
+ (( $rvm_ruby_selected_flag )) || __rvm_select $*
548
525
 
549
526
  if [[ ! -z "$rvm_ruby_string" ]] ; then
550
527
  for dir in $rvm_path ; do
@@ -561,11 +538,11 @@ __rvm_uninstall_ruby() {
561
538
  rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version*/
562
539
  else
563
540
  $rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_string'"
564
- fi
541
+ fi ; unset rvm_uninstall_flag
565
542
  }
566
543
 
567
544
  __rvm_remove_ruby() {
568
- if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
545
+ (( $rvm_ruby_selected_flag )) || __rvm_select $*
569
546
 
570
547
  if [[ ! -z "$rvm_ruby_string" ]] ; then
571
548
  for dir in $rvm_src_path $rvm_path ; do
@@ -581,7 +558,7 @@ __rvm_remove_ruby() {
581
558
  done ; unset dir
582
559
  else
583
560
  $rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_string'"
584
- fi
561
+ fi ; unset rvm_remove_flag
585
562
  }
586
563
 
587
564
  __rvm_post_install() {
@@ -638,8 +615,7 @@ __rvm_rubygems_setup() {
638
615
  if [[ ! -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then rm -rf "$rvm_src_path/$rvm_gem_package_name" ; fi
639
616
  if [[ ! -d "$rvm_src_path/$rvm_gem_package_name" ]] ; then
640
617
  $rvm_scripts_path/log "info" "Retrieving $rvm_gem_package_name"
641
- $rvm_scripts_path/fetch "$rvm_gem_url"
642
- result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
618
+ $rvm_scripts_path/fetch "$rvm_gem_url" || (result=$? && return $result)
643
619
  mkdir -p "$rvm_src_path/$rvm_gem_package_name"
644
620
  __rvm_run "rubygems.extract" "tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_src_path" "Extracting $rvm_gem_package_name"
645
621
  fi
@@ -682,7 +658,7 @@ __rvm_inject_gem_env() {
682
658
  }
683
659
 
684
660
  __rvm_actual_file() {
685
- if [[ -L $1 ]] ; then # If the file is a symlink,
661
+ if [[ -L $1 ]] ; then # If the file is a symlink,
686
662
  actual_file="$(readlink $1)" # read the link target so we can preserve it.
687
663
  else
688
664
  actual_file="$1"
@@ -690,9 +666,10 @@ __rvm_actual_file() {
690
666
  }
691
667
 
692
668
  __rvm_manage_rubies() {
693
- #__rvm_state
694
669
  rubies=() ; successes=() ; errors=() ; statuses=()
670
+
695
671
  unset rvm_gem_set_name rvm_ruby_selected_flag
672
+
696
673
  rvm_ruby_gem_home=$(echo $rvm_ruby_gem_home | awk -F'%' '{print $1}')
697
674
  rvm_ruby_string=$(echo $rvm_ruby_string | awk -F'%' '{print $1}')
698
675
 
@@ -725,11 +702,10 @@ __rvm_manage_rubies() {
725
702
  $rvm_scripts_path/log "warn" 'Really? Install all? See "rvm list --all" and limit the selection to something more sane please :)'
726
703
  fi
727
704
  fi
728
- #__rvm_state
729
705
 
730
- if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
731
- if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
732
- if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
706
+ (( $rvm_summary_flag )) && __rvm_summary
707
+ (( $rvm_yaml_flag )) && __rvm_yaml
708
+ (( $rvm_json_flag )) && __rvm_json
733
709
  }
734
710
 
735
711
  rvm_action="$1" ; rubies_string="$2"
data/scripts/match CHANGED
@@ -8,7 +8,7 @@ if [[ ! -z "$BASH_VERSION" ]] && [[ ${BASH_VERSION:0:1} -gt 2 ]] ; then
8
8
  [[ "$1" =~ $2 ]]
9
9
  exit $?
10
10
  else
11
- if [ ! -z "$(echo "$1" | awk "/${2}/")" ] ; then
11
+ if echo "$1" | grep -q "${2}" ; then
12
12
  exit 0
13
13
  else
14
14
  exit 1
data/scripts/rvm CHANGED
@@ -37,7 +37,11 @@ if [[ "$rvm_loaded_flag" != "1" ]] || [[ "$rvm_reload_flag" = "1" ]] ; then
37
37
 
38
38
  alias rvm-restart="source '${rvm_path}/scripts/rvm'"
39
39
 
40
- if [[ -s "$rvm_path/default" ]] ; then source "$rvm_path/default" ; fi
40
+ if [[ -s "$HOME/.rvm/default" ]] ; then
41
+ source "$HOME/.rvm/default"
42
+ elif [[ -s "$rvm_path/default" ]] ; then
43
+ source "$rvm_path/default"
44
+ fi
41
45
  else
42
46
  echo -e "\$rvm_path is not set. rvm cannot load."
43
47
  fi
data/scripts/rvm-install CHANGED
@@ -66,11 +66,15 @@ echo -e "\n Checking rc files ($rvm_rc_files) ..."
66
66
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
67
67
  for rcfile in $(echo $rvm_rc_files) ; do
68
68
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
69
-
70
- grep "scripts\/rvm" "$rcfile" > /dev/null 2>&1
71
- if [[ $? -gt 0 ]] ; then
69
+ if [[ -s "$HOME/.profile" ]] ; then
70
+ if ! grep -q '.profile' "$rcfile" ; then
71
+ echo " Adding 'if [[ -s $HOME/.profile ]] ; then source $HOME ; fi' to $rcfile."
72
+ echo -e "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
73
+ fi
74
+ fi
75
+ if ! grep -q "scripts\/rvm" "$rcfile" ; then
72
76
  echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
73
- echo -e "\n# rvm-install added line:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
77
+ echo -e "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
74
78
  fi
75
79
  done
76
80
  fi
data/scripts/selector CHANGED
@@ -360,10 +360,11 @@ __rvm_ruby_string() {
360
360
  elif $rvm_scripts_path/match "$string" "^u[a-z0-9]" ; then
361
361
  unset rvm_ruby_patch_level rvm_ruby_revision rvm_ruby_tag rvm_ruby_patch
362
362
  rvm_ruby_user_tag="$string"
363
- elif $rvm_scripts_path/match "$string" "^[a-z][a-z]" ; then
363
+ elif [[ "$string" = "ruby" ]] || [[ "$string" = "jruby" ]] || [[ "$string" = "ree" ]] || [[ "$string" = "macruby" ]] || [[ "$string" = "rbx" ]] || [[ "$string" = "rubinius" ]] || [[ "$string" = "mput" ]] || [[ "$string" = "shyouhei" ]] || [[ "$string" = "ironruby" ]] ; then
364
364
  rvm_ruby_interpreter="$string"
365
365
  else
366
366
  $rvm_scripts_path/log "error" "Unknown ruby string component: '$string'"
367
+ return 1
367
368
  fi
368
369
  done
369
370
 
data/scripts/update CHANGED
@@ -66,11 +66,15 @@ echo -e "\n Checking rc files ($rvm_rc_files) ..."
66
66
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
67
67
  for rcfile in $(echo $rvm_rc_files) ; do
68
68
  if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
69
-
70
- grep "scripts\/rvm" "$rcfile" > /dev/null 2>&1
71
- if [[ $? -gt 0 ]] ; then
69
+ if [[ -s "$HOME/.profile" ]] ; then
70
+ if ! grep -q '.profile' "$rcfile" ; then
71
+ echo " Adding 'if [[ -s $HOME/.profile ]] ; then source $HOME ; fi' to $rcfile."
72
+ echo -e "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
73
+ fi
74
+ fi
75
+ if ! grep -q "scripts\/rvm" "$rcfile" ; then
72
76
  echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
73
- echo -e "\n# rvm-install added line:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
77
+ echo -e "\n# rvm-install added:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
74
78
  fi
75
79
  done
76
80
  fi
data/scripts/utility CHANGED
@@ -71,7 +71,7 @@ __rvm_debug() {
71
71
 
72
72
  for file_name in $(echo $rc_files) ; do
73
73
  if [[ -s "$file_name" ]] ; then
74
- $rvm_scripts_path/log "debug" "$file_name:\n$(grep 'rvm' $file_name)"
74
+ $rvm_scripts_path/log "debug" "$file_name:\n$(grep 'rvm' $file_name 2>/dev/null)"
75
75
  fi
76
76
  done
77
77
 
@@ -117,7 +117,10 @@ __rvm_run() {
117
117
  mkdir -p $(dirname "$rvm_ruby_log_path/$log_file_name.log")
118
118
 
119
119
  if [[ ! -z "$message" ]] ; then $rvm_scripts_path/log "info" "$message" ; fi
120
- (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "Executing: $command"
120
+ if [[ ! -z "$rvm_debug_flag" ]] ; then
121
+ $rvm_scripts_path/log "debug" "Executing: $command"
122
+ fi
123
+
121
124
  touch "$rvm_ruby_log_path/$log_file_name.log" "$rvm_ruby_log_path/$log_file_name.error.log" # for zsh :(
122
125
  echo "[$(date +'%Y-%m-%d %H:%M:%S')] $command" | tee "$rvm_ruby_log_path/$log_file_name.log" > "$rvm_ruby_log_path/$log_file_name.error.log"
123
126
  if [[ -z "$rvm_niceness" ]] || [[ "0" = "$rvm_niceness" ]] ; then
@@ -339,8 +342,7 @@ __rvm_initialize() {
339
342
 
340
343
  __rvm_clean_path
341
344
 
342
- rvm_result=$(echo $PATH | grep 'rvm\/bin:')
343
- if [[ -z "$rvm_result" ]] ; then
345
+ if echo $PATH | grep -q 'rvm\/bin:' ; then
344
346
  PATH=$rvm_bin_path:$PATH ; export PATH
345
347
  fi
346
348
 
@@ -421,9 +423,7 @@ __rvm_ruby_do() {
421
423
  elif [[ -x "$rvm_ruby_gem_home/bin/$binary" ]] ; then
422
424
  binary="$rvm_ruby_gem_home/bin/$binary"
423
425
  elif [[ "system" = "$rvm_ruby_string" ]] && [[ -x "$(which $binary)" ]] ; then
424
- binary="$(which $binary 2>/dev/null)"
425
- #elif [[ "spec" = "$binary" ]] ; then
426
- #binary="$(which $binary 2>/dev/null)"
426
+ binary="$(basename $(which $binary 2>/dev/null) 2>/dev/null)"
427
427
  else
428
428
  $rvm_scripts_path/log "warn" "'$binary not found for $rvm_ruby_string' either does not exist or is not executable? :("
429
429
  __rvm_unset_ruby_variables
@@ -435,7 +435,7 @@ __rvm_ruby_do() {
435
435
  rvm_ruby_mode="--$(echo $rvm_ruby_mode | sed 's/^m//')"
436
436
  fi
437
437
 
438
- load_path="$rvm_ruby_home/bin:$rvm_ruby_load_path"
438
+ load_path="$(dirname $(which $binary 2>/dev/null) 2>/dev/null):$rvm_ruby_load_path"
439
439
  # TODO: the else case below should be run if $rvm_ruby_args =~ /\.rb$/
440
440
  if [[ "ruby" = "$(basename $binary)" ]] && [[ "$rvm_benchmark_flag" -ne 1 ]] ; then
441
441
  if $rvm_scripts_path/match "$rvm_ruby_args" "\.rb$" ; then
@@ -458,7 +458,7 @@ __rvm_ruby_do() {
458
458
  touch ./log/$rvm_ruby_string/$rvm_action.log ./log/$rvm_ruby_string/$rvm_action.error.log
459
459
  eval "$rvm_command" >> ./log/$rvm_ruby_string/$rvm_action.log 2>> ./log/$rvm_ruby_string/$rvm_action.error.log
460
460
  else
461
- echo -e "\n\n\033[0;32m$rvm_ruby_string: $($rvm_ruby_home/bin/ruby -v $rvm_ruby_mode | tr "\n" ' ')\033[0m\n"
461
+ echo -e "\n\n\033[0;32m$rvm_ruby_string: $($binary -v $rvm_ruby_mode | tr "\n" ' ')\033[0m\n"
462
462
  eval "$rvm_command"
463
463
  fi
464
464
  result=$?
@@ -533,7 +533,9 @@ __rvm_yaml() {
533
533
  total=${#rubies[*]}
534
534
  if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
535
535
  for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
536
- (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
536
+ if [[ ! -z "$rvm_debug_flag" ]] ; then
537
+ $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
538
+ fi
537
539
  yaml="$yaml\n \"${rubies[$index]}\": ${statuses[$index]}"
538
540
  done ; unset index array_start
539
541
  mkdir -p log
@@ -552,7 +554,9 @@ __rvm_json() {
552
554
  total=${#rubies[*]}
553
555
  if [[ ! -z "$ZSH_VERSION" ]] ; then array_start=1 ; else array_start=0 ; fi
554
556
  for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
555
- (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
557
+ if [[ ! -z "$rvm_debug_flag" ]] ; then
558
+ $rvm_scripts_path/log "debug" "${rubies[$index]}: ${statuses[$index]}"
559
+ fi
556
560
  json="$json\n {\"${rubies[$index]}\": ${statuses[$index]}}"
557
561
  if (( $index + 1 < $total + $array_start )) ; then json="$json, " ; fi
558
562
  done ; unset index array_start
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.96
4
+ version: 0.0.97
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin