Tasks
Tasks is a lean tasking system based on Ruby's Rake
At a Glance
Trying Tasks
Tasks may be splited into two sections: runner and definitions.
The runner is the section responsible to get the user input and then execute the defined tasks.
While the definitions are responsible to group the rules and logic of each task.
At your task file, you can do:
import {tasks}!
; here goes the task definition
runTask "my-task"
And then, runnning with:
arturo tasks.art
Tip
You may want to use a hashbang to don't need to call arturo for every run.
Try:#! arturo
Tip
To dynamically select the task via CLI, use:import {tasks}! ; tasks goes here ensure.that: "Argument needed for this script" -> not? empty? arg runTask arg\0
The tasks' definition itself
A real example of tasks:
import {tasks}!
routine 'test [
|> 'echo {Testing source code...}
]
task 'build .requires: [test] [
source: ["./tests/example/example.c"]
directory ./"tests/bin"
file.as: 'f ./"tests/bin/example.exe" .requires: source [
|> 'gcc print <= ~{|join.with: " " f\requires| -o |f\file|}
]
]
task 'run [
file ./"tests/bin/example.exe" .as: 'f
-> execute.directly f\file
]
task 'clean [
delete.directory ./"tests/bin"
]
runTask 'build
runTask 'run
runTask 'clean
This will show you:
==================================================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ミ BUILD ミ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==================================================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~〃 test 〃~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Testing source code...
./tests/example/example.c -o tests\bin\example.exe
==================================================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ミ RUN ミ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==================================================================================
Hello, from Arturo's tasks
==================================================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ミ CLEAN ミ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==================================================================================
Documentation
Runner
runTask: $[target :string :literal]
:
Runs thetarget
task
Task Definition
directory: $[path :string]
:
Creates a directory. The same aswrite.directory path null
.file: $[filename :string action :block]
:
Defines a file. Files may require other files to exist. And also can be threated by other name using.as
..as :literal
:
Wraps the file and its requirements into a dictionary:#[file :string requires [:string]]
.requires
:
The required files to this file exist. If none is passed, the files depends on itself.
exec $[command :string :literal params :string]
:
Executes a command on shell.- alias:
|>
. - OBS.: This function is only available into
action
s fromroutine
s andtask
s.
- alias:
routine: $[name :string :literal, action :block]
:
Defines a:routine
that executes anaction
.task: $[name :string :literal, action :block]
:
Defines a:task
, every task is a:routine
but executable direclty from theexecuteTask
..requires [:literal :string :word]
:
Defines the required routines to run this..defers [:literal :string :word]
:
Defines the required defer routines.
Warning
Never import this lib as.lean
, or this will break the current code.
This happens due to the nature of Arturo (being kind-of concatenative).
Screenshot's wallpaper photo by Nick Scheerbart on Unsplash
Last updated:
1.0.0 | 1 June 2024 | 4834554 / 8 files |
No dependencies.