scripts/ruby-installer in rvm-0.0.57 vs scripts/ruby-installer in rvm-0.0.58

- old
+ new

@@ -11,22 +11,22 @@ rm -rf "$rvm_ruby_home" "$rvm_ruby_src_path" fi result=0 if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_revision" ] ; then - if [ ! -f $rvm_archives_path/$rvm_ruby_package_name.tar.gz ] ; then + if [ ! -f "$rvm_archives_path/$rvm_ruby_package_name.tar.gz" ] ; then rvm_url="${rvm_url:-"ftp://ftp.ruby-lang.org/pub/ruby/1.$rvm_major_version/$rvm_ruby_package_name.tar.gz"}" __rvm_log "info" "Downloading $rvm_ruby_package_name, this may take a while depending on your connection..." __rvm_fetch "$rvm_url" if [ $? -gt 0 ] ; then result=$? ; return $result ; fi fi #mkdir -p "$rvm_ruby_src_path" # Is this line necessary considering -C below? v __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_name ..." if [ $? -gt 0 ] ; then result=$? ; return $result ; fi else __rvm_log "info" "Retrieving Ruby from $rvm_url" - if [ ! -z "`echo $rvm_url | awk '/^git/'`" ] ; then + if [ ! -z "$(echo $rvm_url | awk '/^git/')" ] ; then if [ -d "$rvm_ruby_src_path/.git" ] ; then cd $rvm_ruby_src_path if [ -z "$rvm_ruby_revision" ] ; then git pull origin master if [ $? -gt 0 ] ; then result=$? ; return $result ; fi @@ -42,11 +42,11 @@ if [ -z "$rvm_ruby_revision" ] ; then # TODO: Check if tag v is valid rvm_url="$rvm_ruby_repo_url/tags/$rvm_ruby_tag" rvm_rev="" else - if [ "$rvm_ruby_revision" = "head" -o "$rvm_ruby_revision" = "trunk" ] ; then + if [ "head" = "$rvm_ruby_revision" -o "trunk" = "$rvm_ruby_revision"] ; then rvm_url="$rvm_ruby_repo_url/trunk" rvm_rev="" else rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version} rvm_rev="-r $rvm_ruby_revision" @@ -69,23 +69,23 @@ cd $rvm_ruby_src_path 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 if [ ! -s "$rvm_ruby_src_path/configure" ] ; then - rvm_autoconf=`which autoconf` + rvm_autoconf="$(which autoconf)" if [ $? -gt 0 ] ; then __rvm_log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi __rvm_run "autoconf" "$rvm_autoconf" "Running autoconf" # if [ $? -gt 0 ] ; then result=$? ; return $result ; fi # Don't barf on autoconf fail... fi if [ -s ./Makefile -a -z "$rvm_reconfigure_flag" ] ; then __rvm_log "debug" "Skipping configure step, Makefile exists so configure must have already been run." elif [ -s ./configure ] ; then - if [ -d $rvm_path/usr/include/readline/ ] ; then + if [ -d "$rvm_path/usr/include/readline/" ] ; then configure_parameters="$configure_parameters --with-readline-dir=$rvm_path/usr/include/readline/" fi - if [ -d $rvm_path/usr/include/iconv/ ] ; then + if [ -d "$rvm_path/usr/include/iconv/" ] ; then configure_parameters="$configure_parameters --with-iconv-dir=$rvm_path/usr/include/iconv/" fi __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)..." if [ $? -gt 0 ] ; then result=$? ; return $result ; fi unset configure_parameters @@ -117,16 +117,16 @@ function __rvm_install_ruby { if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi if [ ! -z "$RUBYOPT" ] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi - if [ "`uname`" = "Darwin" ] ; then ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS ; fi + if [ "$(uname)" = "Darwin" ] ; then ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS ; fi case "$rvm_ruby_interpreter" in macruby) - if [ "`uname`" = "Darwin" ] ; then - rvm_url=`__rvm_db "macruby_nightly_url"` + if [ "$(uname)" = "Darwin" ] ; then + rvm_url="$(__rvm_db "macruby_nightly_url")" __rvm_log "info" "Retrieving latest macruby" # $rvm_archives_path/macruby_nightly.pkg __rvm_fetch $rvm_url mv $rvm_archives_path/latest $rvm_archives_path/macruby_nightly.pkg __rvm_run "macruby/extract" "xar -x -f $rvm_archives_path/macruby_nightly.pkg -C $rvm_ruby_home" "Extracting macruby nightly package." else @@ -171,17 +171,16 @@ __rvm_irbrc __rvm_bin_scripts __rvm_post_install __rvm_pushpop else - rvm_url=`__rvm_db "ree_${rvm_ruby_version}_repo_url"` + rvm_url="$(__rvm_db "ree_${rvm_ruby_version}_repo_url")" if [ -z "$rvm_url" ] ; then __rvm_log "fail" "rvm does not know the rvm repo url for 'ree_${rvm_ruby_version}'" result=1 else rvm_ruby_repo_url=$rvm_url - #rvm_ruby_configure="--enable-shared --enable-pthread $rvm_ruby_configure " __rvm_install_source $* fi fi ;; @@ -200,32 +199,32 @@ # For Installer, can do this once it's ready: RBX_PREFIX=$rvm_ruby_home ; export RBX_PREFIX # Also see 'rakelib/configuration.rake' - if [ ! -d $rvm_ruby_src_path -o ! -d $rvm_ruby_src_path/.git ] ; then + if [ ! -d "$rvm_ruby_src_path" -o ! -d "$rvm_ruby_src_path/.git" ] ; then rm -rf $rvm_ruby_src_path __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path" "Cloning $rvm_ruby_repo_url" cd $rvm_ruby_home else cd $rvm_ruby_home __rvm_run "rbx.repo" "git pull origin master" "Pulling from origin master" fi # prereqs, 1.8.6 w/ParseTree & rake. Yes this could all be one line... not pushing our luck. - echo `export rvm_install_on_use_flag=1 ; rvm 1.8.6` # This should install if missing. - echo `rvm 1.8.6 -m rbx ; gem install --no-rdoc --no-ri rake ParseTree` # This should install if missing. + echo "$(export rvm_install_on_use_flag=1 ; rvm 1.8.6)" # This should install if missing. + echo "$(rvm 1.8.6 -m rbx ; gem install --no-rdoc --no-ri rake ParseTree)" # This should install if missing. rvm_ruby_interpreter="rbx" __rvm_select if [ ! -z "$rvm_jit_flag" ]; then __rvm_run "configure" "./configure --prefix=$rvm_ruby_home --enable-llvm" "Configuring rbx with LLVM enabled" else __rvm_run "configure" "./configure --prefix=$rvm_ruby_home" "Configuring rbx" fi - __rvm_run "build" "\`rvm 1.8.6 -m rbx ; rake build\`" "Building rbx" + __rvm_run "build" "\$(rvm 1.8.6 -m rbx ; rake build)" "Building rbx" binaries="ruby irb" # Trick to work in more shells :) for binary_name in $(echo $binaries) ; do ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary_name done ; unset binary_name binaries @@ -327,19 +326,19 @@ __rvm_run "gems" "$rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q" "Installing $rvm_gem_name" done ; unset rvm_gem_name ;; ruby) - if [ "`uname`" = "Darwin" ] ; then - if [ "$(echo $rvm_ruby_version | awk '/1\.8/')" ] ; then - rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} " - else - rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} " - fi - else - rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared --enable-pthread"} " - fi + #if [ "$(uname)" = "Darwin" ] ; then + # if [ "$(echo $rvm_ruby_version | awk '/1\.8/')" ] ; then + # rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} " + # else + # rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} " + # fi + #else + # rvm_ruby_configure="${rvm_ruby_configure:-"--enable-pthread"} " + #fi __rvm_install_source $* ;; default) __rvm_log "fail" "must specify a ruby interpreter to install." @@ -358,11 +357,11 @@ # TODO: Extract the common functionality out of the if below if [ ! -z "$rvm_ruby_string" ] ; then unset rvm_ruby_interpreter rvm_ruby_version __rvm_${rvm_action}_ruby elif [ ! -z "$rvm_ruby_version" ] ;then - for rvm_ruby_selector in `echo $rvm_ruby_version | tr ',' ' '` ; do + for rvm_ruby_selector in $(echo $rvm_ruby_version | tr ',' ' ') ; do unset rvm_ruby_string __rvm_${rvm_action}_ruby __rvm_unset_ruby_variables done elif [ ! -z "$rvm_ruby_interpreter" ] ; then @@ -371,11 +370,11 @@ else # all if [ "$rvm_action" != "install" ] ; then while read bin_line do # Keep this on second line damnit! if [ -x $bin_line ] ; then - rvm_ruby_string="`dirname $bin_line | xargs dirname | xargs basename`" + rvm_ruby_string="$(dirname $bin_line | xargs dirname | xargs basename)" __rvm_${rvm_action}_ruby __rvm_unset_ruby_variables fi done < <(/bin/ls $rvm_path/*/bin/ruby 2> /dev/null) else @@ -462,20 +461,20 @@ __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary" fi ; unset binary } function __rvm_rubygems_setup { - if [ ! -z "`echo $rvm_ruby_version | awk '/^1\.9/'`" ] ; then + if [ ! -z "$(echo $rvm_ruby_version | awk '/^1\.9/')" ] ; 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 __rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "Updating rubygems for $rvm_ruby_string" __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 + 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" @@ -509,13 +508,13 @@ } function __rvm_inject_gem_env { __rvm_actual_file $1 if [ -f $actual_file ] ; then - if [ ! -z "`head -n 1 $actual_file | awk '/[j]*ruby/'`" ] ; 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 + elif [ ! -z "$(head -n 1 $actual_file | awk '/bash/')" ] ; then string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_home'}\nPATH=$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" fi if [ ! -z "$string" ] ; then awk "NR==2 {print \"$string\"} {print}" $actual_file > $actual_file.new mv $actual_file.new $actual_file ; chmod +x $actual_file @@ -524,10 +523,10 @@ fi ; unset actual_file } function __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. + actual_file="$(readlink $1)" # read the link target so we can preserve it. else actual_file="$1" fi }