2017 © Pedro Peláez
 

library junty-taskrunner

Task runner for Junty.

image

junty/junty-taskrunner

Task runner for Junty.

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

JuntyTaskRunner

Packagist Travis Scrutinizer GitHub license, (*1)

Junty task runner component., (*2)

Install

$ composer require junty/junty-taskrunner

Usage

Basig usage

<?php
require 'vendor/autoload.php';

use Junty\TaskRunner\Runner\Runner;

$runner = new Runner();

$runner->task('say_hello', function () {
    echo 'hello!'; 
});

$runner->my_task_2 = function () {
    // ...
};

$runner->group('tests', function () {
    $this->task('tests_for_users', function () {
        // ...
    });

    $this->task('tests_for_admins', function () {
        // ...
    });
});

$runner->run(); // Runs all registred tasks

Methods

task

Creates a task with Junty\TaskRunner\Task\TaskInterface or callable one., (*3)

$runner->task('my_task', function () {});

// or

$runner->task(new MyTask());

group

Creates a group of tasks with Junty\TaskRunner\Task\GroupInterface or callable one., (*4)

$runner->group('my_group', function () {
    $this->task('my_task_from_group_1', function () {});

    // Another tasks
});

| A group and a task cannot have the same name!, (*5)

order

Orders the execution task and groups order., (*6)

$runner->order('my_group', 'my_task', 'my_group_2');

run

Runs all tasks and groups., (*7)

$runner->run();

runTask

Runs a single registred task or instance of TaskInterface., (*8)

$runner->runTask('my_registred_task');

// or

$runner->runTask(new MyTask());

runGroup

Runs a single registred group or instance of GroupInterface., (*9)

$runner->runGroup('my_registred_group');

// or

use Junty\TaskRunner\Task\Group;

$runner->runGroup(new class() extends Group
{
    public function __construct()
    {
    }

    public function getName() : string
    {
        return 'my_group';
    }

    public function task($task, callable $task = null)
    {
    }

    public function getTasks() : TaskCollection
    {
        $collection = new TaskCollection();

        $collection->set(new MyTask());
        $collection->set(new MyOtherTask());

        return $collection;
    }
});

The Versions

20/04 2016

dev-master

9999999-dev

Task runner for Junty.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/04 2016

v0.2.2

0.2.2.0

Task runner for Junty.

  Sources   Download

MIT

The Requires

 

The Development Requires

19/03 2016

v0.2.1

0.2.1.0

Task runner for Junty.

  Sources   Download

MIT

The Requires

 

The Development Requires

19/03 2016

v0.2.0

0.2.0.0

Task runner for Junty.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/03 2016

v0.1.0

0.1.0.0

Task runner for Junty.

  Sources   Download

MIT

The Requires

 

The Development Requires