scripts/manage in rvm-1.1.1 vs scripts/manage in rvm-1.1.2

- old
+ new

@@ -1039,10 +1039,129 @@ __rvm_run "gems.install" \ "PATH=\"$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:$rvm_ruby_home/bin:$PATH\" GEM_HOME=\"$rvm_ruby_gem_home\" GEM_PATH=\"$rvm_ruby_gem_home:$rvm_ruby_global_gems_path\" $rvm_ruby_home/bin/gem install --no-rdoc --no-ri rake $rvm_gem_options" \ "Installing $rvm_gem_name to $dir" ;; + goruby) + + if [[ ${rvm_make_flags_flag:-0} -eq 1 ]] ; then __rvm_make_flags ; fi + + unset GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC + + __rvm_remove_rvm_from_path + + __rvm_conditionally_add_bin_path ; export PATH + + builtin hash -r + + rvm_ruby_home="$rvm_path/rubies/$rvm_ruby_interpreter" + + __rvm_fetch_from_github "ruby" "trunk" + + __rvm_apply_patches ; result=$? + + if [[ "$result" -gt 0 ]] ; then + "$rvm_path/scripts/log" "error" \ + "There has been an error while trying to apply patches to goruby. \ + \nHalting the installation." + return $result + fi + + if [[ ! -s "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string/configure" ]] ; then + + if command -v autoconf &> /dev/null ; then + + __rvm_run "autoconf" "autoconf" "Running autoconf" + + else + "$rvm_path/scripts/log" "fail" \ + "rvm expects autoconf to install this ruby interpreter, autoconf was not found in PATH. \ + \nHalting installation." + return $result + fi + fi + + if [[ -s ./Makefile && -z "$rvm_reconfigure_flag" ]] ; then + + if [[ ${rvm_debug_flag:-0} -gt 0 ]] ; then + "$rvm_path/scripts/log" "debug" \ + "Skipping configure step, Makefile exists so configure must have already been run." + fi + + elif [[ -n "$rvm_ruby_configure" ]] ; then + + __rvm_run "configure" "$rvm_ruby_configure" + result=$? + + if [[ "$result" -gt 0 ]] ; then + "$rvm_path/scripts/log" "error" \ + "There has been an error while trying to configure the source. \ + \nHalting the installation." + return $result + fi + + elif [[ -s ./configure ]] ; then + local configure_command="./configure --prefix=$rvm_ruby_home $rvm_configure_flags" + + __rvm_run "configure" "$configure_command" \ + "Configuring $rvm_ruby_string using $rvm_configure_flags, this may take a while depending on your cpu(s)..." + result=$? + + if [[ "$result" -gt 0 ]] ; then + "$rvm_path/scripts/log" "error" \ + "There has been an error while trying to configure the source.\ + \nHalting the installation." + return $result + fi + + else + "$rvm_path/scripts/log" "error" \ + "Skipping configure step, 'configure' script does not exist, did autoconf not run successfully?" + fi + + rvm_ruby_make=${rvm_ruby_make:-"make"} + + __rvm_run "make" "$rvm_ruby_make golf $rvm_make_flags" \ + "Compiling $rvm_ruby_string, this may take a while depending on your cpu(s)..." + result=$? + + if [[ "$result" -gt 0 ]] ; then + "$rvm_path/scripts/log" "error" \ + "There has been an error while trying to run make.\ + \nHalting the installation." + return $result + fi + + rvm_ruby_make_install=${rvm_ruby_make_install:-"make install"} + + __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_string" + result=$? + + if [[ "$result" -gt 0 ]] ; then + "$rvm_path/scripts/log" "error" \ + "There has been an error while trying to run make install. \ + \nHalting the installation." + return $result + fi + + "$rvm_path/scripts/log" "info" \ + "Installation of $rvm_ruby_string is complete." + + export GEM_HOME="$rvm_ruby_gem_home" + export GEM_PATH="$rvm_ruby_gem_path" + + __rvm_rubygems_setup + + __rvm_bin_script + + __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*" + + __rvm_post_install + rm $rvm_ruby_home/bin/ruby + ln -s $rvm_ruby_home/bin/goruby $rvm_ruby_home/bin/ruby + ;; + ruby) __rvm_check_for_bison # && Run like hell... if [[ $? -gt 0 ]] ; then return $result ; fi @@ -1095,17 +1214,38 @@ "$rvm_path/scripts/log" "info" "Could not fetch $rvm_ruby_repo_url - trying $rvm_ruby_repo_http_url" __rvm_run "$1.repo" "git clone --depth 1 $rvm_ruby_repo_http_url ${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" "Cloning $rvm_ruby_repo_http_url" fi else - local branch="${2:-"master"}" + local branch="${rvm_ruby_repo_branch:-"master"}" builtin cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" __rvm_run "$1.repo" "git pull origin $branch" "Pulling from origin $branch" fi + ( + remote="origin" + + cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string" + + if [[ -z "$(git branch | awk "/$rvm_ruby_repo_branch$/")" ]] ; then + + git checkout -b "$rvm_ruby_repo_branch" --track "$remote/$rvm_ruby_repo_branch" 2>/dev/null + + elif [[ -z "$(git branch | awk "/\* $rvm_ruby_repo_branch$/")" ]] ; then + + if ! git checkout $rvm_ruby_repo_branch 2>/dev/null ; then + + "$rvm_path/scripts/log" "error" \ + "Branch $remote/$rvm_ruby_repo_branch not found." + + fi + + fi + ) + rm -rf "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" __rvm_run "$1.copy" "\\cp -R \"${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string\" \"${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string\"" "Copying from repo to source..." builtin cd "${rvm_src_path:-"$rvm_path/src"}/$rvm_ruby_string" @@ -1707,10 +1847,12 @@ __rvm_rubygems_setup() { local home path dir directory_name version_number ruby_lib_gem_path - if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.9/')" ]] ; then + if [[ -n "$(echo "$rvm_ruby_version" | awk '/^1\.9/')" \ + || -n "$(echo "$rvm_ruby_interpreter" | awk '/^goruby/')" ]] ; then + install=0 elif [[ "$rvm_ruby_string" = "ruby-head" ]] ; then install=0