wiki:WikiStart/Standards/RG5

This details guidelines and requirements on Ruby packages in Rock

Directory Structure

  • lib/ the library code
    • if the package is made only of a single file, it should be lib/<package_name>.rb (e.g. utilrb.rb for utilrb)
    • for more complex packages, the package files should be put in a subdirectory of lib/ named after the package (e.g. lib/utilrb/value_set.rb) and a file called lib/utilrb.rb should be added that requires the main functionality.
  • bin/ "programs", i.e. utilities that can be started from the command line. These utilities should all start with a "#! /usr/bin/env ruby" she-bang line to ensure that they get started with the proper ruby version. The usage of the optparse standard library as well as the standard Ruby logger is recommended.
  • test/: the test suites
  • ext/: extensions. The usage of rice is recommended to bind C++ code into Ruby.

Build Behaviour

Setup and documentation generation is supposed to be interfaced through a toplevel Rakefile (one is provided in the template).

The autoproj build system will call "rake" (without arguments) at build time to ensure that everything is setup properly. This calls the "default" target, which can be customized. The template contains customization to build and setup C++ extensions.

To generate documentation, the autoproj build system calls "rake doc". The template already contains the necessary target to generate documentation using rdoc.

New package creation

New packages can be created by the rock-create-ruby tool.

rock-create-ruby dirname
Last modified 8 years ago Last modified on 08/03/11 15:55:36