Bigtop::Backend::Diagram::GraphvizSql - generates dot language file for data
model
If your bigtop file looks like this:
config {
SQL ... {}
Diagram Graphviz {}
}
app App::Name {
}
and there are table blocks in the app block, this module will make
docs/schema.graphviz (relative to the build_dir) when you type:
bigtop app.bigtop Diagram
or
bigtop app.bigtop all
This generates
"docs/schema.graphviz". By default this
backend also runs the following command:
dot -Tpdf docs/schema.graphviz > docs/schema.pdf
Use backend_block_keywords described below to control the
behavior.
This is a Bigtop backend which generates a file in the dot language understood
by all the Graphviz tools. For information about Graphviz, please visit
<http://www.graphviz.org>. To summarize, the files generated by this
module can be fed through dot or neato to produce a .png file (many other
formats are available) showing the data model for your project.
This module assumes you are using one of the SQL backends which will define
appropriate keywords for table and field definitions. But, it defines three
words of its own:
- label
- This is valid keyword for both the app and table levels. The app label
becomes the label for the whole picture. The table label becomes the label
for the record box of the table. If these label keywords are not used the
app name and table name are used instead, but split on underscores and
ucfirst applied to all the words which are rejoined with a single
space.
- quasi_refers_to
- This is valid at the field level and indicates that the field's value
refers to a field in another table whenever the value is not null. In the
picture these links are drawn with dotted lines.
To keep podcoverage tests happy.
- backend_block_keywords
- Tells tentmaker that I understand these config section backend block
keywords:
no_gen
template
skip_layout
layout_program
layout_flags
As mentioned in the SYNOPSIS above, by default this backend
runs the following command:
dot -Tpdf docs/schema.graphviz > docs/schema.pdf
If skip_layout is present and true, no such command is run.
All you get is docs/schema.graphviz. This flag supercedes the other
keywords.
layout_program defaults to
"dot", but this keyword lets you
change to any other interpretter of the dot language. One of these is
neato. There are others. In my humble opinion, only dot looks good for
this type of diagram, so I stick with it.
layout_flags lets you pass things to your layout program. Feel
free to pass anything. If you use -T, the generated file will have the
-T value as its file extension. So this:
layout_flags `-Tpng`
will actually execute this:
dot -Tpng docs/schema.graphviz > docs/schema.png
If you omit -T a -Tpdf will be added for you. No other flags
are parsed.
- what_do_you_make
- Tells tentmaker what this module makes. Summary:
docs/schema.graphviz.
- gen_Diagram
- Called by Bigtop::Parser to get me to do my thing.
- setup_template
- Called by Bigtop::Parser so the user can substitute an alternate template
for the hard coded one here.
Phil Crow <crow.phil@gmail.com>
Copyright (C) 2010 by Phil Crow
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself, either Perl version 5.10.0
or, at your option, any later version of Perl 5 you may have available.