Adding more convenience stuff
Publish PHP Package / docker (push) Successful in 6s Details

This commit is contained in:
Pavel Shevaev 2025-03-06 13:56:26 +03:00
parent 3052d68f9b
commit 0189c9d7af
2 changed files with 12 additions and 1 deletions

View File

@ -87,7 +87,12 @@ class TaskmanArtefact
function initSources(?\taskman\TaskmanFileChanges $file_changes) function initSources(?\taskman\TaskmanFileChanges $file_changes)
{ {
foreach($this->getSourcesSpec() as $src_idx => $src_spec) $all_src_specs = $this->getSourcesSpec();
//let's process a convenience special case
if(count($all_src_specs) > 0 && !is_array($all_src_specs[0]))
$all_src_specs = [$all_src_specs];
foreach($all_src_specs as $src_idx => $src_spec)
{ {
//[[dir1, dir2, ..], [ext1, ext2, ..]] //[[dir1, dir2, ..], [ext1, ext2, ..]]
if(is_array($src_spec) && count($src_spec) == 2 && if(is_array($src_spec) && count($src_spec) == 2 &&

View File

@ -126,6 +126,7 @@ class TaskmanTask
$specs = $this->getPropOr("artefacts", array()); $specs = $this->getPropOr("artefacts", array());
if(is_callable($specs)) if(is_callable($specs))
$specs = $specs(); $specs = $specs();
if(is_array($specs)) if(is_array($specs))
{ {
foreach($specs as $dst => $src_spec) foreach($specs as $dst => $src_spec)
@ -135,6 +136,11 @@ class TaskmanTask
return $artefacts; return $artefacts;
} }
function getArtefact(int $idx) : artefact\TaskmanArtefact
{
return $this->getArtefacts()[$idx];
}
function getFileChanges() : ?TaskmanFileChanges function getFileChanges() : ?TaskmanFileChanges
{ {
return $this->file_changes; return $this->file_changes;