scripts/ruby-installer in rvm-0.0.71 vs scripts/ruby-installer in rvm-0.0.72

- old
+ new

@@ -43,22 +43,20 @@ __rvm_log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..." git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi fi else - if [[ -z "$rvm_ruby_revision" ]] ; then + if [[ ! -z "$rvm_head_flag" ]] || [[ "trunk" = "$rvm_ruby_revision" ]] ; then + rvm_url="$rvm_ruby_repo_url/trunk" + rvm_rev="" + elif [[ ! -z "$rvm_ruby_tag" ]] ; then # TODO: Check if tag v is valid rvm_url="$rvm_ruby_repo_url/tags/$rvm_ruby_tag" rvm_rev="" else - if [[ "head" = "$rvm_ruby_revision" ]] || [[ "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="-$rvm_ruby_revision" - fi + rvm_url=$rvm_ruby_repo_url/branches/ruby_1_${rvm_major_version}_${rvm_minor_version} + rvm_rev="-$rvm_ruby_revision" fi if [[ -d "$rvm_ruby_src_path/.svn" ]] ; then cd $rvm_ruby_src_path __rvm_log "info" "Updating ruby from $rvm_url" @@ -85,16 +83,17 @@ # 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_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 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 $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 - 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"} @@ -124,38 +123,28 @@ __rvm_make_flags case "$rvm_ruby_interpreter" in macruby) if [[ "Darwin" = "$(uname)" ]] ; then - if [[ "nightly" = "$rvm_ruby_version" ]] ; 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_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 $* + else # if [[ "nightly" = "$rvm_ruby_version" ]] ; then + macruby_path="/usr/local/bin" # TODO: Separated nightly from head. rvm_url="$(__rvm_db "macruby_nightly_url")" __rvm_log "info" "Retrieving the latest nightly macruby build..." - __rvm_fetch $rvm_url + __rvm_fetch "$rvm_url" mv "$rvm_archives_path/latest" "$rvm_archives_path/macruby_nightly.pkg" __rvm_run "macruby/extract" "sudo installer -pkg '$rvm_path/archives/macruby_nightly.pkg' -target '/'" mkdir -p "$rvm_ruby_home/bin" - elif [[ "head" = "$rvm_ruby_version" ]] ; then - # TODO: configure & make variables should be set here. - rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_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_install_source $* - fi - else - macruby_path="/usr/local/bin" - # TODO: Separated nightly from head. - 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" "sudo installer -pkg '$rvm_path/archives/$rvm_ruby_package_file.zip' -target '/'" - mkdir -p "$rvm_ruby_home/bin" fi binaries="erb gem irb rake rdoc ri ruby testrb" # Trick to work in more shells :) for binary_name in $(echo $binaries); do # if [[ $binary_name != "gem" ]] ; then prefix="-S" ; fi @@ -183,11 +172,10 @@ __rvm_log "fail" "MacRuby can only be installed on a Darwin OS." fi ;; ree) - __rvm_make_flags if [[ ! -z "$(echo $rvm_ruby_version | awk '/^1\.8/')" ]] && [[ -z "$rvm_head_flag" ]] ; then rvm_url="$(__rvm_db "ree_${rvm_ruby_version}_url")/$rvm_ruby_package_file.tar.gz" __rvm_log "info" "Installing Ruby Enterprise Edition from source to: $rvm_ruby_home" __rvm_pushpop "$rvm_src_path" if [[ -z "$rvm_force_flag" ]] && [[ -d "$rvm_ruby_src_path" ]] && [[ ! -x "$rvm_ruby_src_path/installer" ]] ; then @@ -203,11 +191,11 @@ 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="-c $rvm_ruby_configure"; fi + 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 [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi chmod +x $rvm_ruby_home/bin/* __rvm_rubygems_setup @@ -325,18 +313,38 @@ __rvm_irbrc __rvm_bin_scripts ;; jruby) - mkdir -p $rvm_ruby_log_path + mkdir -p "$rvm_ruby_log_path" "$rvm_ruby_src_path" __rvm_pushpop $rvm_src_path - if [[ ! -z "$rvm_ruby_revision" ]] ; then - if [[ ! -d "$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version" ]] || [[ ! -d "$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version/.git" ]] ; then - git clone --depth 1 $rvm_jruby_repo_url $rvm_ruby_src_path - cd $rvm_ruby_src_path && ant # TODO: Test if 'ant' is installed, if not throw error. + if [[ "$rvm_head_flag" -eq 1 ]] || [[ ! -z "$rvm_ruby_revision" ]] ; then + if [[ -d "$rvm_ruby_src_path/.git" ]] ; then + cd "$rvm_ruby_src_path" + if [[ -z "$rvm_ruby_revision" ]] ; then + __rvm_log "info" "Pulling from $rvm_ruby_repo_url, this may take a while depending on your connection..." + git pull origin master + if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi + else + if [[ -z "$rvm_ruby_sha" ]] ; then + git checkout HEAD + else + git checkout $(echo $rvm_ruby_sha | sed 's#^s##') + fi + if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi + fi + else + rm -rf "$rvm_ruby_src_path" + __rvm_log "info" "Cloning from $rvm_ruby_repo_url, this may take a while depending on your connection..." + git clone --depth 1 "$rvm_ruby_repo_url" "$rvm_ruby_src_path" + if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi fi + + cd "$rvm_ruby_src_path" + ant dist + else if [[ -d $rvm_ruby_src_path ]] ; then cd $rvm_ruby_src_path else if [[ -z "$rvm_force_flag" ]] && [[ -f $rvm_package_file ]] && [[ -s $rvm_package_file ]] ; then @@ -485,10 +493,10 @@ if [[ -x "$bin_line" ]] ; then rvm_ruby_string="$(dirname "$bin_line" | xargs dirname | xargs basename)" eval "__rvm_${rvm_action}_ruby" __rvm_unset_ruby_variables fi - done < <(/bin/ls $rvm_path/*/bin/ruby 2> /dev/null) + done < <(\ls $rvm_path/*/bin/ruby 2> /dev/null) else __rvm_log "warn" 'Really? Install all? See "rvm list --all" and limit the selection to something more sane please :)' fi fi __rvm_state