scripts/ruby-installer in rvm-0.0.55 vs scripts/ruby-installer in rvm-0.0.56

- old
+ new

@@ -1,58 +1,57 @@ #!/bin/bash function __rvm_install_source { - if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi + if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi __rvm_log "info" "Installing Ruby from source to: $rvm_ruby_home" - mkdir -p $rvm_ruby_log_path + mkdir -p "$rvm_ruby_log_path" - __rvm_pushpop $rvm_source_path + __rvm_pushpop "$rvm_src_path" if [ ! -z "$rvm_force_flag" ] ; then - rm -rf $rvm_ruby_home - rm -rf $rvm_ruby_src_path + rm -rf "$rvm_ruby_home" "$rvm_ruby_src_path" fi result=0 - if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_rev" ] ; then + if [ -z "$rvm_ruby_tag" -a -z "$rvm_ruby_revision" ] ; then if [ ! -f $rvm_archives_path/$rvm_ruby_package_name.tar.gz ] ; 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" "Downloading $rvm_ruby_package_name, this may take a while depending on your connection..." - __rvm_fetch $rvm_url + __rvm_fetch "$rvm_url" if [ $? -gt 0 ] ; then result=$? ; return $result ; fi fi - 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" "Extracting $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_src_path" "Extracting $rvm_ruby_package_name ..." if [ $? -gt 0 ] ; then result=$? ; return $result ; fi else __rvm_log "info" "Retrieving Ruby from $rvm_url" if [ ! -z "`echo $rvm_url | awk '/^git/'`" ] ; then if [ -d "$rvm_ruby_src_path/.git" ] ; then cd $rvm_ruby_src_path - if [ -z "$rvm_ruby_rev" ] ; then + if [ -z "$rvm_ruby_revision" ] ; then git pull origin master if [ $? -gt 0 ] ; then result=$? ; return $result ; fi else - git checkout ${rvm_ruby_rev:-HEAD} + git checkout ${rvm_ruby_revision:-HEAD} 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 result=$? ; return $result ; fi fi else - if [ -z "$rvm_ruby_rev" ] ; then + if [ -z "$rvm_ruby_revision" ] ; then # TODO: Check if tag v is valid rvm_url="$rvm_ruby_repo_url/tags/$rvm_ruby_tag" rvm_rev="" else - if [ "$rvm_ruby_rev" = "head" -o "$rvm_ruby_rev" = "trunk" ] ; then + if [ "$rvm_ruby_revision" = "head" -o "$rvm_ruby_revision" = "trunk" ] ; 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="-r $rvm_ruby_rev" + rvm_rev="-r $rvm_ruby_revision" fi fi if [ -d "$rvm_ruby_src_path/.svn" ] ; then cd $rvm_ruby_src_path @@ -104,25 +103,25 @@ __rvm_run "install" "$rvm_ruby_make_install" "Installing $rvm_ruby_package_name" if [ $? -gt 0 ] ; then result=$? ; return $result ; fi __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 + GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME + GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH __rvm_rubygems_setup __rvm_bin_script __rvm_run "chmod.bin" "chmod +x $rvm_ruby_home/bin/*" __rvm_post_install __rvm_pushpop } function __rvm_install_ruby { - if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi - if [ ! -z "$RUBYOPT" ] ; then ruby_options=$RUBYOPT ; unset RUBYOPT ; fi - if [ "`uname`" = "Darwin" ] ; then ARCHFLAGS="-arch x86_64 -arch i386" ; export ARCHFLAGS ; fi + if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi + if [ ! -z "$RUBYOPT" ] ; then ruby_options="$RUBYOPT" ; unset RUBYOPT ; fi + if [ "`uname`" = "Darwin" ] ; then ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS ; fi case "$rvm_ruby_interpreter" in macruby) if [ "`uname`" = "Darwin" ] ; then rvm_url=`__rvm_db "macruby_nightly_url"` @@ -134,41 +133,43 @@ __rvm_log "fail" "MacRuby can only be installed on a Darwin OS." fi __rvm_irbrc ;; - ruby-enterprise|ree) + ree) if [ ! -z "$(echo $rvm_ruby_version | awk '/^1\.8/')" -a -z "$rvm_head_flag" ] ; then - # ruby-enterprise-1.8.7-20090928.tar.gz - rvm_url="`__rvm_db "ree_${rvm_ruby_version}_url"`/$rvm_ruby_package_name.tar.gz" + 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_source_path - if [ -d $rvm_ruby_src_path ] ; then - cd $rvm_ruby_src_path + __rvm_pushpop "$rvm_src_path" + if [ -z "$rvm_force_flag" -a -d "$rvm_ruby_src_path" -a ! -z $($rvm_ruby_src_path/*) ] ; then + __rvm_log "It appears that the archive has already been extracted. Skipping extract (use --force to force re-download and extract)." else - __rvm_log "Downloading $rvm_ruby_package_name, this may take a while depending on your connection..." - __rvm_fetch $rvm_url + __rvm_log "Downloading $rvm_ruby_package_file, this may take a while depending on your connection..." + __rvm_fetch "$rvm_url" if [ $? -gt 0 ] ; then result=$? ; return $result ; fi - mkdir -p $rvm_ruby_src_path - __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_name.tar.gz -C $rvm_source_path" "Extracting $rvm_ruby_package_name..." + rm -rf "$rvm_ruby_src_path" + __rvm_run "extract" "tar xzf $rvm_archives_path/$rvm_ruby_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_ruby_package_file..." if [ $? -gt 0 ] ; then result=$? ; return $result ; fi + mv "$rvm_src_path/$rvm_ruby_package_file" "$rvm_ruby_src_path" fi + cd "$rvm_ruby_src_path" - mkdir -p $rvm_ruby_log_path - - cd $rvm_ruby_src_path - mkdir -p $rvm_ruby_home/lib/ruby/gems/1.8/gems + 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 - __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" "Installing $rvm_ruby_package_name, this may take a while, depending on your cpu(s)..." + __rvm_run "install" "./installer -a $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version-$rvm_ruby_patch_level --dont-install-useful-gems --no-tcmalloc $rvm_ruby_configure" "Installing $rvm_ruby_string, this may take a while, depending on your cpu(s)..." if [ $? -gt 0 ] ; then result=$? ; return $result ; fi chmod +x $rvm_ruby_home/bin/* __rvm_rubygems_setup for rvm_gem_name in rake ; do __rvm_run "gems" "$rvm_ruby_home/bin/gem install $rvm_gem_name --no-rdoc --no-ri -q" "Installing $rvm_gem_name" done + __rvm_inject_ruby_shebang "$rvm_ruby_gem_home/bin/rake" + __rvm_inject_gem_env "$rvm_ruby_gem_home/bin/rake" + __rvm_irbrc __rvm_bin_scripts __rvm_post_install __rvm_pushpop else @@ -193,19 +194,19 @@ rvm_ruby_configure=" " rvm_ruby_src_path=$rvm_ruby_home rvm_ruby_make="rake" rvm_ruby_make_install="rake install" rvm_ruby_home="$rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version" - #rvm_ruby_rev="head" + #rvm_ruby_revision="head" # For Installer, can do this once it's ready: RBX_PREFIX=$rvm_ruby_home ; export RBX_PREFIX # Also see 'rakelib/configuration.rake' - if [ ! -d $rvm_ruby_home -o ! -d $rvm_ruby_home/.git ] ; then - rm -rf $rvm_ruby_home - __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_home" "Cloning $rvm_ruby_repo_url" + if [ ! -d $rvm_ruby_src_path -o ! -d $rvm_ruby_src_path/.git ] ; then + rm -rf $rvm_ruby_src_path + __rvm_run "rbx.repo" "git clone --depth 1 $rvm_ruby_repo_url $rvm_ruby_src_path" "Cloning $rvm_ruby_repo_url" cd $rvm_ruby_home else cd $rvm_ruby_home __rvm_run "rbx.repo" "git pull origin master" "Pulling from origin master" fi @@ -213,26 +214,29 @@ # prereqs, 1.8.6 w/ParseTree & rake. Yes this could all be one line... not pushing our luck. echo `export rvm_install_on_use_flag=1 ; rvm 1.8.6` # This should install if missing. echo `rvm 1.8.6 -m rbx ; gem install --no-rdoc --no-ri rake ParseTree` # This should install if missing. rvm_ruby_interpreter="rbx" __rvm_select + if [ ! -z "$rvm_jit_flag" ]; then - __rvm_run "build" "\`rvm 1.8.6 -m rbx ; RBX_LLVM=1 rake build\`" "Building rbx with RBX_LLVM=1" + __rvm_run "configure" "./configure --prefix=$rvm_ruby_home --enable-llvm" "Configuring rbx with LLVM enabled" else - __rvm_run "build" "\`rvm 1.8.6 -m rbx ; rake build\`" "Building rbx" + __rvm_run "configure" "./configure --prefix=$rvm_ruby_home" "Configuring rbx" fi + __rvm_run "build" "\`rvm 1.8.6 -m rbx ; rake build\`" "Building rbx" + binaries="ruby irb" # Trick to work in more shells :) for binary_name in $(echo $binaries) ; do ln -fs $rvm_ruby_home/bin/rbx $rvm_ruby_home/bin/$binary_name done ; unset binary_name binaries __rvm_run "rake.install" "$rvm_ruby_home/bin/rbx gem install rake --no-rdoc --no-ri" "Installing Rake" binary=rake - if [ -f $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 + if [ -f $rvm_ruby_gem_home/bin/$binary ] ; then + if [ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ] ; then + cp $rvm_ruby_gem_home/bin/$binary $rvm_ruby_home/bin/$binary fi chmod +x $rvm_ruby_home/bin/$binary __rvm_inject_ruby_shebang "$rvm_ruby_home/bin/$binary" __rvm_inject_gem_env "$rvm_ruby_home/bin/$binary" fi ; unset binary @@ -244,14 +248,14 @@ for binary_name in $(echo $binaries); do if [ $binary_name != "gem" ] ; then prefix="-S" ; fi ruby_wrapper=$(cat <<RubyWrapper #!/bin/bash -GEM_HOME="$rvm_gem_home" ; export GEM_HOME -GEM_PATH="$rvm_gem_home" ; export GEM_PATH +GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME +GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME -PATH="$rvm_ruby_home/bin:$rvm_gem_home/bin:\$PATH" ; export PATH +PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" ; export PATH exec $rvm_ruby_home/bin/rbx $prefix $binary_name "\$@" RubyWrapper ) files="$rvm_ruby_home/bin/$binary_name $rvm_path/bin/$binary_name-$rvm_ruby_package_name" @@ -266,13 +270,13 @@ __rvm_bin_scripts ;; jruby) mkdir -p $rvm_ruby_log_path - __rvm_pushpop $rvm_source_path + __rvm_pushpop $rvm_src_path - if [ ! -z "$rvm_ruby_rev" ] ; then + if [ ! -z "$rvm_ruby_revision" ] ; then if [ ! -d $rvm_path/$rvm_ruby_interpreter-$rvm_ruby_version -o ! -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. fi else @@ -283,13 +287,13 @@ __rvm_log "info" "It appears that $rvm_package_file has already been downloaded, skipping. Use --force to force re-download." else __rvm_log "info" "Downloading $rvm_package_file, this may take a while depending on your connection..." __rvm_fetch $rvm_url fi - __rvm_run "extract" "tar zxf $rvm_archives_path/$rvm_package_file.tar.gz -C $rvm_source_path" "Extracting $rvm_package_file..." + __rvm_run "extract" "tar zxf $rvm_archives_path/$rvm_package_file.tar.gz -C $rvm_src_path" "Extracting $rvm_package_file..." if [ "$rvm_package_file" != "$rvm_ruby_string" ] ; then - mv $rvm_source_path/$rvm_package_file $rvm_source_path/$rvm_ruby_string + mv $rvm_src_path/$rvm_package_file $rvm_src_path/$rvm_ruby_string fi cd $rvm_ruby_src_path fi fi @@ -324,13 +328,12 @@ done ; unset rvm_gem_name ;; ruby) if [ "`uname`" = "Darwin" ] ; then - ARCHFLAGS="-arch x86_64 -arch i386" ; export ARCHFLAGS if [ "$(echo $rvm_ruby_version | awk '/1\.8/')" ] ; then - rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared --disable-pthread"} " + rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} " else rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared"} " fi else rvm_ruby_configure="${rvm_ruby_configure:-"--enable-shared --enable-pthread"} " @@ -385,11 +388,11 @@ if [ ! -z "$rvm_yaml_flag" ] ; then __rvm_yaml ; fi if [ ! -z "$rvm_json_flag" ] ; then __rvm_json ; fi } function __rvm_uninstall_ruby { - if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi + if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi if [ ! -z "$rvm_ruby_package_name" ] ; then for dir in $rvm_path ; do if [ -d $dir/$rvm_ruby_package_name ] ; then __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..." @@ -406,14 +409,14 @@ __rvm_log "fail" "Cannot uninstall unknown package '$rvm_ruby_package_name'" fi } function __rvm_remove_ruby { - if [ -z "$rvm_selected" ] ; then __rvm_select $* ; fi + if [ -z "$rvm_selected_flag" ] ; then __rvm_select $* ; fi if [ ! -z "$rvm_ruby_package_name" ] ; then - for dir in $rvm_source_path $rvm_path ; do + for dir in $rvm_src_path $rvm_path ; do if [ -d $dir/$rvm_ruby_package_name ] ; then __rvm_log "info" "Removing $dir/$rvm_ruby_package_name..." rm -rf $dir/$rvm_ruby_package_name else __rvm_log "info" "it seems that $dir/$rvm_ruby_package_name is already non existent." @@ -432,12 +435,12 @@ binaries="${binaries:-"gem irb erb ri rdoc testrb rake"}" for binary in $(echo $binaries) ; do if [ -e $rvm_ruby_home/bin/$binary -o -e $rvm_ruby_src_path/bin/$binary ] ; then if [ "$rvm_ruby_src_path" != "$rvm_ruby_home" -a -f $rvm_ruby_src_path/bin/$binary ] ; then cp -f $rvm_ruby_src_path/bin/$binary $rvm_ruby_home/bin/$binary - elif [ -f "$rvm_gem_home/bin/$binary" ] ; then - cp -f $rvm_gem_home/bin/$binary $rvm_ruby_home/bin/$binary + elif [ -f "$rvm_ruby_gem_home/bin/$binary" ] ; then + cp -f $rvm_ruby_gem_home/bin/$binary $rvm_ruby_home/bin/$binary fi __rvm_inject_gem_env $rvm_ruby_home/bin/$binary __rvm_inject_ruby_shebang $rvm_ruby_home/bin/$binary chmod +x $rvm_ruby_home/bin/$binary fi @@ -450,13 +453,13 @@ done ; unset rvm_gem_name __rvm_log "info" "Installation of gems for $rvm_ruby_package_name is complete." binary=rake - 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 + if [ -x $rvm_ruby_gem_home/bin/$binary ] ; then + if [ "$rvm_ruby_gem_home" != "$rvm_ruby_home" ] ; then + 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 } @@ -476,19 +479,19 @@ else __rvm_log "info" "Installing rubygems dedicated to $rvm_ruby_package_name..." rvm_gem_package_name="rubygems-1.3.5" rvm_gem_url="http://rubyforge.org/frs/download.php/60718/$rvm_gem_package_name.tgz" - if [ -d $rvm_source_path/$rvm_gem_package_name ] ; then - cd $rvm_source_path/$rvm_gem_package_name + if [ -d $rvm_src_path/$rvm_gem_package_name ] ; then + cd $rvm_src_path/$rvm_gem_package_name else __rvm_log "info" "Retrieving $rvm_gem_package_name" __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" "Extracting $rvm_gem_package_name" + mkdir -p $rvm_src_path/$rvm_gem_package_name + __rvm_run "rubygems.extract" "tar zxf $rvm_archives_path/$rvm_gem_package_name.tgz -C $rvm_src_path" "Extracting $rvm_gem_package_name" fi - __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" "Installing rubygems for $rvm_ruby_home/bin/ruby" + __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" result=$? if [ $result -eq 0 ] ; then __rvm_log "info" "Installation of rubygems $rvm_ruby_package_name completed successfully." else __rvm_log "warning" "Installation of rubygems $rvm_ruby_package_name did not complete successfully." @@ -508,12 +511,12 @@ function __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_gem_home'\nENV['GEM_PATH']=ENV['GEM_PATH'] || '$rvm_gem_home'\nENV['PATH']='$rvm_ruby_home/bin:$rvm_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_home'\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_gem_home'}\nGEM_PATH=\${GEM_PATH:-'$rvm_gem_home'}\nPATH=$rvm_ruby_home/bin:$rvm_gem_home/bin:\$PATH" + 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" 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