Skip to content

Commit 79c8053

Browse files
committed
Fix cd with run
1 parent fa6fa11 commit 79c8053

1 file changed

Lines changed: 33 additions & 12 deletions

File tree

src/Import/MamlRecipe.php

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,46 @@ public function __construct(string $path)
4949

5050
private function schema(): SchemaType
5151
{
52-
$step = S::object([
52+
$cd = S::object([
53+
'cd' => S::string(),
54+
]);
55+
56+
$run = S::object([
57+
'run' => S::string(),
5358
'cd' => S::optional(S::string()),
54-
'run' => S::optional(S::string()),
55-
'run_locally' => S::optional(S::string()),
56-
'upload' => S::optional(S::object([
57-
'src' => S::union(S::string(), S::arrayOf(S::string())),
58-
'dest' => S::string(),
59-
])),
60-
'download' => S::optional(S::object([
61-
'src' => S::string(),
62-
'dest' => S::string(),
63-
])),
59+
]);
60+
61+
$runLocally = S::object([
62+
'run_locally' => S::string(),
63+
]);
64+
65+
$upload = S::object([
66+
'src' => S::union(S::string(), S::arrayOf(S::string())),
67+
'dest' => S::string(),
68+
]);
69+
70+
$download = S::object([
71+
'src' => S::string(),
72+
'dest' => S::string(),
73+
]);
74+
75+
$taskConfig = S::object([
6476
'desc' => S::optional(S::string()),
6577
'once' => S::optional(S::boolean()),
6678
'hidden' => S::optional(S::boolean()),
6779
'limit' => S::optional(S::number()),
6880
'select' => S::optional(S::string()),
6981
]);
7082

83+
$step = S::union(
84+
$cd,
85+
$run,
86+
$runLocally,
87+
$upload,
88+
$download,
89+
$taskConfig,
90+
);
91+
7192
return S::object([
7293
'import' => S::optional(
7394
S::union(
@@ -276,10 +297,10 @@ private function createTask(string $name, ArrayNode $array, string $desc)
276297
}
277298

278299
$step = Maml::toValue($element->value);
279-
$prev = $body;
280300

281301
foreach ($object->properties as $property) {
282302
$key = $property->key->value;
303+
$prev = $body;
283304

284305
$body = match ($key) {
285306
'cd' => function () use ($step, $prev, $property) {

0 commit comments

Comments
 (0)