TomtitIntro
Tomtit - simple cli task runner with a lot of plugins
Tomtit is a cli task runner when you need to run repetitive tasks / tools around your project. It's similar to make, but with more generic approach, not exactly tied to build tasks only
Here is a quick start
Installation
zef install Tomtit --/testCreate hello world task
Once Tomtit is installed, there is tom cli to create, run tasks:
tom --edit make#!raku
task-run "tasks/make";This step only creates a Raku wrapper for some tasks/make task. As we going to write it on Bash all we need to do is
to create some Bash script that is going to be invoked from Raku as normal Raku function "task-run". We don't necessarily need to
do things that way, but sometime it's just more convenient to separate Bash and Raku logic to keep things clean and simple to maintain, Tomtit allows to do that effectively:
mkdir -p tasks/make
nano tasks/make/task.bash#!bash
make
make test
sudo make installNow we can drop some Makefile to cwd, and run make task as following:
tom makeTasks parameters
Tomtit provides a nice way to pass parameters to tasks, by using environments. Under the hood environments are plain Raku HashMap objects that get loaded into task context allowing tasks configurations depending on --env $env_name cli parameter:
tom --env-edit prod#!raku
%(
:prod
);And then with slight modification of Raku scenario and Bash task code:
#!raku
my $prod = config()<prod>;
task-run "tasks/make", %(
:$prod
);#!bash
prod=$(config prod)
if test "$prod" = True; then
make mode=prod
else
make
fi
make test
sudo make install We can run task with production mode enabled:
tom --env=prod makeTo set default env just use --set-env flag:
tom --env-set prodPlugins
The power of Tomtit is a lot of included plugins, to use plugins, just export plugin repository variable:
export SP6_REPO=http://sparrowhub.io/repoAnd then add plugin as a function into Tomtit scenario. For example, instead of running local make task we may want to to run build remotely on Gitlab CI using plugin:
#!raku
my $prod = config()<prod>,
task-run "make", "gitlab-run-pipeline", %(
:1001_project,
:gitlab_api<https://git.company.com/api/v4/>,
variables => %(
:$prod,
)
);Conclusion
Tomtit has more cool features not covered here, this is just a short quick start introduction with intention to give you some rough ideas what Tomtit is.
Please post your comments and feedback