scripts/manage in rvm-0.1.3 vs scripts/manage in rvm-0.1.5

- old
+ new

@@ -86,11 +86,11 @@ fi $rvm_scripts_path/log "info" "Installation of $rvm_ruby_string is complete." GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME - GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH + GEM_PATH="$rvm_ruby_gem_path" ; export GEM_PATH __rvm_rubygems_setup __rvm_bin_script __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*" __rvm_post_install @@ -125,11 +125,10 @@ $rvm_scripts_path/log "info" "Retrieving the latest nightly macruby build..." $rvm_scripts_path/fetch "$rvm_url" result=$? ; if [[ "$result" -gt 0 ]] ; then $rvm_scripts_path/log "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result fi - mv "$rvm_archives_path/macruby_nightly-latest.pkg" "$rvm_archives_path/macruby_nightly.pkg" __rvm_run "macruby/extract" "sudo installer -pkg '$rvm_archives_path/macruby_nightly.pkg' -target '/'" mkdir -p "$rvm_ruby_home/bin" fi @@ -138,13 +137,13 @@ # if [[ $binary_name != "gem" ]] ; then prefix="-S" ; fi ruby_wrapper=$(cat <<RubyWrapper #!/bin/bash GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME -GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH +GEM_PATH="$rvm_ruby_gem_path" ; export GEM_PATH MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME -PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" ; export PATH +PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_gem_home%global/bin:\$PATH" ; export PATH exec $macruby_path/mac$binary_name $prefix "\$@" RubyWrapper ) @@ -313,13 +312,13 @@ ruby_wrapper=$(cat <<RubyWrapper #!/usr/bin/env bash GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME -GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH +GEM_PATH="$rvm_ruby_gem_path" ; export GEM_PATH MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME -PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" ; export PATH +PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_gem_home%global/bin:\$PATH" ; export PATH exec $rvm_ruby_home/bin/rbx $prefix$binary_name "\$@" RubyWrapper ) for file_name in "$rvm_ruby_home/bin/$binary_name" "$rvm_bin_path/$binary_name-$rvm_ruby_string" ; do @@ -494,10 +493,11 @@ __rvm_fetch_ruby if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi builtin cd $rvm_ruby_src_path + # MONO_LIB=/Library/Frameworks/Mono.framework/Versions/current/lib/ rvm_ruby_make="rake MERLIN_ROOT=\"$rvm_ruby_src_path/Merlin/Main\" compile mono=1 configuration=release --trace" __rvm_run "rake" "$rvm_ruby_make" "Building IronRuby..." if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi rm -rf $rvm_ruby_home/* @@ -532,13 +532,13 @@ fi ruby_wrapper=$(cat <<RubyWrapper #!/bin/bash GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME -GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH +GEM_PATH="$rvm_ruby_gem_path" ; export GEM_PATH MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME -PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" ; export PATH +PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_gem_home%global/bin:\$PATH" ; export PATH exec mono $rvm_ruby_home/bin/ir.exe $binary_path "\$@" RubyWrapper ) files="$rvm_ruby_home/bin/$binary_name $rvm_bin_path/$binary_name-$rvm_ruby_string" @@ -611,11 +611,11 @@ fi $rvm_scripts_path/log "info" "Installation of $rvm_ruby_string is complete." GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME - GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH + GEM_PATH="$rvm_ruby_gem_path" ; export GEM_PATH __rvm_rubygems_setup __rvm_bin_script __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*" __rvm_post_install @@ -807,11 +807,14 @@ done ; unset binary binaries $rvm_scripts_path/log "info" "Installing gems for $rvm_ruby_string." for rvm_gem_name in rake ; do + home="$GEM_HOME" ; export GEM_HOME="$rvm_ruby_global_gems_path" + path="$GEM_PATH" ; export GEM_PATH="$rvm_ruby_global_gems_path" __rvm_run "gems.install" "$rvm_ruby_home/bin/gem install $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name" + export GEM_HOME="$home" ; export GEM_PATH="$path" ; unset home path done ; unset rvm_gem_name $rvm_scripts_path/log "info" "Installation of gems for $rvm_ruby_string is complete." binary=rake @@ -820,50 +823,77 @@ cp $rvm_ruby_gem_home/bin/$binary $rvm_ruby_home/bin/$binary fi __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary" __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary" fi ; unset binary + __rvm_irbrc } __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 + home="$GEM_HOME" ; export GEM_HOME="$rvm_ruby_global_gems_path" + path="$GEM_PATH" ; export GEM_PATH="$rvm_ruby_global_gems_path" __rvm_run "rubygems.update" "$rvm_ruby_home/bin/gem update --system" "Updating rubygems for $rvm_ruby_string" + export GEM_HOME="$home" ; export GEM_PATH="$path" ; unset home path + __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem" __rvm_inject_gem_env "$rvm_ruby_home/bin/gem" - + ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/1.$rvm_major_version" elif [[ ! -z "$(echo $rvm_ruby_interpreter | awk '/^rbx|jruby/')" ]] ; then (($rvm_debug_flag)) && $rvm_scripts_path/log "debug" "Skipping rubygems update for $rvm_ruby_version" + ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/jruby" else $rvm_scripts_path/log "info" "Installing rubygems dedicated to $rvm_ruby_string..." rvm_gem_package_name="rubygems-1.3.5" rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz" # 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 [[ ! -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_scripts_path/log "info" "Retrieving $rvm_gem_package_name" $rvm_scripts_path/fetch "$rvm_gem_url" result=$? ; if [[ "$result" -gt 0 ]] ; then $rvm_scripts_path/log "error" "There has been an error while trying to fetch the source. Aborting the installation." ; __rvm_pushpop ; return $result fi mkdir -p "$rvm_src_path/$rvm_gem_package_name" __rvm_run "rubygems.extract" "cat $rvm_archives_path/$rvm_gem_package_name.tgz | gunzip | tar xf - -C $rvm_src_path" "Extracting $rvm_gem_package_name ..." fi + builtin 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" + + __rvm_run "rubygems.install" "GEM_PATH=$rvm_ruby_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_scripts_path/log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully." else $rvm_scripts_path/log "warning" "Installation of rubygems $rvm_ruby_package_name did not complete successfully." fi + __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/gem" + + if [[ ! -z "$rvm_major_version" ]] ; then + ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/1.$rvm_major_version" + else + ruby_lib_gem_path="$rvm_ruby_home/lib/ruby/gems/$interpreter" + fi fi + + # Add ruby's gem path to ruby's lib direcotry. + mkdir -p $(dirname $ruby_lib_gem_path) + if [[ -d "$ruby_lib_gem_path" ]] ; then + rm -rf "$ruby_lib_gem_path" + fi + ln -nfs "$rvm_ruby_gem_home" "$ruby_lib_gem_path" + unset ruby_lib_gem_path + return $result } __rvm_inject_ruby_shebang() { __rvm_actual_file $1 @@ -876,12 +906,12 @@ __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']" + string="ENV['GEM_HOME']=ENV['GEM_HOME'] || '$rvm_ruby_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_ruby_gem_path'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:' + ENV['PATH']" 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" + string="GEM_HOME=\${GEM_HOME:-'$rvm_ruby_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_ruby_gem_path'}\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" unset string