setup.rb User Manual

What is setup.rb ?

setup.rb is the installer for (mainly) ruby scripts, and ruby extentions. You can automate installation and configuration of your program package with this script.

Usage from the real users' view

see "ruby setup.rb --help"

Usage from the developpers' view

Construct directories like:

package-top/
  setup.rb
  lib/
    [packages...]/
    PATHCONV
  ext/
    [packages...]/
    PATHCONV
  bin/
    [packages...]/
    PATHCONV
  share/
    [packages...]/
    PATHCONV
All lib/, ext/, bin/, share/ directories are optional. You only have to ensure that, at least, one of them is exist.

lib/ is directory for ruby scripts. ext/ is for ruby extentions, bin/ is for command, share/ is for data file (ex. images, resource files...).

PATHCONV defines packages and install target. PATHCONV file format is like:

dir-name package-name target-dir
dir-name package-name target-dir
              :
DIR-NAME is the directory name under lib/, ext/, etc. PACKAGE-NAME is the package name each directory belonging to. TARGET-DIR is the directory path to install its files. TARGET-DIR is the absolute path from "standard path", ex. "/usr/local/lib/ruby/site_ruby/1.5/" for library. For example, one your program is loaded like "require 'mylib/worder'", TARGET-DIR is 'mylib'. Or, "require 'worker'", TARGET-DIR is '.'. Here is an example that I'm using actually.
mails tmail tmail
cparse raccrt racc
strscan strscan .
cparse/ includes "cparse.so" extention, but it belongs to "raccrt" package. And "cparse.so" is installed to RUBYLIB/racc/cparse.so .

Hook tasks

You can hook any tasks, such as "config" "setup". Create the file "setup/PACKAGE_NAME.rb" and write down in it like this:

class InstallerHook_PACKAGE_NAME < InstallerHook
  def pre_setup
    Dir.mkdir 'doc'
    system "rd2html #{package_root}/doc/manual.rd > doc/manual.html"
  end

  def post_setup
    # do anything ...
  end
end

"pre_TASK" is invoked before the task is executed. "post_TASK" is invoked after the task is executed.

NOTE: Since setup.rb supports srcdir, it is not assured that the current directory equals the package top. Get real package's top directory by package_root().

License

GNU General Public License (GPL) version 2. For details, see file "GPL". NOTE: You CAN distribute your program under the any licenses you like. GPL does not force you to make your programs GPL if installer is GPLed one.


Copyright (c) 2000,2001 Minero Aoki <aamine@loveruby.net>