scripts/ruby-installer in rvm-0.0.73 vs scripts/ruby-installer in rvm-0.0.74
- old
+ new
@@ -1,8 +1,8 @@
#!/bin/bash
-function __rvm_install_source {
+__rvm_install_source() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
__rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home"
mkdir -p "$rvm_ruby_log_path"
__rvm_pushpop "$rvm_src_path"
@@ -83,15 +83,15 @@
# if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi # Don't barf on autoconf fail...
fi
if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
__rvm_log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
- elif [[ ! -z "rvm_ruby_configure" ]] ; then
+ elif [[ ! -z "$rvm_ruby_configure" ]] ; then
__rvm_run "configure" "$rvm_ruby_configure"
if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
elif [[ -s ./configure ]] ; then
- __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure $configure_parameters" "Configuring $rvm_ruby_package_name, this may take a while depending on your cpu(s)..."
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_package_name, this may take a while depending on your cpu(s)..."
if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
unset configure_parameters
else
__rvm_log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
fi
@@ -114,11 +114,11 @@
__rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*"
__rvm_post_install
__rvm_pushpop
}
-function __rvm_install_ruby {
+__rvm_install_ruby() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
if [[ ! -z "$RUBYOPT" ]] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi
__rvm_make_flags
@@ -126,11 +126,11 @@
macruby)
if [[ "Darwin" = "$(uname)" ]] ; then
if [[ "$rvm_head_flag" = 1 ]] ; then
macruby_path="/usr/local/bin"
# TODO: configure & make variables should be set here.
- rvm_ruby_configure=""
+ rvm_ruby_configure=" true "
rvm_ruby_make="rake"
rvm_ruby_make_install="sudo rake install"
rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_repo_url")"
rvm_ruby_repo_url=$rvm_url
__rvm_install_source $*
@@ -191,12 +191,14 @@
fi
cd "$rvm_ruby_src_path"
mkdir -p "$rvm_ruby_log_path"
mkdir -p "${rvm_ruby_home}/lib/ruby/gems/1.8/gems"
- if [[ ! -z "$rvm_ruby_configure" ]] ; then rvm_ruby_configure="$(echo $rvm_ruby_configure | sed 's#--#-c --#g')"; fi
- __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" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..." # --no-tcmalloc
+ if [[ ! -z "$rvm_ruby_configure_flags" ]] ; then
+ rvm_ruby_configure_flags="$(echo $rvm_ruby_configure_flags | sed 's#--#-c --#g')"
+ fi
+ __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
if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
chmod +x $rvm_ruby_home/bin/*
__rvm_rubygems_setup
@@ -392,11 +394,11 @@
unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC
PATH=$(echo $PATH | tr ':' '\n' | awk '$0 !~ /rvm/' | paste -sd : -)
PATH=$rvm_bin_path:$PATH ; export PATH
rvm_ruby_repo_url=$rvm_shyouhei_repo_url
- rvm_ruby_configure=" "
+ unset rvm_ruby_configure
rvm_ruby_src_path=$rvm_ruby_home
# rvm_ruby_make="rake"
# rvm_ruby_make_install="rake install"
rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version"
# rvm_ruby_revision="head"
@@ -417,16 +419,16 @@
# if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi # Don't barf on autoconf fail...
fi
if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
__rvm_log "debug" "Skipping configure step, Makefile exists so configure must have already been run."
+ elif [[ ! -z "rvm_ruby_configure" ]] ; then
+ $rvm_ruby_configure
elif [[ -s ./configure ]] ; then
- __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure $configure_parameters" "Configuring $rvm_ruby_package_name using $rvm_ruby_configure, this may take a while depending on your cpu(s)..."
+ __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure_flags $configure_parameters" "Configuring $rvm_ruby_package_name using $rvm_ruby_configure_flags, this may take a while depending on your cpu(s)..."
if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
unset configure_parameters
- elif [[ ! -z "rvm_ruby_configure" ]] ; then
- $rvm_ruby_configure
else
__rvm_log "error" "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?"
fi
rvm_ruby_make=${rvm_ruby_make:-"/usr/bin/make"}
@@ -462,11 +464,11 @@
esac
if [[ ! -z "$ruby_options" ]] ; then RUBYOPT=$ruby_options ; export RUBYOPT ; fi
}
-function __rvm_manage_rubies {
+__rvm_manage_rubies() {
__rvm_state
rubies=() ; successes=() ; errors=() ; statuses=()
unset rvm_gem_set_name
rvm_ruby_gem_home=$(echo $rvm_ruby_gem_home | awk -F'%' '{print $1}')
rvm_ruby_string=$(echo $rvm_ruby_string | awk -F'%' '{print $1}')
@@ -501,11 +503,11 @@
if [[ ! -z "$rvm_summary_flag" ]] ; then __rvm_summary ; fi
if [[ ! -z "$rvm_yaml_flag" ]] ; then __rvm_yaml ; fi
if [[ ! -z "$rvm_json_flag" ]] ; then __rvm_json ; fi
}
-function __rvm_uninstall_ruby {
+__rvm_uninstall_ruby() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select $* ; fi
if [[ ! -z "$rvm_ruby_package_name" ]] ; then
for dir in $rvm_path ; do
if [[ -d $dir/$rvm_ruby_package_name ]] ; then
@@ -522,11 +524,11 @@
else
__rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
fi
}
-function __rvm_remove_ruby {
+__rvm_remove_ruby() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
if [[ ! -z "$rvm_ruby_string" ]] ; then
for dir in $rvm_src_path $rvm_path ; do
if [[ -d $dir/$rvm_ruby_string ]] ; then
@@ -542,11 +544,11 @@
else
__rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'"
fi
}
-function __rvm_post_install {
+__rvm_post_install() {
binaries="${binaries:-"gem irb erb ri rdoc testrb rake"}"
for binary in $(echo $binaries) ; do
if [[ -e "$rvm_ruby_home/bin/$binary" ]] || [[ -e "$rvm_ruby_src_path/bin/$binary" ]] ; then
if [[ "$rvm_ruby_src_path" != "$rvm_ruby_home" ]] && [[ -f "$rvm_ruby_src_path/bin/$binary" ]] ; then
cp -f "$rvm_ruby_src_path/bin/$binary" "$rvm_ruby_home/bin/$binary"
@@ -575,11 +577,11 @@
__rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary"
__rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
fi ; unset binary
}
-function __rvm_rubygems_setup {
+__rvm_rubygems_setup() {
if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.9/')" ]] || [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^mput/')" ]] ; then
# 1.9 has it's own built-in gem command
__rvm_inject_ruby_shebang "$rvm_ruby_src_path/bin/gem"
__rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
cp $rvm_ruby_src_path/bin/gem $rvm_ruby_home/bin/gem
@@ -587,24 +589,24 @@
__rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
__rvm_inject_gem_env "$rvm_ruby_home/bin/gem"
elif [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^rbx|jruby/')" ]] ; then
__rvm_log "debug" "Skipping rubygems update for $rvm_ruby_version"
-
else
__rvm_log "info" "Installing rubygems dedicated to $rvm_ruby_package_name..."
rvm_gem_package_name="rubygems-1.3.5"
rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz"
- if [[ -d "$rvm_src_path/$rvm_gem_package_name" ]] && [[ -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then
- cd "$rvm_src_path/$rvm_gem_package_name"
- else
- rm -rf "$rvm_src_path/$rvm_gem_package_name"
+
+ # Sanity check...
+ if [[ ! -f "$rvm_src_path/$rvm_gem_package_name/setup.rb" ]]; then rm -rf "$rvm_src_path/$rvm_gem_package_name" ; fi
+ if [[ ! -d "$rvm_src_path/$rvm_gem_package_name" ]] ; then
__rvm_log "info" "Retrieving $rvm_gem_package_name"
__rvm_fetch "$rvm_gem_url"
mkdir -p "$rvm_src_path/$rvm_gem_package_name"
__rvm_run "rubygems.extract" "tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_src_path" "Extracting $rvm_gem_package_name"
fi
+ cd "$rvm_src_path/$rvm_gem_package_name"
__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"
result=$?
if [[ $result -eq 0 ]] ; then
__rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully."
else
@@ -613,19 +615,19 @@
__rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem"
fi
return $result
}
-function __rvm_inject_ruby_shebang {
+__rvm_inject_ruby_shebang() {
__rvm_actual_file $1
if [[ -f "$actual_file" ]] ; then
sed -i.orig -e "s=env [j]*ruby=env $rvm_ruby_home/bin/ruby=" $actual_file
rm -f $actual_file.orig ; chmod +x "$actual_file"
fi ; unset actual_file
}
-function __rvm_inject_gem_env {
+__rvm_inject_gem_env() {
__rvm_actual_file $1
if [[ -f "$actual_file" ]] ; then
if [[ ! -z "$(head -n 1 $actual_file | awk '/[j]*ruby/')" ]] ; then
string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_ruby_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_ruby_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:' + ENV['PATH']"
elif [[ ! -z "$(head -n 1 $actual_file | awk '/bash/')" ]] ; then
@@ -637,10 +639,10 @@
unset string
fi
fi ; unset actual_file
}
-function __rvm_actual_file {
+__rvm_actual_file() {
if [[ -L $1 ]] ; then # If the file is a symlink,
actual_file="$(readlink $1)" # read the link target so we can preserve it.
else
actual_file="$1"
fi