DEV Community

Alexey Melezhik
Alexey Melezhik

Posted on • Updated on

Automation of Perl6 development workflow through the Tomtit task runner

There is one Tomtit to make it!

tomtit cli

Tomtit is a brand new Perl6 task runner allow you to automate routine tasks easily.

In this post I am going to show how to use Tomtit to automate typical tasks happening during developing of Perl6 applications.

To get a glimpse of what Tomtit is - please read this post.

Gettings stared

Let's install Tomtit first.

zef install Tomtit

Now let's check an application source code from remote git repository:

git clone $git-repo

4 cases

Let's limit the post to 4 typical cases often happening when developing and releasing Perl6 application:

  • set up git repository
  • test local source code
  • install local source code
  • release CPAN module

Tomtit scenarios

Now we to define tomtit scenarios for every mentioned case. We place scenarios inside .tom directory, these are plain Perl6 scripts calling Tomtit API.

Case 1. Set up git repository.

When start on new machine I always have to set my user/email so I can push to remote. I also want git keep password cache for me. It's tedious to it manually every time, so let's automate this:


task-run "set git", "git-base", %(
  email                => '',
  name                 => 'Alexey Melezhik',
  config_scope         => 'local',
  set_credential_cache => 'on'

My workflow makes it a bit complicated because I push source code both to GitHub and BitBucket repositories.

It's easy to create scenarios for push operations:


# push to github
bash "git push origin master";


# push to bitbucket
bash "git push bb master";


# push to both
EVALFILE ".tom/push-bb.pl6"
EVALFILE ".tom/push-gh.pl6"

Case 2. Test local source code.

For many Perl6 projects it's just as zef test to run unit tests inside t/ directory , but I also have Outthentic tests. I also like to validate my META6.json file to see if I have any JSON-related errors in it:


task-run "check json files", "json-lint", %( path =>  "{$*CWD}" );
bash "zef test .";
bash "sh";

Case 3. Install source code.

It's just zef install command for current working directory.


bash "zef install . --force-install";

Case 4. Release CPAN module

I use App::Mi6 tool to release my Perl6 modules to CPAN, it requires credentials set through ~/.pause, it seems handy to define a dedicated scenario for this:


my $password = prompt("enter your CPAN password: ");

template-create "/home/{%*ENV<USER>}/.pause", %(
  mode => '700',
  variables => %(
    user      => 'melezhik',
    password  => $password
  source => q:to /TEMPL/
  user      [%= user %]
  password  [%= password %]

The release scenarios is a simple as:


zef "App::Mi6";
bash "mi6 release";


As I have my tomtit scenarios get ready, my development workflow is dead simple and clear, when everything is in place:

Checkout an application source code:

git clone $git-repo

Install Tomtit:

zef install Tomtit

List available tomtits scenarios:

tom --list

Modifying source code

nano foo/bar/app.pl6

Run tests:

tom test


tom install

Setup git repo:

tom git-setup

Commit changes

git commit -a

Push changes:

tom push

Setup PAUSE account credentials:

tom set-pause

Release to CPAN:

tom release


That's it. In this post we've seen how to automate some typical routine operations happening when developing Perl6 applications.

There is one Tomtit to make it!

Thanks for reading

Top comments (0)