INSTALL-RDOC.rb

Path: rdoc/INSTALL-RDOC.rb
Last Update: Wed Dec 08 22:54:43 GMT+10:00 2004

RDoc/Ri Installer

Introduction

This program installs the RDoc from a Ruby source code directory (e.g. a CVS checkout) over the top of the already installed one.

That allows people to install the latest RDoc over their existing Ruby installation, without compromising their actual Ruby platform. (People probably don’t want to recompile the whole thing just to try the latest RDoc, and they may not want to run bleeding edge Ruby.)

Running the latest RDoc is generally a good idea if you encounter problems with the RDoc you have, as bugs are fixed quickly, but releases are slow, being tied to Ruby releases.

Usage

To install the latest RDoc (that’s compatible with Ruby 1.8):

  • Check out the Ruby sources (you’ve probably done that already) with the following commands (just hit ENTER when prompted for a password)
      cvs -d :pserver:anonymous@cvs.ruby-lang.org:/src login
      cvs -z4 -d :pserver:anonymous@cvs.ruby-lang.org:/src co -r ruby_1_8 ruby
    
  • Change directory to ruby/lib/rdoc.
  • Run ruby INSTALL-RDOC.rb.

How It Works

Installing RDoc basically means copying everything from this directory (ruby/lib/rdoc) to wherever Ruby is installed on the system. This script follows these steps:

  1. Find the installed Ruby ‘lib’ directory (call it ruby_lib_dir).
  2. Find the installed Ruby ‘bin’ directory (call it ruby_bin_dir).
  3. Trash the directory #{ruby_lib_dir}/rdoc.
  4. Step back a directory from the current one (actually, from the directory containing this script).
  5. Recursively copy the ‘rdoc’ directory to #{ruby_lib_dir}.
  6. Find the ‘bin’ directory in the Ruby source code.
  7. Copy ‘rdoc’ and ‘ri’ from that directory to #{ruby_bin_dir}.

Required files

rbconfig   fileutils   pathname  

Constants

FILEUTILS_OPTIONS = { :verbose => true }

[Validate]