scripts/manage in rvm-0.1.27 vs scripts/manage in rvm-0.1.29

- old
+ new

@@ -30,11 +30,11 @@ fi if [[ -d "${rvm_path}/usr" ]] ; then export PATH="${rvm_path}/usr/bin:${PATH}" ; fi if [[ -z "$rvm_ruby_configure" ]] && [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then - if which autoconf &> /dev/null ; then + if command -v autoconf > /dev/null ; then __rvm_run "autoconf" "autoconf" "Running autoconf" else result=$? ; $rvm_scripts_path/log "fail" "rvm requires autoconf to install the selected ruby interpreter however autoconf was not found in the PATH." ; return $result fi fi @@ -139,20 +139,20 @@ fi mv "$rvm_archives_path/macruby_nightly-latest.pkg" "$rvm_archives_path/macruby_nightly.pkg" __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '$rvm_archives_path/macruby_nightly.pkg' -target '/'" mkdir -p "$rvm_ruby_home/bin" else - macruby_path="/Library/Frameworks/MacRuby.framework/Versions/0.5/usr/bin" + macruby_path="/Library/Frameworks/MacRuby.framework/Versions/${rvm_ruby_version}/usr/bin" # TODO: Separated nightly from head. - $rvm_scripts_path/log "info" "Retrieving MacRuby 0.5 ..." + $rvm_scripts_path/log "info" "Retrieving MacRuby ${rvm_ruby_version} ..." $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 mkdir -p $rvm_ruby_src_path - unzip -o -j "$rvm_archives_path/$rvm_ruby_package_file" "MacRuby 0.5/MacRuby 0.5.pkg" -d "$rvm_ruby_src_path" - mv "$rvm_ruby_src_path/MacRuby 0.5.pkg" "$rvm_ruby_src_path/$rvm_ruby_string.pkg" + unzip -o -j "$rvm_archives_path/$rvm_ruby_package_file" "MacRuby ${rvm_ruby_version}/MacRuby ${rvm_ruby_version}.pkg" -d "$rvm_ruby_src_path" + mv "$rvm_ruby_src_path/MacRuby ${rvm_ruby_version}.pkg" "$rvm_ruby_src_path/$rvm_ruby_string.pkg" __rvm_run "macruby/extract" "sudo /usr/sbin/installer -pkg '$rvm_ruby_src_path/$rvm_ruby_string.pkg' -target '/'" mkdir -p "$rvm_ruby_home/bin" fi binaries=(erb gem irb rake rdoc ri ruby testrb) @@ -218,11 +218,12 @@ if [[ "Darwin" = "$(uname)" ]] && [[ "1.8.6" = "$rvm_ruby_version" ]] && [[ -z "$rvm_ree_options" ]] ; then rvm_ree_options="${rvm_ree_options} --no-tcmalloc" fi - __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level $rvm_ree_options --dont-install-useful-gems $rvm_ruby_configure_flags" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..." + + __rvm_run "install" "./installer -a $rvm_rubies_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level $rvm_ree_options --dont-install-useful-gems $rvm_ruby_configure_flags --no-dev-docs" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..." result=$? ; if [[ "$result" -gt 0 ]] ; then $rvm_scripts_path/log "error" "There has been an error while trying to run the ree installer. Aborting the installation." ; __rvm_pushpop ; return $result fi chmod +x $rvm_ruby_home/bin/* @@ -330,22 +331,11 @@ done ; unset binary_name binaries for binary_name in "gem" ; do if [[ $binary_name != "gem" ]] ; then prefix="-S " ; else unset prefix; fi - ruby_wrapper=$(cat <<RubyWrapper -#!/usr/bin/env bash - -export GEM_HOME="$rvm_ruby_gem_home" -export GEM_PATH="$rvm_ruby_gem_path" -export BUNDLE_PATH="$rvm_ruby_gem_home" -export MY_RUBY_HOME="$rvm_ruby_home" -export PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:$rvm_ruby_global_gems_path/bin:\$PATH" - -exec $rvm_ruby_home/bin/rbx $prefix$binary_name "\$@" -RubyWrapper -) + ruby_wrapper=$(echo -e "#!/usr/bin/env bash\nexec $rvm_ruby_home/bin/rbx $prefix$binary_name \"\$@\"") for file_name in "$rvm_ruby_home/bin/$binary_name" "$rvm_bin_path/$binary_name-$rvm_ruby_string" ; do rm -f $file_name echo "$ruby_wrapper" > $file_name if [[ -f $file_name ]] ; then chmod +x $file_name ; fi done @@ -358,11 +348,11 @@ __rvm_irbrc __rvm_bin_script ;; jruby) - if ! which java &> /dev/null ; then + if ! command -v java > /dev/null; then echo -e "java must be installed and in your path in order to install JRuby." ; return 1 fi __rvm_pushpop $rvm_src_path __rvm_fetch_ruby @@ -381,19 +371,24 @@ fi __rvm_pushpop if [[ -z "$rvm_ruby_home" ]] || [[ "$rvm_ruby_home" = "/" ]] ; then echo "WTH?!?! rvm_ruby_home == / ??? not removing." ; return 1000000 ; fi + rm -rf $rvm_ruby_home __rvm_run "install" "/bin/cp -Rf $rvm_ruby_src_path $rvm_ruby_home" "Installing JRuby to $rvm_ruby_home" __rvm_pushpop $rvm_ruby_home/bin/ for binary in jirb jruby jgem ; do ln -nfs $binary ${binary#j} done ; unset binary __rvm_pushpop + sed -e 's#^JAVA_VM=-client#JAVA_VM=-server#' $rvm_ruby_home/bin/jruby > $rvm_ruby_home/bin/jruby.new && + mv $rvm_ruby_home/bin/jruby.new $rvm_ruby_home/bin/jruby + chmod +x $rvm_ruby_home/bin/jruby + for binary in jrubyc jirb_swing jirb jgem rdoc ri spec autospec testrb ast generate_yaml_index.rb ; do __rvm_inject_gem_env $rvm_ruby_home/bin/$binary done ; unset binary __rvm_rubygems_setup @@ -495,11 +490,11 @@ __rvm_bin_script __rvm_use ;; ironruby|ir) - if ! which mono &> /dev/null ; then + if ! command -v mono > /dev/null ; then echo -e "mono must be installed and in your path in order to install IronRuby." ; return 1 fi if [[ "$rvm_head_flag" = 1 ]] ; then mono_version="$(mono -V | head -n 1 | cut -d ' ' -f5)" @@ -516,50 +511,64 @@ return 1 fi __rvm_fetch_ruby if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi + builtin cd $rvm_ruby_src_path + + $rvm_bin_path/rvm 1.8.7 -S gem install pathname2 --no-rdoc --no-ri + + # MONO_LIB=/Library/Frameworks/Mono.framework/Versions/current/lib/ + rvm_ruby_make="$rvm_bin_path/rvm 1.8.7 -S 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/* + mkdir -p $rvm_ruby_home/bin $rvm_ruby_home/lib $rvm_ruby_home/lib/ruby $rvm_ruby_home/lib/IronRuby + + cp -r $rvm_ruby_src_path/Merlin/Main/Bin/mono_release/* $rvm_ruby_home/bin/ + cp -r $rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Scripts/bin/* $rvm_ruby_home/bin/ + cp -r $rvm_ruby_src_path/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/* $rvm_ruby_home/lib/ruby + cp -r $rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Libs/* $rvm_ruby_home/lib/IronRuby else $rvm_scripts_path/log "info" "Retrieving IronRuby" + $rvm_scripts_path/fetch "$rvm_url" "$rvm_ruby_package_file" 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 - __rvm_run "extract" "tar zxf $rvm_archives_path/$rvm_ruby_package_file -C $rvm_src_path" "Extracting $rvm_ruby_package_file ..." - result=$? ; if [[ "$result" -gt 0 ]] ; then - $rvm_scripts_path/log "error" "There has been an error while trying to extract the source. Aborting the installation." ; __rvm_pushpop ; return $result + mkdir -p $rvm_ruby_src_path $rvm_ruby_home + unzip -o -d ${rvm_ruby_src_path} ${rvm_archives_path}/${rvm_ruby_package_file} >> "$rvm_ruby_log_path/extract.log" 2>> "$rvm_ruby_log_path/extract.error.log" + result=$? ; if [[ "$result" -gt 1 ]] ; then + $rvm_scripts_path/log "error" "There has been an error while trying to extract $rvm_ruby_package_file. Aborting the installation." ; __rvm_pushpop ; return $result fi - rm -rf $rvm_ruby_src_path - mv $rvm_src_path/$rvm_ruby_package_name $rvm_ruby_src_path - - #mv $rvm_ruby_home/ironruby/* $rvm_ruby_home - #rm -rf $rvm_ruby_home/ironruby - #mv $rvm_ruby_src_path/$rvm_ruby_package_file/* $rvm_ruby_home - #mv $rvm_ruby_home/lib/ironruby $rvm_ruby_home/lib/IronRuby + for dir in bin lib silverlight ; do + cp -Rf $rvm_src_path/$rvm_ruby_string/$dir "$rvm_ruby_home/$dir" + done fi - builtin cd $rvm_ruby_src_path + binaries=(gem irb rdoc rake ri ruby) + for binary_name in ${binaries[@]} ; do + if [[ -s $rvm_ruby_home/bin/$binary_name ]] ; then + cat "$rvm_ruby_home/bin/$binary_name" | tr -d '\r' > "$rvm_ruby_home/bin/$binary_name.new" + #sed -e '1,1s=.*=#!'"/usr/bin/env ir=" "$rvm_ruby_home/bin/$binary_name" > "$rvm_ruby_home/bin/$binary_name.new" + mv -f "$rvm_ruby_home/bin/$binary_name.new" "$rvm_ruby_home/bin/$binary_name" + chmod +x $rvm_ruby_home/bin/$binary_name + fi + done - $rvm_bin_path/rvm 1.8.7 -S gem install pathname2 --no-rdoc --no-ri + sed -e '1,1s=.*=#!'"/usr/bin/env bash=" "$rvm_ruby_home/bin/ir" | tr -d '\r' > "$rvm_ruby_home/bin/ir.new" + mv -f "$rvm_ruby_home/bin/ir.new" "$rvm_ruby_home/bin/ir" + chmod +x $rvm_ruby_home/bin/ir + ln -fs $rvm_ruby_home/bin/ir $rvm_ruby_home/bin/ruby - # MONO_LIB=/Library/Frameworks/Mono.framework/Versions/current/lib/ - rvm_ruby_make="$rvm_bin_path/rvm 1.8.7 -S 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 + __rvm_run "gems.install" "PATH=$rvm_ruby_home/bin:$PATH GEM_HOME=$rvm_ruby_gem_home GEM_PATH=$rvm_ruby_gem_home $rvm_ruby_home/bin/gem install --no-rdoc --no-ri rake $rvm_gem_options" "Installing $rvm_gem_name to $dir" - rm -rf $rvm_ruby_home/* - mkdir -p $rvm_ruby_home/bin $rvm_ruby_home/lib $rvm_ruby_home/lib/ruby $rvm_ruby_home/lib/IronRuby - - cp -r $rvm_ruby_src_path/Merlin/Main/Bin/mono_release/* $rvm_ruby_home/bin/ - cp -r $rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Scripts/bin/* $rvm_ruby_home/bin/ - cp -r $rvm_ruby_src_path/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/* $rvm_ruby_home/lib/ruby - cp -r $rvm_ruby_src_path/Merlin/Main/Languages/Ruby/Libs/* $rvm_ruby_home/lib/IronRuby - - binaries="gem irb rdoc rake ri ruby" - for binary_name in $(echo $binaries); do + binaries=() # Don't wrap any longer. + for binary_name in ${binaries[@]} ; do binary_path="" if [[ "ruby" != "$binary_name" ]] ; then binary_path="$rvm_ruby_home/bin/i$binary_name" fi ruby_wrapper=$(cat <<RubyWrapper @@ -605,11 +614,11 @@ builtin cd $rvm_ruby_src_path __rvm_run "mput.repo" "git pull origin trunk" "Pulling from origin trunk" fi if [[ ! -s "$rvm_ruby_src_path/configure" ]] ; then - if which autoconf &> /dev/null ; then + if command -v autoconf &> /dev/null ; then __rvm_run "autoconf" "autoconf" "Running autoconf" else $rvm_scripts_path/log "fail" "rvm expects autoconf to install this ruby interpreter, autoconf was not found in PATH. Aborting installation." ; result=$? ; return $result fi fi @@ -667,10 +676,12 @@ *) $rvm_scripts_path/log "fail" "Ruby interpreter '$rvm_ruby_interpreter' is not known." esac + $rvm_scripts_path/hook "after_install" + if [[ ! -z "$ruby_options" ]] ; then RUBYOPT=$ruby_options ; export RUBYOPT ; fi } __rvm_fetch_ruby() { if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi @@ -814,14 +825,16 @@ $rvm_scripts_path/log "info" "Removing $dir/$rvm_ruby_string..." rm -rf $dir/$rvm_ruby_string else $rvm_scripts_path/log "info" "it seems that $dir/$rvm_ruby_string is already non existent." fi + if [[ -e $rvm_bin_path/$rvm_ruby_string ]] ; then rm -f $rvm_bin_path/$rvm_ruby_string fi - if grep -q "$rvm_ruby_string" "$rvm_config_path/default" ; then + + if grep -q "$rvm_ruby_string" "$rvm_config_path/default" 2>/dev/null ; then rm -f "$rvm_config_path/default" fi done ; unset dir __rvm_remove_gemsets else @@ -857,10 +870,10 @@ for rvm_gem_name in rdoc rake ; do home="$GEM_HOME" ; path="$GEM_PATH" # Save for dir in $rvm_ruby_global_gems_path $rvm_ruby_gem_home ; do GEM_HOME="$dir" ; GEM_PATH="$dir" ; BUNDLE_PATH="$dir" export GEM_HOME GEM_PATH BUNDLE_PATH - __rvm_run "gems.install" "$rvm_ruby_home/bin/gem install --no-rdoc --no-ri $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name" + __rvm_run "gems.install" "$rvm_ruby_home/bin/gem install --no-rdoc --no-ri $rvm_gem_name $rvm_gem_options" "Installing $rvm_gem_name to $dir" if [[ -x $rvm_ruby_gem_home/bin/$rvm_gem_name ]] ; then if [[ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ]] && [[ ! -x $rvm_ruby_home/bin/$rvm_gem_name ]] ; then ln -nfs $rvm_ruby_gem_home/bin/$rvm_gem_name $rvm_ruby_home/bin/$rvm_gem_name fi