Обновить README.md

This commit is contained in:
Pavel Shevaev 2024-04-12 13:10:43 +03:00
parent 8a0ad52631
commit 87c5107bda
1 changed files with 54 additions and 4 deletions

View File

@ -14,7 +14,6 @@ Here's a simple example of a task:
``` ```
<?php <?php
namespace taskman; namespace taskman;
use Exception;
task('hello', function() task('hello', function()
{ {
@ -36,7 +35,6 @@ Hello world!
``` ```
<?php <?php
namespace taskman; namespace taskman;
use Exception;
task('ultimate_build_run', task('ultimate_build_run',
[ [
@ -76,13 +74,24 @@ Available tasks:
***** All done (0.01 sec.) ***** ***** All done (0.01 sec.) *****
``` ```
You can filter tasks you want to get help for by a partial match as follows:
```
./gamectl help name
```
### Tasks documentation ### Tasks documentation
#### Task declaration #### Task declaration
Task must be declared using library **task** function as follows: Task must be declared using library **task** function as follows:
```task('name', function() {});``` ```
<?php
namespace taskman;
task('name', function() {});
```
The task above now can be invoked from the shell as follows: The task above now can be invoked from the shell as follows:
@ -93,6 +102,9 @@ The task above now can be invoked from the shell as follows:
Task may have an alias for less typing in the shell. To specify an alias one should put it as an **alias** property of a task declaration: Task may have an alias for less typing in the shell. To specify an alias one should put it as an **alias** property of a task declaration:
``` ```
<?php
namespace taskman;
task('name', ['alias' => 'n'], task('name', ['alias' => 'n'],
function() {}); function() {});
``` ```
@ -106,6 +118,9 @@ You can invoke the task by the alias as follows:
Task may have an dependencies on other tasks. To specify all dependencies one should list them in **deps** section of a task declaration: Task may have an dependencies on other tasks. To specify all dependencies one should list them in **deps** section of a task declaration:
``` ```
<?php
namespace taskman;
task('c', ['deps' => ['a', 'b']], task('c', ['deps' => ['a', 'b']],
function() {}); function() {});
``` ```
@ -122,11 +137,46 @@ All dependencies are executed before running the specified task. Running the tas
***** All done (0.18 sec.) ***** ***** All done (0.18 sec.) *****
``` ```
#### Task executed always #### Always executed tasks
Sometimes it's convenient to define tasks which should be executed every time without explicit invocation. For example for setting the up the default environment, properties, etc. To achieve that one should specify the **always** property for a task: Sometimes it's convenient to define tasks which should be executed every time without explicit invocation. For example for setting the up the default environment, properties, etc. To achieve that one should specify the **always** property for a task:
``` ```
<?php
namespace taskman;
task('setup_env', ['always' => true], task('setup_env', ['always' => true],
function() {}); function() {});
``` ```
### Build properties
It's possible to specify miscellaneous build properties to setup a proper build environment conditions. There's a set of routines which provides taskman for properties manipulation.
### Setting a property
Use **set** built-in function:
```
<?php
namespace taskman;
task('setup_env', ['always' => true],
function() {
set("IOS_APP_ID", "4242jfhFD");
});
```
### Getting a property
Use **get** built-in function:
```
<?php
namespace taskman;
task('build_ios',
function() {
shell("xcode build app " . get("IOS_APP_ID"));
});
```