Skip to content

Commit d065493

Browse files
authored
Merge pull request #2 from php-etl/feature/actions
Added loadAction method
2 parents d07a947 + fdc292c commit d065493

File tree

4 files changed

+256
-25
lines changed

4 files changed

+256
-25
lines changed

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
"php": "^8.2",
2020
"symfony/console": "^6.0",
2121
"php-etl/pipeline-contracts": "0.4.*",
22+
"php-etl/satellite-contracts": "0.1.*",
2223
"php-etl/pipeline": "*",
2324
"php-etl/console-state": "*",
24-
"php-etl/pipeline-console-runtime": "*"
25+
"php-etl/pipeline-console-runtime": "*",
26+
"php-etl/action-console-runtime": "*",
27+
"php-etl/action": "*"
2528
},
2629
"require-dev": {
2730
"rector/rector": "^0.15",
@@ -41,7 +44,7 @@
4144
},
4245
"extra": {
4346
"branch-alias": {
44-
"dev-main": "0.2.x-dev"
47+
"dev-main": "0.3.x-dev"
4548
}
4649
}
4750
}

composer.lock

Lines changed: 236 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Console.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44

55
namespace Kiboko\Component\Runtime\Workflow;
66

7+
use Kiboko\Component\Action\Action;
78
use Kiboko\Component\Pipeline\Pipeline;
9+
use Kiboko\Component\Runtime\Action\Console as ActionConsoleRuntime;
810
use Kiboko\Component\Runtime\Pipeline\Console as PipelineConsoleRuntime;
911
use Kiboko\Component\State;
1012
use Kiboko\Contract\Pipeline\PipelineRunnerInterface;
11-
use Kiboko\Contract\Pipeline\RunnableInterface;
13+
use Kiboko\Contract\Satellite\RunnableInterface as JobRunnableInterface;
1214
use Symfony\Component\Console\Output\ConsoleOutput;
1315

1416
final class Console implements WorkflowRuntimeInterface
1517
{
1618
private readonly State\StateOutput\Workflow $state;
1719

18-
/** @var list<RunnableInterface> */
20+
/** @var list<JobRunnableInterface> */
1921
private array $jobs = [];
2022

2123
public function __construct(
@@ -34,7 +36,16 @@ public function loadPipeline(string $filename): PipelineConsoleRuntime
3436
return $factory(new PipelineConsoleRuntime($this->output, $pipeline, $this->state->withPipeline(basename($filename))));
3537
}
3638

37-
public function job(RunnableInterface $job): self
39+
public function loadAction(string $filename): ActionConsoleRuntime
40+
{
41+
$factory = require $filename;
42+
43+
$action = new Action();
44+
45+
return $factory(new ActionConsoleRuntime($this->output, $action, $this->state->withAction(basename($filename))));
46+
}
47+
48+
public function job(JobRunnableInterface $job): self
3849
{
3950
$this->jobs[] = $job;
4051

0 commit comments

Comments
 (0)