scripts/rvm-ruby-installer in rvm-0.0.40 vs scripts/rvm-ruby-installer in rvm-0.0.41

- old
+ new

@@ -2,47 +2,47 @@ function __rvm_install-source { if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi - status=0 + result=0 __rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home" mkdir -p $rvm_ruby_log_path pushd $rvm_source_path > /dev/null - if [ ! -z "$rvm_force" ] ; then + if [ ! -z "$rvm_force_flag" ] ; then rm -rf $rvm_ruby_home rm -rf $rvm_ruby_src_path fi if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_rev" ] ; then if [ ! -d $rvm_ruby_src_path ] ; 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" "\tDownloading $rvm_ruby_package_name, this may take a while depending on your connection..." __rvm_fetch $rvm_url - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi __rvm_log "info" "\tExtracting $rvm_ruby_package_name ..." 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_source_path - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi fi else __rvm_log "info" "\tRetrieving Ruby from $rvm_url" if [ ! -z "`echo $rvm_url | grep '^git'`" ] ; then if [ -d "$rvm_ruby_src_path/.git" ] ; then cd $rvm_ruby_src_path if [ -z "$rvm_ruby_rev" ] ; then git pull origin master - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi else git checkout ${rvm_ruby_rev:-HEAD} - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi fi else git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi fi else if [ -z "$rvm_ruby_rev" ] ; then # TODO: Check if tag v is valid rvm_url=$rvm_ruby_repo_url/tags/$rvm_ruby_tag @@ -65,68 +65,65 @@ svn checkout -q $rvm_rev fi else svn checkout -q $rvm_rev --force $rvm_url $rvm_ruby_src_path fi - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi fi fi cd $rvm_ruby_src_path - if [ $? -gt 0 ] ; then status=$? ; __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd > /dev/null ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; __rvm_log "error" "There was an error, please check $rvm_ruby_log_path/*.error.log" ; popd > /dev/null ; return $result ; fi - # Readline - if [ ! -d $rvm_path/usr/include/readline ] ; then __rvm_readline_install ; fi - if [ ! -s "$rvm_ruby_src_path/configure" -a "$rvm_ruby_interpreter" = "ruby" ] ; then rvm_autoconf=`which autoconf` - if [ $? -gt 0 ] ; then __rvm_log "fail" "rvm expects autoconf" ; status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then __rvm_log "fail" "rvm expects autoconf" ; result=$? ; return $result ; fi __rvm_run "autoconf" $rvm_autoconf - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi fi - if [ -s ./Makefile -a -z "$rvm_re_configure" ] ; then + if [ -s ./Makefile -a -z "$rvm_reconfigure_flag" ] ; then __rvm_log "warn" "\tSkipping configure step, Makefile exists so configure must have already been run." elif [ -s ./configure ] ; then __rvm_log "info" "\tConfiguring $rvm_ruby_package_name using $rvm_ruby_configure, this may take a while depending on your cpu(s)..." if [ -d $rvm_path/usr/include/readline/ ] ; then - parameters="$parameters --with-readline-dir=$rvm_path/usr/include/readline/" + configure_parameters="$configure_parameters --with-readline-dir=$rvm_path/usr/include/readline/" fi if [ -d $rvm_path/usr/include/iconv/ ] ; then - parameters="$parameters --with-iconv-dir=$rvm_path/usr/include/iconv/" + configure_parameters="$configure_parameters --with-iconv-dir=$rvm_path/usr/include/iconv/" fi - __rvm_run "configure" "./configure --prefix=$rvm_ruby_home --enable-shared=true $rvm_ruby_configure $parameters" - unset parameters - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + __rvm_run "configure" "./configure --prefix=$rvm_ruby_home $rvm_ruby_configure $configure_parameters" + unset configure_parameters + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi else __rvm_log "error" "\tSkipping configure step, 'configure' script does not exist, did autoconf not run successfully?" fi __rvm_log "info" "\tCompiling $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..." if [ -z "$rvm_ruby_make" ] ; then __rvm_run "make" make $rvm_make_flags else __rvm_run "make" $rvm_ruby_make fi - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi if [ -z "$rvm_ruby_make" ] ; then __rvm_log "info" "\tInstalling $rvm_ruby_package_name" __rvm_run "install" make install else __rvm_run "install" $rvm_ruby_make_install fi - if [ $? -gt 0 ] ; then status=$? ; return $status ; fi + if [ $? -gt 0 ] ; then result=$? ; return $result ; fi - __rvm_run "chmod.bin" chmod +x $rvm_ruby_home/bin/* - __rvm_bin_script __rvm_log "info" "Installation of $rvm_ruby_package_name is complete." GEM_HOME="$rvm_gem_home" ; export GEM_HOME GEM_PATH="$rvm_gem_home" ; export GEM_PATH __rvm_rubygems_setup + __rvm_bin_script + __rvm_run "chmod.bin" chmod +x $rvm_ruby_home/bin/* popd > /dev/null __rvm_post_install } @@ -193,12 +190,12 @@ cd $rvm_ruby_src_path if [ ! -z "$rvm_ruby_configure" ] ; then rvm_ruby_configure="-c $rvm_ruby_configure"; fi __rvm_run "install" ./installer -a $rvm_path/ruby-enterprise-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc $rvm_ruby_configure chmod +x $rvm_ruby_home/bin/* - __rvm_bin_script __rvm_rubygems_setup + __rvm_bin_script popd > /dev/null for rvm_gem_name in rake ; do __rvm_log "info" "Installing $rvm_gem_name" @@ -217,21 +214,24 @@ rvm_ruby_make_install="rake install" rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version" #rvm_ruby_rev="head" # TODO: Check if already git repo, then git pull origin master && build - __rvm_bin_script - if [ ! -d $rvm_ruby_home -o ! -d $rvm_ruby_home/.git ] ; then rm -rf $rvm_ruby_home git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_home fi cd $rvm_ruby_home - __rvm_run "build" $rvm_rubinius_jit rake build + if [ ! -z "$rvm_jit_flag" ]; then + __rvm_run "build" RBX_LLVM=1 rake build + else + __rvm_run "build" rake build + fi for binary in ruby irb ; do ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary done + __rvm_bin_script ;; jruby) rvm_package_file="$rvm_ruby_interpreter-bin-$rvm_ruby_version" rvm_url="http://dist.codehaus.org/$rvm_ruby_interpreter/$rvm_ruby_version/$rvm_package_file.zip" @@ -271,14 +271,16 @@ chmod +x $rvm_ruby_home/bin/* for binary in jruby jgem jirb ; do ln -fs $rvm_ruby_home/bin/$binary $rvm_ruby_home/bin/${binary#j} done + __rvm_bin_script + ln -fs $rvm_ruby_home/bin/ruby $rvm_path/bin/$rvm_ruby_package_name for rvm_gem_name in rake jruby-openssl ; do __rvm_log "info" "Installing $rvm_gem_name" - __rvm_run "gems" $rvm_ruby_home/bin/jgem install $rvm_gem_name --no-rdoc --no-ri -q + __rvm_run "gems" $rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q done ;; ruby) if [ -z "rvm_ruby_configure" ] ; then rvm_ruby_configure="--enable-shared=true --enable-pthread=true " ; fi @@ -346,13 +348,13 @@ done __rvm_log "info" "Installation of gems for $rvm_ruby_package_name is complete." binary=rake - if [ -x $rvm_ruby_src_path/bin/$binary ] ; then - if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" ] ; then - cp $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary + if [ -x $rvm_gem_home/bin/$binary ] ; then + if [ "$rvm_gem_home" != "$rvm_ruby_home" ] ; then + cp $rvm_gem_home/bin/$binary $rvm_ruby_home/bin/$binary fi # TODO: Account for rubygem installed rake vs system rake string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_gem_home/bin:' + ENV['PATH']" awk "NR==2 {print \"$string\"} {print}" $rvm_ruby_home/bin/$binary > $rvm_ruby_home/bin/$binary.new mv $rvm_ruby_home/bin/$binary.new $rvm_ruby_home/bin/$binary @@ -374,26 +376,21 @@ else __rvm_fetch $rvm_gem_url mkdir -p $rvm_source_path/$rvm_gem_package_name __rvm_run "rubygems.extract" tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_source_path fi - # Well this is fun... fix nil error on require_paths: - # Q: Is this necessary any longer? - #sed -i.orig "s/require_paths\.join/require_paths.to_a.join/" $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb - #rm -f $rvm_source_path/$rvm_gem_package_name/lib/rubygems/gem_path_searcher.rb.orig - __rvm_run "rubygems.install" GEM_HOME=$rvm_gem_path GEM_HOME=$rvm_gem_home $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb - status=$? - if [ $status -eq 0 ] ; then + __rvm_run "rubygems.install" GEM_PATH=$rvm_gem_path GEM_HOME=$rvm_gem_home $rvm_ruby_home/bin/ruby $rvm_source_path/$rvm_gem_package_name/setup.rb + result=$? + if [ $result -eq 0 ] ; then __rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully." fi - if [ $status -eq 0 ] ; then status=$? ; fi else # 1.9 has it's own built gem command, let's adjust the shebang line. mv $rvm_ruby_src_path/bin/gem $rvm_ruby_src_path/bin/gem.orig cat $rvm_ruby_src_path/bin/gem.orig | sed -e "s=!# */usr/bin/env ruby=!#/usr/bin/$rvm_ruby_home/bin/ruby=" > $rvm_ruby_src_path/bin/gem chmod +x $rvm_ruby_home/bin/gem __rvm_run "rubygems.update" $rvm_ruby_home/bin/gem update --system fi - return $status + return $result }