Dynamic Behaviour
Main
This is the base workflow:
Notes:
Not all subcommands require to load files, e.g. for printing the version.
If any action fails, the exit code is set to 1 instead of 0.
Exceptions are not caught. If a Ruby application terminates abnormally, the exit code is set to a value != 0 depending on the exception type.
Parse Options
The outcome of this workflow can be either:
An option was found which causes the tool to gracefully exit immediately, e.g. after printing the license.
Parsing failed, e.g. something is missing, invalid or inconsistent.
All options successfully loaded and stored globally.
Load Files
Execute Subcommand
This part of the program flow is straight forward. Depending on the command line options, the appropriate subcommand is executed. Invalid subcommand options were already handled in Parse Options.
Subcommand “check”
This subcommand is just a dummy and completely empty. The consistency check is always done when loading the files.
Subcommand “export”
The files are exported to a specific output folder in a specific type specified with command line options. A filter can be specified to export only a part of the requirements. Files like images listed in the enclosed attribute of the input file are also copied to the output folder.
The algorithm is always the same, but internally different implementations of the ExporterInterface (see Classes) are called depending on the type which can be RST, JSON and CSV.
RST
Requirements are exported to Sphinx so that the dox_trace extension of Sphinx can understand the content and generate a nice HTML view.
This is the only export type where an index file is generated (with the Sphinx toctree element).
JSON
This exporter simply uses the Ruby JSON library to convert the requirement objects to JSON objects which can be written to the output folder.
No index file is written.
CSV
The requirements are converted to a CSV format.
No index file is written.
Subcommand “format”
The following types of formatting are possible:
in-place
: See use case Change Requirements.check-only
: Executed from the verifier in the Version Control System use case.extra
: A debugging feature to write to separate files instead of changing the input files directly.stdout
: similar to extra, but writing the output to the console.
Subcommand “stats”
This subcommand prints generic statistics of the requirements specified in the input files like number of total number of requirements and number of accepted or rejected requirements.