Building a Veracity Module - Part 1
Veracity was built to be extensible. Not just by virtue of the source being available (although that helps), but also via the embedded JavaScript interpreter. Without writing a line of C, new HTML pages and REST urls can be added, supporting entirely new data types and functionality.
The “native” Scrum functions in Veracity (work items, build tracking, time tracking, milestones, filters, etc.) are nowhere to be found in the Veracity library code. It’s Javascript all the way down, helped out by client-side scripts and HTML. As we add new (or alternative) features ourselves, expect to see many of them show up as new “modules” of pluggable (and un-pluggable) code.
We were going to be adding a Wiki module to Veracity eventually, anyway; and since we wanted to show you how modules are built, a simple Wiki seemed like a nice place to start. This isn’t production code (yet), but it’s an instructive start.
For today, let’s just get the Wiki installed in your Veracity server and make sure everything’s up and running.
Whether you’re building from source or running from a pre-built installer, you’ll need to download the latest nightly build (1.0.1.10527 or later) to retrieve the Wiki module. If you’ve cloned from our public repository, you’ll want to pull the latest.
Within your source folder or the unpacked archive, look for .../src/modules/wiki
. Within that directory, you’ll see a README file, some license material, a test directory, and the part you actually care about: a server_files
folder.
You’ll want to copy the contents of that folder into Veracity’s server files folder. If you’re unsure where that is, run vv config
. Towards the end, you’ll see something like:
server/files: /home/alanswann/veracity/src/server_files
in this case, from within modules/wiki
, you’d say (on Unix-y systems):
[~/veracity/src/modules/wiki]
$ cp -R server_files/* /home/alanswann/veracity/src/server_files
and your Wiki code should now included with the rest of Veracity.
[~/veracity/src/modules/wiki]
$ ls ~/veracity/src/server_files/modules
scrum wiki
Note the above-mentioned scrum module alongside the wiki.
Start (or restart) vv serve
, and you should see a wiki
item in the top menu.
Click that. You’ll see a default home page, explaining that, hey, it’s a default home page. You can edit this page (using Markdown), or click the new page
link to add another page.
As pages are created, they’ll show up in the right sidebar, to be clicked and viewed, or inserted into another page’s edit box as links.
Next post, we’ll start looking at the code. The good news? All of the heavy lifting is done for us, from the flexibly-licensed editor and preview tools, to the Veracity libraries that handle saves, updates and merges (gotta have merges, it’s a distributed Wiki, after all). I just glued them together.