XEP-tool usage
The XEP-tool is the answer for developers who wonder how to maintain an actual list of supported XEPs. It's a fast and easy way to automatically produce documentation from raw, beam files. This is a quick guide on how to enjoy the usage of the XEP-tool.
Sign your module file first
The architecture of MongooseIM determines that almost every XEP or feature implementation resides in its own file.
It is not strictly enforced but usually the file is named with a mod_
prefix.
For example mod_privacy
file implements XEP-0016: Privacy Lists.
Mandatory xep
and version
In order to let the XEP-tool know about your module, we add a special attribute xep
at the begining of the mod_privacy
module:
-xep([{xep, 16}, {version, "1.6"}]).
Now we know that this module implements to XEP-0016: Privacy Lists with version 1.6.
It gives the tool enough information to generate a URL to the XEP homepage.
There are also some variations of the xep
attribute like:
You ought to remember to specify xep
and version
attributes every time.
You can also put several xep
attributes in one module.
For example mod_mam_muc
implements attributes of XEP-0313: Message Archive Management and also XEP-0045: Multi-User Chat.
Just list them one after another:
-xep([{xep, 45}, {version, "1.25"}]).
-xep([{xep, 313}, {version, "0.5.1"}]).
Specific URL
-xep([{xep, 16}, {version, "1.6"}, {url, "http://xmpp.org/extensions/xep-0016.html"}]).
Comment
-xep([{xep, 16}, {version, "1.6"}, {comment, "Example comment: Partial Implemented"}]).
And the XEP-tool will do the work!
Compile and run
You've just finished marking your modules.
The only thing left is to make compile
MongooseIM in order to generate the .beam files.
To run the XEP tool, you must issue an additional subcommand.
There are two choices:
markdown
: to produce a markdown list of supported XEPs. This option also needs an output file as an argument.list
: to print out supported XEPs to the console.
For example, to run our XEP-tool with a markdown
command, type:
make xeplist
Or do it manually:
$MONGOOSEIM_ROOT/tools/xep_tool/xep_tool.escript markdown <PATH_TO_EBIN> <OPTIONAL_OUTPUT_FILE>
In our case, from MongooseIM root directory:
./tools/xep_tool/xep_tool.escript markdown ebin list.md
The Markdown list with unique XEP names and URLs is saved to file list.md
You can copy-paste the content of this file to your main README file.