rvm 0.0.80 → 0.0.81

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ -f "$1" ]] ; then
4
+ database_file="$1" ; shift
5
+ if [[ ! -f "$database_file" ]] ; then
6
+ mkdir -p $(dirname $database_file)
7
+ touch $database_file
8
+ fi
9
+ else
10
+ echo "usage: $0 database key [value]"
11
+ exit 1
12
+ fi
13
+
14
+ key="$1" ; shift
15
+ if [[ -z "$key" ]] ; then
16
+ echo "usage: $0 database key [value]"
17
+ exit 1
18
+ else
19
+ value="$*"
20
+ if [[ "unset" = "$value" ]] || [[ "delete" = "$value" ]] ; then
21
+ sed -i.tmp "s#^$key=.*\$##" $database_file
22
+ else
23
+ if [[ -z "$value" ]] ; then # get
24
+ awk -F= '/^'"$key"'=/{print $2}' $database_file
25
+ else # set
26
+ if [[ -z "$(awk -F= "/^'"$key"'=/{print $2}" $database_file)" ]] ; then # append
27
+ echo "$key=$value" >> $database_file
28
+ else # overwrite
29
+ sed -i.tmp "s#^$key=.*\$#$key=$value#" $database_file
30
+ fi
31
+ fi
32
+ fi
33
+ fi
34
+
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env bash
2
+
3
+ fetch_command=$(which curl)
4
+ if [[ $? -ne 0 ]] ; then
5
+ $rvm_scripts_path/log "fail" "rvm requires curl, which does not seem to exist in your path :("
6
+ exit 1
7
+ else
8
+ fetch_command="$fetch_command -O -L --create-dirs -C - " # -s for silent
9
+ fi
10
+
11
+ pushd "$rvm_archives_path" > /dev/null 2>&1
12
+
13
+ if [[ -z "$1" ]] ; then $rvm_scripts_path/log "fail" "BUG: $0 called without an argument :/" ; exit 1 ; fi
14
+
15
+ archive=$(basename "$1") ; downlaod=1
16
+
17
+ (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "Fetching $archive"
18
+
19
+ # Check first if we have the correct archive
20
+ if [[ -e "$archive" ]] && [[ -e "$archive.md5" ]] ; then
21
+ (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "Found archive and its md5, testing correctness"
22
+ if [[ $(md5sum --status -c "$archive.md5") -gt 0 ]] ; then
23
+ (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "Archive is bad, downloading"
24
+ download=1
25
+ else
26
+ (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "Archive is good, not downloading"
27
+ download=0
28
+ result=0
29
+ fi
30
+ else
31
+ (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "No archive or no MD5, downloading"
32
+ download=1
33
+ fi
34
+ if [[ $download -gt 0 ]] ; then
35
+ eval $fetch_command "$1"
36
+ result=$?
37
+ if [[ $result -gt 0 ]] ; then
38
+ retry=0
39
+ if [[ $result -eq 78 ]] ; then
40
+ $rvm_scripts_path/log "error" "The requested url does not exist: '$1'"
41
+ elif [[ $result -eq 18 ]] ; then
42
+ $rvm_scripts_path/log "error" "Partial file. Only a part of the file was transferred. Removing partial and re-trying."
43
+ rm -f "$archive"
44
+ retry=1
45
+ elif [[ $result -eq 33 ]] ; then
46
+ (( $rvm_debug_flag )) && $rvm_scripts_path/log "debug" "Server does not support 'range' command, removing '$archive'"
47
+ rm -f "$archive"
48
+ retry=1
49
+ else
50
+ $rvm_scripts_path/log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
51
+ fi
52
+
53
+ if [[ $retry -eq 1 ]] ; then
54
+ eval $fetch_command "$1"
55
+ result=$?
56
+ if [[ $result -gt 0 ]] ; then
57
+ $rvm_scripts_path/log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log"
58
+ fi
59
+ fi
60
+
61
+ fi
62
+ popd > /dev/null 2>&1
63
+ fi
64
+
65
+ exit $result
@@ -10,7 +10,7 @@ __rvm_gems_select() {
10
10
  rvm_gem_set_name=$(echo $rvm_ruby_gem_home | xargs basename | awk -F'%' '{print $2}')
11
11
  fi
12
12
 
13
- if [[ ! -z "$rvm_gem_set_name" ]] && ! match "$rvm_gem_set_name" "^[0-9]\.[0-9]" ; then
13
+ if [[ ! -z "$rvm_gem_set_name" ]] && ! $rvm_scripts_path/match "$rvm_gem_set_name" "^[0-9]\.[0-9]" ; then
14
14
  rvm_ruby_gem_home="$rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version%$rvm_gem_set_name"
15
15
  else
16
16
  if [[ ! -z "$rvm_ruby_interpreter" ]] && [[ ! -z "$rvm_ruby_version" ]] && [[ "$rvm_ruby_interpreter" != "system" ]] ; then
@@ -20,7 +20,7 @@ __rvm_gems_select() {
20
20
  elif [[ ! -z "$GEM_HOME" ]] ; then
21
21
  rvm_ruby_gem_home="$GEM_HOME"
22
22
  else
23
- __rvm_log "error" "Cannot select gem home, something definitely wrong :/"
23
+ $rvm_scripts_path/log "error" "Cannot select gem home, something definitely wrong :/"
24
24
  fi
25
25
  fi
26
26
  if [[ -z "$rvm_gem_set_name" ]] ; then unset rvm_gem_set_name ; fi
@@ -62,19 +62,19 @@ __rvm_gems_delete() {
62
62
  if [[ -d "$gemdir" ]] && [[ ! -z "$rvm_force_flag" ]] ; then
63
63
  rm -rf "$gemdir"
64
64
  elif [[ -d "$gemdir" ]] ; then
65
- __rvm_log "warn" "Are you SURE you wish to remove the installed gems '$rvm_gem_set_name ' ($gemdir)?"
65
+ $rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gems '$rvm_gem_set_name ' ($gemdir)?"
66
66
  echo -n "(anything other than 'yes' will cancel) > "
67
67
  read response
68
68
  if [[ "yes" = "$response" ]] ; then
69
69
  rm -rf "$gemdir"
70
70
  else
71
- __rvm_log "info" "Not doing anything, phew... close call that one eh?"
71
+ $rvm_scripts_path/log "info" "Not doing anything, phew... close call that one eh?"
72
72
  fi
73
73
  else
74
- __rvm_log "info" "$gemdir already does not exist."
74
+ $rvm_scripts_path/log "info" "$gemdir already does not exist."
75
75
  fi ; unset gemdir
76
76
  else
77
- __rvm_log "error" "A gems name must be specified in order to delete a gems."
77
+ $rvm_scripts_path/log "error" "A gems name must be specified in order to delete a gems."
78
78
  fi
79
79
  }
80
80
 
@@ -124,7 +124,7 @@ __rvm_gems_load() {
124
124
  elif [[ -f ".gems" ]] ; then
125
125
  rvm_file_name=".gems"
126
126
  else
127
- __rvm_log "error" "No gem set file found."
127
+ $rvm_scripts_path/log "error" "No gem set file found."
128
128
  return 1
129
129
  fi
130
130
  fi
@@ -142,16 +142,16 @@ __rvm_gems_load() {
142
142
  #
143
143
  gem="$(echo $line | awk -F';' '{print $1}')"
144
144
  gem_prefix="$(echo $line | awk -F';' '{print $2}')"
145
- if match "$gem" "\.gem$" ; then
145
+ if $rvm_scripts_path/match "$gem" "\.gem$" ; then
146
146
  gem_name="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{$NF=NULL;print}')"
147
147
  gem_version="$(basename $gem | sed 's#\.gem##' | awk -F'-' '{print $NF}' )"
148
148
  gem_postfix="$(basename $gem | sed "s#.*\.gem##")"
149
149
  else
150
150
  gem_name="$(echo $gem | awk '{print $1}')"
151
- if match "$gem" "--version" ; then
151
+ if $rvm_scripts_path/match "$gem" "--version" ; then
152
152
  gem_version="$(echo $gem | sed 's#.*--version[=]*[ ]*##' | awk '{print $1}')"
153
153
  gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##" | sed "s#--version[=]*[ ]*${gem_version/ /}##")"
154
- elif match "$gem" "-v" ; then
154
+ elif $rvm_scripts_path/match "$gem" "-v" ; then
155
155
  gem_version="$(echo $gem | sed 's#.*-v[=]*[ ]*##' | awk '{print $1}')"
156
156
  gem_postfix="$(echo $gem | sed "s#${gem_name/ /}##" | sed "s#-v[=]*[ ]*${gem_version/ /}##")"
157
157
  else
@@ -161,7 +161,7 @@ __rvm_gems_load() {
161
161
 
162
162
  if [[ -f "$gem" ]] ; then
163
163
  gem_file_name="$gem"
164
- elif match "$gem" ".gem$" ; then
164
+ elif $rvm_scripts_path/match "$gem" ".gem$" ; then
165
165
  gem_file_name="$gem"
166
166
  elif [[ -z "${gem_version/ /}" ]] ; then # no v/Users/wayne/projects/db0/rvm/scripts/gems
167
167
  gem_file_name="${gem_name/ /}*.gem"
@@ -174,7 +174,7 @@ __rvm_gems_load() {
174
174
  #
175
175
  if [[ -z "$rvm_force_flag" ]] && [[ -f "${rvm_ruby_gem_home}/specifications/${gem_file_name}spec" ]] ; then
176
176
  unset gem
177
- __rvm_log "warn" "$(__color "yellow")$gem_name $gem_version$(__color "none") exists, skipping (--force to re-install)"
177
+ $rvm_scripts_path/log "warn" "$($rvm_scripts_path/color "yellow")$gem_name $gem_version$($rvm_scripts_path/color "none") exists, skipping (--force to re-install)"
178
178
  else
179
179
  if [[ -f "$gem" ]] ; then
180
180
  cache_file="$gem"
@@ -216,7 +216,7 @@ __rvm_gems_load() {
216
216
  if [[ ! -z "$gem" ]] ; then
217
217
  # TODO: Set vars if fourth field is non-empty (means that there are conditional statements to execute in the gem install line.
218
218
  __rvm_make_flags
219
- __rvm_log "info" "Installing $gem_name $gem_version..."
219
+ $rvm_scripts_path/log "info" "Installing $gem_name $gem_version..."
220
220
  if [[ ! -z "$rvm_ruby_gem_home" ]] ; then
221
221
  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"
222
222
  else
@@ -230,15 +230,15 @@ __rvm_gems_load() {
230
230
  eval $command > /dev/null 2>&1
231
231
  result=$?
232
232
  if [[ $result -eq 0 ]] ; then
233
- __rvm_log "info" "$(__color "green")$gem_name $gem_version$(__color "none") installed."
233
+ $rvm_scripts_path/log "info" "$($rvm_scripts_path/color "green")$gem_name $gem_version$($rvm_scripts_path/color "none") installed."
234
234
  else
235
- __rvm_log "error" "$(__color "red")$gem_name $gem_version$(__color "none") failed to install."
235
+ $rvm_scripts_path/log "error" "$($rvm_scripts_path/color "red")$gem_name $gem_version$($rvm_scripts_path/color "none") failed to install."
236
236
  fi
237
237
  fi
238
238
  unset gem gem_prefix gem_name gem_version gem_file_name gem_postfix cache_file gem_file_name gem_string
239
239
  done < <(awk '/^[\.\/a-zA-Z]/{print}' "$rvm_file_name")
240
240
  else
241
- __rvm_log "error" "$rvm_file_name does not exist to load from."
241
+ $rvm_scripts_path/log "error" "$rvm_file_name does not exist to load from."
242
242
  fi
243
243
  }
244
244
 
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ "root" = "$(whoami)" ]] ; then
4
+ rvm_rc_files="/etc/profile /etc/zshenv"
5
+ else
6
+ rvm_rc_files="$HOME/.bash_profile $HOME/.bashrc $HOME/.zshrc"
7
+ fi
8
+
9
+ rvm_scripts_path="${rvm_scripts_path:-"$rvm_path/scripts"}"
10
+ rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
11
+ rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
12
+ rvm_log_path="${rvm_log_path:-"$rvm_path/log"}"
13
+ rvm_bin_path="${rvm_bin_path:-"$rvm_path/bin"}"
14
+ rvm_gem_path="${rvm_gem_path:-"$rvm_path/gems"}"
15
+ rvm_config_path="${rvm_config_path:-"$rvm_path/config"}"
16
+ rvm_temp_path="${rvm_temp_path:-"$rvm_path/tmp"}"
17
+
18
+ export rvm_path rvm_scripts_path rvm_archives_path rvm_src_path rvm_log_path rvm_bin_path rvm_gem_path rvm_config_path rvm_temp_path
19
+
@@ -1,15 +1,19 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- rc_files="$HOME/.bash_profile $HOME/.bashrc $HOME/.zshrc"
4
- if [[ -f "/etc/rvmrc" ]] ; then source "/etc/rvmrc" ; fi
5
- if [[ "root" = "$(whoami)" ]] ; then
6
- rvm_path="${rvm_path:-/usr/local/rvm}"
7
- rc_files="$rc_files /etc/profile /etc/zshenv"
8
- else
9
- if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
10
- rvm_path="${rvm_path:-$HOME/.rvm}"
3
+ if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
4
+ if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi
5
+ if [[ -z "$rvm_path" ]] ; then unset rvm_path ; fi
6
+
7
+ if [[ -z "$rvm_path" ]] ; then
8
+ if [[ "root" = "$(whoami)" ]] ; then
9
+ rvm_path="${rvm_path:-/usr/local/rvm}"
10
+ else
11
+ rvm_path="${rvm_path:-$HOME/.rvm}"
12
+ fi
11
13
  fi
12
14
 
15
+ source scripts/initialize
16
+
13
17
  #
14
18
  # Setup
15
19
  #
@@ -21,8 +25,8 @@ if [[ ! -d "$source_dir" ]] ; then unset source_dir ; fi
21
25
  source_dir="${source_dir:-$cwd}"
22
26
 
23
27
  # State what is required to use rvm
24
- echo -e "\n$(tput setaf 2)rvm$(tput sgr0)\n\n shell scripts that allows a user to manage multiple ruby versions in their own account."
25
- echo -e "\n Installing rvm to $rvm_path ..."
28
+ echo -e "\n$(tput setaf 2)rvm$(tput sgr0) - shell scripts that allows a user to manage multiple ruby versions in their own account."
29
+ echo -e "\n Installing to $rvm_path..."
26
30
  for dir_name in src scripts bin log archives config gems examples ; do
27
31
  mkdir -p "$rvm_path/$dir_name"
28
32
  done
@@ -47,15 +51,15 @@ ln -nfs $rvm_path/scripts/rvm $rvm_path/bin/rvm
47
51
  #
48
52
  # RC Files
49
53
  #
50
- if [[ -z "$rvm_loaded_flag" ]] ; then
51
- for rcfile in $(echo $rc_files) ; do
52
- if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
53
- if [[ -z "$(awk '/\.rvm\/scripts\/rvm/' $rcfile)" ]] ; then
54
- echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
55
- echo -e "\n# rvm-install added line:\nif [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
56
- fi
57
- done
58
- fi
54
+ for rcfile in $(echo $rvm_rc_files) ; do
55
+ if [[ ! -f $rcfile ]] ; then touch $rcfile ; fi
56
+ if [[ -z "$(awk "/$(echo "$rvm_path/scripts/rvm" | sed 's#/#\\/#g')/" $rcfile)" ]] ; then
57
+ echo " Adding 'if [[ -s $rvm_path/scripts/rvm ]] && [[ "\$rvm_loaded_flag" -le 0 ]] ; then source $rvm_path/scripts/rvm ; fi' to $rcfile."
58
+ echo -e "\n# rvm-install added line:\nif [[ -s $rvm_path/scripts/rvm ]] && [[ "\$rvm_loaded_flag" != "1" ]] ; then source $rvm_path/scripts/rvm ; fi\n" >> $rcfile
59
+ else
60
+ : # it exists... remove it and append at the end
61
+ fi
62
+ done
59
63
 
60
64
  if [[ "root" = "$(whoami)" ]] ; then
61
65
  ln -nfs $rvm_path/scripts/rvm /usr/local/bin/rvm
@@ -66,7 +70,7 @@ fi
66
70
  # System Checks
67
71
  #
68
72
  system="$(uname)"
69
- echo -e "\n $(tput setaf 3)NOTES: $(tput sgr0)\n"
73
+ echo -e "\n$(tput setaf 2)Notes: $(tput sgr0)\n"
70
74
  if [[ "Linux" = "$system" ]] ; then
71
75
  rvm_apt_get_binary="$(which aptitude 2> /dev/null)"
72
76
  rvm_emerge_binary="$(which emerge 2> /dev/null)"
@@ -74,44 +78,42 @@ if [[ "Linux" = "$system" ]] ; then
74
78
  rvm_yum_binary="$(which yum 2> /dev/null)"
75
79
 
76
80
  if [[ ! -z "$rvm_apt_get_binary" ]] ; then
77
- echo -e " $item For jRuby (if you wish to use it) you will need:"
78
- echo -e " $ aptitude install sun-java6-bin sun-java6-jre sun-java6-jdk"
79
- echo -e " $item For ree (if you wish to use it) you will need:"
80
- echo -e " $ aptitude install libreadline5-dev libssl-dev bison"
81
- echo -e " $item For 1.9.X (if you wish to use it) we additionally recommend:"
82
- echo -e " $ aptitude install libxml2-dev"
81
+ echo -e " $item For JRuby (if you wish to use it) you will need:"
82
+ echo -e " $ aptitude install sun-java6-bin sun-java6-jre sun-java6-jdk"
83
+ echo -e " $item For ree (if you wish to use it) you will need:"
84
+ echo -e " $ aptitude install libreadline5-dev libssl-dev bison"
85
+ echo -e " $item For 1.9.X (if you wish to use it) we additionally recommend:"
86
+ echo -e " $ aptitude install libxml2-dev"
83
87
 
84
88
  elif [[ ! -z "$rvm_emerge_binary" ]] ; then
85
- echo -e " $item For jRuby (if you wish to use it) you will need:"
86
- echo -e " $ emerge dev-java/sun-jdk dev-java/sun-jre-bin"
89
+ echo -e " $item For JRuby (if you wish to use it) you will need:"
90
+ echo -e " $ emerge dev-java/sun-jdk dev-java/sun-jre-bin"
87
91
 
88
92
  elif [[ ! -z "$rvm_pacman_binary" ]] ; then
89
- echo -e " $item For jRuby (if you wish to use it) you will need:"
90
- echo -e " $ pacman -Sy jdk jre"
93
+ echo -e " $item For JRuby (if you wish to use it) you will need:"
94
+ echo -e " $ pacman -Sy jdk jre"
91
95
 
92
96
  elif [[ ! -z "$rvm_yum_binary" ]] ; then
93
- echo -e " $item For ree (if you wish to use it) you will need:"
94
- echo -e " $ yum install -y rpm-build gcc gcc-c++ redhat-rpm-config ; then download and rpmbuild and install the sdk, Have fun..."
97
+ echo -e " $item For ree (if you wish to use it) you will need:"
98
+ echo -e " $ yum install -y rpm-build gcc gcc-c++ redhat-rpm-config ; then download and rpmbuild and install the sdk, Have fun..."
95
99
 
96
100
  else
97
- echo -e " $item For jRuby (if you wish to use it) you will need:"
98
- echo -e " The SUN java runtime environment and development kit."
101
+ echo -e " $item For JRuby (if you wish to use it) you will need:"
102
+ echo -e " The SUN java runtime environment and development kit."
99
103
  fi
100
104
  elif [[ "Darwin" = "$system" ]] ; then
101
- echo -e " $item Be sure that you have XCode Tools installed in order to use rvm."
102
- echo -e " $item If you intend on installing MacRuby you must install LLVM first."
105
+ echo -e " $item Be sure that you have XCode Tools installed in order to use rvm."
106
+ echo -e " $item If you intend on installing MacRuby you must install LLVM first."
103
107
  fi
104
108
 
105
- echo -e " $item In order to use rvm the following line must occur in your shell's loading files, after all path/variable settings.:"
106
- echo -e " $item if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
107
- echo -e " $item CLOSE THIS SHELL AND OPEN A NEW ONE in order to use rvm."
109
+ echo -e " $item In order to use rvm the following line must occur in your shell's loading files, after all path/variable settings.:"
110
+ echo -e " $item if [[ -s $rvm_path/scripts/rvm ]] ; then source $rvm_path/scripts/rvm ; fi"
111
+ echo -e " $item CLOSE THIS SHELL AND OPEN A NEW ONE in order to use rvm."
108
112
 
109
- echo -e "\n \033[0;33mRTFM: $(tput sgr0) http://rvm.beginrescueend.com/ \n"
113
+ echo -e "\n$(tput setaf 2)RTFM:\n $(tput sgr0) http://rvm.beginrescueend.com/ \n"
110
114
  echo -e "$(tput setaf 2)w⦿‿⦿t!$(tput sgr0)"
111
115
  echo -e "\n ~ Wayne\n"
112
116
 
113
- source $rvm_path/scripts/rvm
114
- rvm -v
115
- echo
117
+ $rvm_path/bin/rvm -v
116
118
 
117
119
  exit 0
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ ! -z "$2" ]] ; then level=$1 ; shift ; else level="info" ; fi
4
+ message=$1
5
+ case "$level" in
6
+ debug) shift ; echo -e "$(tput setaf 5)<d>$(tput sgr0) $message $(tput setaf 5)</d> $(tput sgr0) " ;;
7
+ info) shift ; echo -e "$(tput setaf 2)<i>$(tput sgr0) $message $(tput setaf 2)</i> $(tput sgr0) " ;;
8
+ warn) shift ; echo -e "$(tput setaf 3)<w>$(tput sgr0) $message $(tput setaf 3)</w> $(tput sgr0) " ;;
9
+ error) shift ; echo -e "$(tput setaf 1)<e>$(tput sgr0) $message $(tput setaf 1)</e> $(tput sgr0) " ;;
10
+ fail) shift ; echo -e "$(tput setaf 1)<f>$(tput sgr0) $message $(tput setaf 1)</f> $(tput sgr0) " ;;
11
+ *) echo -e "$message"
12
+ esac
13
+
14
+ exit 0
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [[ -z "$1" ]] || [[ -z "$2" ]] ; then
4
+ exit 1
5
+ fi
6
+
7
+ if [[ ! -z "$BASH_VERSION" ]] && [[ ${BASH_VERSION:0:1} -gt 2 ]] ; then
8
+ [[ "$1" =~ $2 ]]
9
+ exit $?
10
+ else
11
+ if [ ! -z "$(echo "$1" | awk "/${2}/")" ] ; then
12
+ exit 0
13
+ else
14
+ exit 1
15
+ fi
16
+ fi
@@ -0,0 +1 @@
1
+ #!/usr/bin/env bash
@@ -2,7 +2,7 @@
2
2
 
3
3
  __rvm_install_source() {
4
4
  if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
5
- __rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home"
5
+ $rvm_scripts_path/log "info" "Installing Ruby from source to: $rvm_ruby_home"
6
6
  mkdir -p "$rvm_ruby_log_path"
7
7
 
8
8
  __rvm_pushpop "$rvm_src_path"
@@ -16,9 +16,9 @@ __rvm_install_source() {
16
16
  if [[ -z "$rvm_head_flag" ]] && [[ -z "$rvm_ruby_tag" ]] && [[ -z "$rvm_ruby_revision" ]] ; then
17
17
  if [[ ! -f "$rvm_archives_path/$rvm_ruby_package_name.tar.gz" ]] ; then
18
18
  rvm_url="${rvm_url:-"ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_name.tar.gz"}"
19
- __rvm_log "info" "Downloading $rvm_ruby_package_name, this may take a while depending on your connection..."
20
- __rvm_fetch "$rvm_url"
21
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
19
+ $rvm_scripts_path/log "info" "Downloading $rvm_ruby_package_name, this may take a while depending on your connection..."
20
+ $rvm_scripts_path/fetch "$rvm_url"
21
+ result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
22
22
  fi
23
23
  #mkdir -p "$rvm_ruby_src_path" # Is this line necessary considering -C below? v
24
24
  __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_name ..."
@@ -26,9 +26,9 @@ __rvm_install_source() {
26
26
  else
27
27
  if [[ ! -z "$(echo $rvm_url | awk '/^git/')" ]] ; then
28
28
  if [[ -d "$rvm_ruby_src_path/.git" ]] ; then
29
- cd $rvm_ruby_src_path
29
+ builtin builtin cd $rvm_ruby_src_path
30
30
  if [[ -z "$rvm_ruby_revision" ]] ; then
31
- __rvm_log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
31
+ $rvm_scripts_path/log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
32
32
  git pull origin master
33
33
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
34
34
  else
@@ -40,7 +40,7 @@ __rvm_install_source() {
40
40
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
41
41
  fi
42
42
  else
43
- __rvm_log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
43
+ $rvm_scripts_path/log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
44
44
  git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path
45
45
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
46
46
  fi
@@ -58,11 +58,11 @@ __rvm_install_source() {
58
58
  fi
59
59
 
60
60
  if [[ -d "$rvm_ruby_src_path/.svn" ]] ; then
61
- cd $rvm_ruby_src_path
62
- __rvm_log "info" "Updating ruby from $rvm_url"
61
+ builtin cd $rvm_ruby_src_path
62
+ $rvm_scripts_path/log "info" "Updating ruby from $rvm_url"
63
63
  __rvm_run "svn.update" "svn update"
64
64
  if [[ ! -z "$rvm_rev" ]] ; then
65
- __rvm_log "info" "Checking out revision ${rvm_rev/-r/-r } from $rvm_url"
65
+ $rvm_scripts_path/log "info" "Checking out revision ${rvm_rev/-r/-r } from $rvm_url"
66
66
  __rvm_run "svn.checkout" "svn update -q ${rvm_rev/-r/-r }"
67
67
  fi
68
68
  else
@@ -73,18 +73,18 @@ __rvm_install_source() {
73
73
  fi
74
74
  fi
75
75
 
76
- cd $rvm_ruby_src_path
77
- if [[ $? -gt 0 ]] ; then result=$? ; __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; __rvm_pushpop ; return $result ; fi
76
+ builtin builtin cd $rvm_ruby_src_path
77
+ 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
78
78
 
79
79
  if [[ -z "$rvm_ruby_configure" ]] && [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
80
80
  rvm_autoconf="$(which autoconf)"
81
- if [[ $? -gt 0 ]] ; then __rvm_log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi
81
+ if [[ $? -gt 0 ]] ; then $rvm_scripts_path/log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi
82
82
  __rvm_run "autoconf" "$rvm_autoconf" "Running autoconf"
83
83
  # if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi # Don't barf on autoconf fail...
84
84
  fi
85
85
 
86
86
  if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
87
- __rvm_log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
87
+ (($rvm_debug_flag)) && $rvm_scripts_path/log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
88
88
  elif [[ ! -z "$rvm_ruby_configure" ]] ; then
89
89
  __rvm_run "configure" "$rvm_ruby_configure"
90
90
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
@@ -93,7 +93,7 @@ __rvm_install_source() {
93
93
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
94
94
  unset configure_parameters
95
95
  else
96
- __rvm_log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
96
+ $rvm_scripts_path/log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
97
97
  fi
98
98
 
99
99
  rvm_ruby_make=${rvm_ruby_make:-"/usr/bin/make"}
@@ -104,7 +104,7 @@ __rvm_install_source() {
104
104
  __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_package_name"
105
105
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
106
106
 
107
- __rvm_log "info" "Installation of $rvm_ruby_package_name is complete."
107
+ $rvm_scripts_path/log "info" "Installation of $rvm_ruby_package_name is complete."
108
108
 
109
109
  GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
110
110
  GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH
@@ -131,15 +131,16 @@ __rvm_install_ruby() {
131
131
  rvm_ruby_configure=" true "
132
132
  rvm_ruby_make="rake"
133
133
  rvm_ruby_make_install="sudo rake install"
134
- rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_repo_url")"
134
+ rvm_url="$($rvm_scripts_path/db "$rvm_config_path/db" "${rvm_ruby_interpreter}_repo_url")"
135
135
  rvm_ruby_repo_url=$rvm_url
136
136
  __rvm_install_source $*
137
137
  else # if [[ "nightly" = "$rvm_ruby_version" ]] ; then
138
138
  macruby_path="/usr/local/bin"
139
139
  # TODO: Separated nightly from head.
140
- rvm_url="$(__rvm_db "macruby_nightly_url")"
141
- __rvm_log "info" "Retrieving the latest nightly macruby build..."
142
- __rvm_fetch "$rvm_url"
140
+ rvm_url="$($rvm_scripts_path/db "$rvm_config_path/db" "macruby_nightly_url")"
141
+ $rvm_scripts_path/log "info" "Retrieving the latest nightly macruby build..."
142
+ $rvm_scripts_path/fetch "$rvm_url"
143
+ result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
143
144
  mv "$rvm_archives_path/macruby_nightly-latest.pkg" "$rvm_archives_path/macruby_nightly.pkg"
144
145
  __rvm_run "macruby/extract" "sudo installer -pkg '$rvm_path/archives/macruby_nightly.pkg' -target '/'"
145
146
  mkdir -p "$rvm_ruby_home/bin"
@@ -169,27 +170,27 @@ RubyWrapper
169
170
  done
170
171
  __rvm_irbrc
171
172
  else
172
- __rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
173
+ $rvm_scripts_path/log "fail" "MacRuby can only be installed on a Darwin OS."
173
174
  fi
174
175
  ;;
175
176
 
176
177
  ree)
177
178
  if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.8/')" ]] && [[ -z "$rvm_head_flag" ]] ; then
178
- rvm_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
179
- __rvm_log "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
179
+ rvm_url="$($rvm_scripts_path/db "$rvm_config_path/db" "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz"
180
+ $rvm_scripts_path/log "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home"
180
181
  __rvm_pushpop "$rvm_src_path"
181
182
  if [[ -z "$rvm_force_flag" ]] && [[ -d "$rvm_ruby_src_path" ]] && [[ ! -x "$rvm_ruby_src_path/installer" ]] ; then
182
- __rvm_log "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
183
+ $rvm_scripts_path/log "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)."
183
184
  else
184
- __rvm_log "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
185
- __rvm_fetch "$rvm_url"
186
- if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
185
+ $rvm_scripts_path/log "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..."
186
+ $rvm_scripts_path/fetch "$rvm_url"
187
+ result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
187
188
  rm -rf "$rvm_ruby_src_path"
188
189
  __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file..."
189
190
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
190
191
  mv "$rvm_src_path/$rvm_ruby_package_file" "$rvm_ruby_src_path"
191
192
  fi
192
- cd "$rvm_ruby_src_path"
193
+ builtin cd "$rvm_ruby_src_path"
193
194
 
194
195
  mkdir -p "$rvm_ruby_log_path"
195
196
  mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
@@ -218,9 +219,9 @@ RubyWrapper
218
219
  __rvm_post_install
219
220
  __rvm_pushpop
220
221
  else
221
- rvm_url="$(__rvm_db "ree_${rvm_ruby_version}_repo_url")"
222
+ rvm_url="$($rvm_scripts_path/db "$rvm_config_path/db" "ree_${rvm_ruby_version}_repo_url")"
222
223
  if [[ -z "$rvm_url" ]] ; then
223
- __rvm_log "fail" "rvm does not know the rvm repo url for 'ree_${rvm_ruby_version}'"
224
+ $rvm_scripts_path/log "fail" "rvm does not know the rvm repo url for 'ree_${rvm_ruby_version}'"
224
225
  result=1
225
226
  else
226
227
  rvm_ruby_repo_url=$rvm_url
@@ -231,7 +232,7 @@ RubyWrapper
231
232
  ;;
232
233
 
233
234
  rbx|rubinius)
234
- __rvm_log "info" "Installing pre-requisites"
235
+ $rvm_scripts_path/log "info" "Installing pre-requisites"
235
236
  # prereqs, 1.8.6+ + rake. Yes this could all be one line... not pushing our luck.
236
237
  echo "$(export rvm_install_on_use_flag=1 ; rvm 1.8.7)" # This should install if missing.
237
238
  # TODO: use 'rvm gems load' here:
@@ -246,11 +247,11 @@ RubyWrapper
246
247
  rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"
247
248
 
248
249
  if [[ ! -d "$rvm_ruby_home" ]] || [[ ! -d "$rvm_ruby_home/.git" ]] ; then
249
- rm -rf "$rvm_ruby_home" ; cd "$rvm_home"
250
+ rm -rf "$rvm_ruby_home" ; builtin cd "$rvm_home"
250
251
  __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_home" "Cloning $rvm_ruby_repo_url"
251
- cd "$rvm_ruby_home"
252
+ builtin cd "$rvm_ruby_home"
252
253
  else
253
- cd "$rvm_ruby_home"
254
+ builtin cd "$rvm_ruby_home"
254
255
  __rvm_run "rbx.repo" "git pull origin master" "Pulling from origin master"
255
256
  fi
256
257
 
@@ -262,7 +263,7 @@ RubyWrapper
262
263
  # RBX_PREFIX="$rvm_ruby_home" ; export RBX_PREFIX
263
264
  # Also see 'rakelib/configuration.rake'
264
265
 
265
- cd "$rvm_ruby_home"
266
+ builtin cd "$rvm_ruby_home"
266
267
  # TODO: Once installer is done add the prefix:
267
268
  #rvm_ruby_configure="./configure --prefix=$rvm_ruby_home" ; message="Configuring rbx"
268
269
  rvm_ruby_configure="./configure" ; message="Configuring rbx"
@@ -334,9 +335,9 @@ RubyWrapper
334
335
 
335
336
  if [[ "$rvm_head_flag" -eq 1 ]] || [[ ! -z "$rvm_ruby_revision" ]] ; then
336
337
  if [[ -d "$rvm_ruby_src_path/.git" ]] ; then
337
- cd "$rvm_ruby_src_path"
338
+ builtin cd "$rvm_ruby_src_path"
338
339
  if [[ -z "$rvm_ruby_revision" ]] ; then
339
- __rvm_log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
340
+ $rvm_scripts_path/log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..."
340
341
  git pull origin master
341
342
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
342
343
  else
@@ -349,29 +350,30 @@ RubyWrapper
349
350
  fi
350
351
  else
351
352
  rm -rf "$rvm_ruby_src_path"
352
- __rvm_log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
353
+ $rvm_scripts_path/log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..."
353
354
  git clone --depth 1 "$rvm_ruby_repo_url" "$rvm_ruby_src_path"
354
355
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
355
356
  fi
356
357
 
357
- cd "$rvm_ruby_src_path"
358
+ builtin cd "$rvm_ruby_src_path"
358
359
  ant dist
359
360
  else
360
361
  if [[ -z "$rvm_force_flag" ]] && [[ -f $rvm_package_file ]] && [[ -s $rvm_package_file ]] ; then
361
- __rvm_log "info" "It appears that $rvm_package_file has already been downloaded, skipping. Use --force to force re-download."
362
+ $rvm_scripts_path/log "info" "It appears that $rvm_package_file has already been downloaded, skipping. Use --force to force re-download."
362
363
  else
363
- __rvm_log "info" "Downloading $rvm_package_file, this may take a while depending on your connection..."
364
- __rvm_fetch "$rvm_url"
364
+ $rvm_scripts_path/log "info" "Downloading $rvm_package_file, this may take a while depending on your connection..."
365
+ $rvm_scripts_path/fetch "$rvm_url"
366
+ result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
365
367
  fi
366
368
  __rvm_run "extract" "tar zxf $rvm_archives_path/$rvm_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_package_file..."
367
369
  if [[ "$rvm_package_file" != "$rvm_ruby_string" ]] ; then
368
370
  mv "$rvm_src_path/$rvm_package_file" "$rvm_src_path/$rvm_ruby_string"
369
371
  fi
370
- cd "$rvm_ruby_src_path"
372
+ builtin cd "$rvm_ruby_src_path"
371
373
  fi
372
374
 
373
375
  mkdir -p "$rvm_ruby_home/bin/"
374
- cd "$rvm_ruby_src_path/tool/nailgun" && /usr/bin/make $rvm_make_flags
376
+ builtin cd "$rvm_ruby_src_path/tool/nailgun" && /usr/bin/make $rvm_make_flags
375
377
 
376
378
  __rvm_pushpop
377
379
 
@@ -419,21 +421,21 @@ RubyWrapper
419
421
  if [[ ! -d "$rvm_ruby_src_path" ]] || [[ ! -d "$rvm_ruby_src_path/.git" ]] ; then
420
422
  rm -rf $rvm_ruby_src_path
421
423
  __rvm_run "mput.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path" "Cloning $rvm_ruby_repo_url"
422
- cd $rvm_ruby_home
424
+ builtin cd $rvm_ruby_home
423
425
  else
424
- cd $rvm_ruby_home
426
+ builtin cd $rvm_ruby_home
425
427
  __rvm_run "mput.repo" "git pull origin trunk" "Pulling from origin trunk"
426
428
  fi
427
429
 
428
430
  if [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then
429
431
  rvm_autoconf="$(which autoconf)"
430
- if [[ $? -gt 0 ]] ; then __rvm_log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi
432
+ if [[ $? -gt 0 ]] ; then $rvm_scripts_path/log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi
431
433
  __rvm_run "autoconf" "$rvm_autoconf" "Running autoconf"
432
434
  # if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi # Don't barf on autoconf fail...
433
435
  fi
434
436
 
435
437
  if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
436
- __rvm_log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
438
+ (($rvm_debug_flag)) && $rvm_scripts_path/log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
437
439
  elif [[ ! -z "rvm_ruby_configure" ]] ; then
438
440
  $rvm_ruby_configure
439
441
  elif [[ -s ./configure ]] ; then
@@ -441,7 +443,7 @@ RubyWrapper
441
443
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
442
444
  unset configure_parameters
443
445
  else
444
- __rvm_log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
446
+ $rvm_scripts_path/log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
445
447
  fi
446
448
 
447
449
  rvm_ruby_make=${rvm_ruby_make:-"/usr/bin/make"}
@@ -452,7 +454,7 @@ RubyWrapper
452
454
  __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_package_name"
453
455
  if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
454
456
 
455
- __rvm_log "info" "Installation of $rvm_ruby_package_name is complete."
457
+ $rvm_scripts_path/log "info" "Installation of $rvm_ruby_package_name is complete."
456
458
 
457
459
  GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
458
460
  GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH
@@ -470,10 +472,10 @@ RubyWrapper
470
472
  ;;
471
473
 
472
474
  default)
473
- __rvm_log "fail" "must specify a ruby interpreter to install."
475
+ $rvm_scripts_path/log "fail" "must specify a ruby interpreter to install."
474
476
  ;;
475
477
 
476
- *) __rvm_log "fail" "Ruby interpreter '$rvm_ruby_interpreter' is not known."
478
+ *) $rvm_scripts_path/log "fail" "Ruby interpreter '$rvm_ruby_interpreter' is not known."
477
479
 
478
480
  esac
479
481
 
@@ -509,7 +511,7 @@ __rvm_manage_rubies() {
509
511
  fi
510
512
  done < <(\ls $rvm_path/*/bin/ruby 2> /dev/null)
511
513
  else
512
- __rvm_log "warn" 'Really? Install all? See "rvm list --all" and limit the selection to something more sane please :)'
514
+ $rvm_scripts_path/log "warn" 'Really? Install all? See "rvm list --all" and limit the selection to something more sane please :)'
513
515
  fi
514
516
  fi
515
517
  __rvm_state
@@ -525,10 +527,10 @@ __rvm_uninstall_ruby() {
525
527
  if [[ ! -z "$rvm_ruby_package_name" ]] ; then
526
528
  for dir in $rvm_path ; do
527
529
  if [[ -d $dir/$rvm_ruby_package_name ]] ; then
528
- __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..."
530
+ $rvm_scripts_path/log "info" "Removing $dir/$rvm_ruby_package_name..."
529
531
  rm -rf $dir/$rvm_ruby_package_name
530
532
  else
531
- __rvm_log "info" "$dir/$rvm_ruby_package_name has already been removed."
533
+ $rvm_scripts_path/log "info" "$dir/$rvm_ruby_package_name has already been removed."
532
534
  fi
533
535
  if [[ -e $rvm_bin_path/$rvm_ruby_package_name ]] ; then
534
536
  rm -f $rvm_bin_path/$rvm_ruby_package_name
@@ -536,7 +538,7 @@ __rvm_uninstall_ruby() {
536
538
  done ; unset dir
537
539
  rm -rf $rvm_gem_path/$rvm_ruby_interpreter/$rvm_ruby_version*/
538
540
  else
539
- __rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
541
+ $rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
540
542
  fi
541
543
  }
542
544
 
@@ -546,17 +548,17 @@ __rvm_remove_ruby() {
546
548
  if [[ ! -z "$rvm_ruby_string" ]] ; then
547
549
  for dir in $rvm_src_path $rvm_path ; do
548
550
  if [[ -d $dir/$rvm_ruby_string ]] ; then
549
- __rvm_log "info" "Removing $dir/$rvm_ruby_string..."
551
+ $rvm_scripts_path/log "info" "Removing $dir/$rvm_ruby_string..."
550
552
  rm -rf $dir/$rvm_ruby_package_name
551
553
  else
552
- __rvm_log "info" "it seems that $dir/$rvm_ruby_string is already non existent."
554
+ $rvm_scripts_path/log "info" "it seems that $dir/$rvm_ruby_string is already non existent."
553
555
  fi
554
556
  if [[ -e $rvm_bin_path/$rvm_ruby_string ]] ; then
555
557
  rm -f $rvm_bin_path/$rvm_ruby_string
556
558
  fi
557
559
  done ; unset dir
558
560
  else
559
- __rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
561
+ $rvm_scripts_path/log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
560
562
  fi
561
563
  }
562
564
 
@@ -575,13 +577,13 @@ __rvm_post_install() {
575
577
  fi
576
578
  done ; unset binary binaries
577
579
 
578
- __rvm_log "info" "Installing gems for $rvm_ruby_package_name."
580
+ $rvm_scripts_path/log "info" "Installing gems for $rvm_ruby_package_name."
579
581
 
580
582
  for rvm_gem_name in rake ; do
581
583
  __rvm_run "gems.install" "$rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q" "Installing $rvm_gem_name"
582
584
  done ; unset rvm_gem_name
583
585
 
584
- __rvm_log "info" "Installation of gems for $rvm_ruby_package_name is complete."
586
+ $rvm_scripts_path/log "info" "Installation of gems for $rvm_ruby_package_name is complete."
585
587
 
586
588
  binary=rake
587
589
  if [[ -x $rvm_ruby_gem_home/bin/$binary ]] ; then
@@ -604,27 +606,28 @@ __rvm_rubygems_setup() {
604
606
  __rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
605
607
 
606
608
  elif [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^rbx|jruby/')" ]] ; then
607
- __rvm_log "debug" "Skipping rubygems update for $rvm_ruby_version"
609
+ (($rvm_debug_flag)) && $rvm_scripts_path/log "debug" "Skipping rubygems update for $rvm_ruby_version"
608
610
  else
609
- __rvm_log "info" "Installing rubygems dedicated to $rvm_ruby_package_name..."
611
+ $rvm_scripts_path/log "info" "Installing rubygems dedicated to $rvm_ruby_package_name..."
610
612
  rvm_gem_package_name="rubygems-1.3.5"
611
613
  rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
612
614
 
613
615
  # Sanity check...
614
616
  if [[ ! -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then rm -rf "$rvm_src_path/$rvm_gem_package_name" ; fi
615
617
  if [[ ! -d "$rvm_src_path/$rvm_gem_package_name" ]] ; then
616
- __rvm_log "info" "Retrieving $rvm_gem_package_name"
617
- __rvm_fetch "$rvm_gem_url"
618
+ $rvm_scripts_path/log "info" "Retrieving $rvm_gem_package_name"
619
+ $rvm_scripts_path/fetch "$rvm_gem_url"
620
+ result=$? ; if [[ "$result" -gt 0 ]] ; then return $result ; fi
618
621
  mkdir -p "$rvm_src_path/$rvm_gem_package_name"
619
622
  __rvm_run "rubygems.extract" "tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_src_path" "Extracting $rvm_gem_package_name"
620
623
  fi
621
- cd "$rvm_src_path/$rvm_gem_package_name"
624
+ builtin cd "$rvm_src_path/$rvm_gem_package_name"
622
625
  __rvm_run "rubygems.install" "GEM_PATH=$rvm_gem_path GEM_HOME=$rvm_ruby_gem_home $rvm_ruby_home/bin/ruby $rvm_src_path/$rvm_gem_package_name/setup.rb" "Installing rubygems for $rvm_ruby_home/bin/ruby"
623
626
  result=$?
624
627
  if [[ $result -eq 0 ]] ; then
625
- __rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
628
+ $rvm_scripts_path/log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
626
629
  else
627
- __rvm_log "warning" "Installation of rubygems $rvm_ruby_package_name did not complete successfully."
630
+ $rvm_scripts_path/log "warning" "Installation of rubygems $rvm_ruby_package_name did not complete successfully."
628
631
  fi
629
632
  __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
630
633
  fi
@@ -664,11 +667,11 @@ __rvm_actual_file() {
664
667
  }
665
668
 
666
669
  __rvm_install_llvm() {
667
- cd "$rvm_src_path"
670
+ builtin cd "$rvm_src_path"
668
671
  if [[ ! -d "$rvm_src_path/llvm/.svn" ]] ; then
669
672
  rm -rf "$rvm_src_path/llvm"
670
673
  svn co -r 82747 https://llvm.org/svn/llvm-project/llvm/trunk llvm
671
- cd "$rvm_src_path/llvm"
674
+ builtin cd "$rvm_src_path/llvm"
672
675
  ./configure --enable-bindings=none
673
676
  UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make -j2
674
677
  sudo env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make install