Rand Stats

RKDS

zef:ulisesb

RKDS

RKDS (RaKu Deployment System) is a tool that takes a directory filled with ERK templates and deploys them to another directory. Supports including raku modules defined in a .rkds/lib directory and customizing the deployment of templates individually.

Example

Say you have these directories and files:

Inside input-dir/.rkds/lib/MyMod.rakumod:

unit module MyMod;

sub squared(\n) is export { n ** 2 }

constant $fav-number is export = 42;

Inside input-dir/template1:

Welcome to the first template.

<%- use RKDS -%>
This was deployed to <%= get-output-dir %>

<%- use MyMod -%>
The square of my favorite number is <%= squared($fav-number) %> :)

Inside input-dir/template2:

Second template!

I’m not so sure about this one...

<% use RKDS; don't-deploy %>

This will be executed though: <% note "hello!" %>

Running rkds input-dir output-dir will output this:

rkds: template1: executing
rkds: template1: done executing
rkds: template1: deploying
rkds: template2: executing
template2: hello!
rkds: template2: done executing
rkds: template2: not deploying

and create the file output-dir/template1 like so:

Welcome to the first template.

This was deployed to /path/to/output-dir

The square of my favorite number is 1764 :)

For more information, see lib/RKDS.rakumod and bin/rkds.