Обновить README.md
This commit is contained in:
parent
87c5107bda
commit
7aa8ba4cc0
47
README.md
47
README.md
|
@ -11,7 +11,7 @@ The central unit of execution is 'task'. The main difference from the plain old
|
|||
#### Hello world
|
||||
Here's a simple example of a task:
|
||||
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -23,7 +23,8 @@ task('hello', function()
|
|||
|
||||
Try executing it from the shell:
|
||||
|
||||
```./gamectl hello
|
||||
```
|
||||
./gamectl hello
|
||||
***** task 'hello' start *****
|
||||
Hello world!
|
||||
***** task 'hello' done(0/0.27 sec.) *****
|
||||
|
@ -32,7 +33,7 @@ Hello world!
|
|||
|
||||
#### Real world example
|
||||
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -86,7 +87,7 @@ You can filter tasks you want to get help for by a partial match as follows:
|
|||
|
||||
Task must be declared using library **task** function as follows:
|
||||
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -101,7 +102,7 @@ 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:
|
||||
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -117,7 +118,7 @@ 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:
|
||||
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -141,7 +142,7 @@ All dependencies are executed before running the specified task. Running the tas
|
|||
|
||||
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
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -157,7 +158,7 @@ It's possible to specify miscellaneous build properties to setup a proper build
|
|||
|
||||
Use **set** built-in function:
|
||||
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -167,11 +168,25 @@ task('setup_env', ['always' => true],
|
|||
});
|
||||
```
|
||||
|
||||
### Setting a property only if it's not already set
|
||||
|
||||
Use **setor** built-in function. Property will be set only if it's not set some where before. It's a convenient pattern to have a default set of properties which can be overriden by the environment properties included from an external script.
|
||||
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
task('setup_env', ['always' => true],
|
||||
function() {
|
||||
setor("IOS_APP_ID", "4242jfhFD");
|
||||
});
|
||||
```
|
||||
|
||||
### Getting a property
|
||||
|
||||
Use **get** built-in function:
|
||||
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
|
@ -180,3 +195,17 @@ task('build_ios',
|
|||
shell("xcode build app " . get("IOS_APP_ID"));
|
||||
});
|
||||
```
|
||||
|
||||
### Getting a property or some default value
|
||||
|
||||
Use **getor** built-in function:
|
||||
|
||||
```php
|
||||
<?php
|
||||
namespace taskman;
|
||||
|
||||
task('build_ios',
|
||||
function() {
|
||||
shell("xcode build app " . getor("IOS_APP_ID", "3232232"));
|
||||
});
|
||||
```
|
Loading…
Reference in New Issue