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 --/test

Create 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 install

Now we can drop some Makefile to cwd, and run make task as following:

tom make

Tasks 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 make

To set default env just use --set-env flag:

tom --env-set prod

Plugins

The power of Tomtit is a lot of included plugins, to use plugins, just export plugin repository variable:

export SP6_REPO=http://sparrowhub.io/repo

And 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

Sparrow6 v0.0.96

Sparrow is a Raku based automation framework

Authors

  • sp1983

License

Artistic-2.0

Dependencies

File::Directory::TreeHash::Merge:ver<2.0.0+>YAMLishJSON::FastData::DumpTerminal::ANSIColor

Test Dependencies

Provides

  • Sparrow6
  • Sparrow6::Common::Config
  • Sparrow6::Common::Helpers
  • Sparrow6::DSL
  • Sparrow6::DSL::Assert
  • Sparrow6::DSL::Bash
  • Sparrow6::DSL::CPAN::Package
  • Sparrow6::DSL::Common
  • Sparrow6::DSL::Directory
  • Sparrow6::DSL::File
  • Sparrow6::DSL::Git
  • Sparrow6::DSL::Group
  • Sparrow6::DSL::Package
  • Sparrow6::DSL::Service
  • Sparrow6::DSL::Ssh
  • Sparrow6::DSL::Systemd
  • Sparrow6::DSL::Template
  • Sparrow6::DSL::Template6
  • Sparrow6::DSL::User
  • Sparrow6::DSL::Zef
  • Sparrow6::RakuTask
  • Sparrow6::SparrowTask
  • Sparrow6::Task
  • Sparrow6::Task::Check
  • Sparrow6::Task::Check::Context
  • Sparrow6::Task::Check::Context::Common
  • Sparrow6::Task::Repository
  • Sparrow6::Task::Repository::Helpers::Common
  • Sparrow6::Task::Repository::Helpers::Index
  • Sparrow6::Task::Repository::Helpers::Init
  • Sparrow6::Task::Repository::Helpers::Plugin
  • Sparrow6::Task::Runner
  • Sparrow6::Task::Runner::Helpers::Bash
  • Sparrow6::Task::Runner::Helpers::Check
  • Sparrow6::Task::Runner::Helpers::Common
  • Sparrow6::Task::Runner::Helpers::Perl
  • Sparrow6::Task::Runner::Helpers::Php
  • Sparrow6::Task::Runner::Helpers::Powershell
  • Sparrow6::Task::Runner::Helpers::Python
  • Sparrow6::Task::Runner::Helpers::Raku
  • Sparrow6::Task::Runner::Helpers::Ruby
  • Sparrow6::Task::Runner::Helpers::Test

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.