module RubiGen
RubiGen is a code generation platform Ruby frameworks.
Generators are easily invoked within Ruby framework instances to add and remove components such as library and test files.
New generators are easy to create and may be distributed within RubyGems, user home directory, or within each Ruby framework that uses RubiGen.
For example, newgem uses RubiGen to generate new RubyGems. Those generated RubyGems can then use RubiGen (via a generated script/generate application) to generate tests and executable apps, etc, for the RubyGem.
Generators may subclass other generators to provide variations that require little or no new logic but replace the template files.
For a RubyGem, put your generator classes and templates within subfolders
of the generators
directory.
The layout of generator files can be seen in the built-in
test_unit
generator:
test_unit_generators/ test_unit/ test_unit_generator.rb templates/ test_unit.rb
The directory name (test_unit
) matches the name of the
generator file (test_unit_generator.rb) and class
(TestUnitGenerator
). The files that will be copied or used as
templates are stored in the templates
directory.
The filenames of the templates don't matter, but choose something that
will be self-explanatory since you will be referencing these in the
manifest
method inside your generator subclass.