# File lib/multiruby.rb, line 333
  def self.update
    # TODO:
    # update will look at the dir name and act accordingly rel_.* will
    # figure out latest tag on that name and svn sw to it trunk and
    # others will just svn update

    clean = []

    self.each_scm_build_dir do |style|
      dir = File.basename(Dir.pwd)
      warn dir

      case style
      when :svn then
        case dir
        when /mri_\d/ then
          system "svn cleanup" # just in case
          svn_up = `svn up`
          in_build_dir do
            if svn_up =~ /^[ADUCG] / then
              clean << dir
            else
              warn "  no update"
            end
            FileUtils.ln_sf "../build/#{dir}", "../versions/#{dir}"
          end
        when /mri_rel_(.+)/ then
          ver = $1
          url = `svn info`[/^URL: (.*)/, 1]
          latest = self.mri_latest_tag(ver).chomp('/')
          new_url = File.join(File.dirname(url), latest)
          if new_url != url then
            run "svn sw #{new_url}"
            clean << dir
          else
            warn "  no update"
          end
        else
          warn "  update in this svn dir not supported yet: #{dir}"
        end
      else
        warn "  update in non-svn dir not supported yet: #{dir}"
      end
    end

    in_install_dir do
      clean.each do |dir|
        warn "removing install/#{dir}"
        FileUtils.rm_rf dir
      end
    end
  end