Skip to content

Commit 9aa14cf

Browse files
authored
Merge pull request #84 from keboola/ondra-skip-check-empty-project
Skip check empty project
2 parents dad95f2 + 5715a92 commit 9aa14cf

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/Application.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public function __construct(Config $config, LoggerInterface $logger)
5858
public function run(): void
5959
{
6060
$storageApi = $this->initSapi();
61-
$this->validateProject($storageApi);
61+
if ($this->config->checkEmptyProject()) {
62+
$this->validateProject($storageApi);
63+
}
6264

6365
$params = $this->config->getParameters();
6466

src/Config.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,11 @@ public function isDryRun(): bool
147147
$value = $this->getValue(['parameters', 'dryRun']);
148148
return $value;
149149
}
150+
151+
public function checkEmptyProject(): bool
152+
{
153+
/** @var bool $value */
154+
$value = $this->getValue(['parameters', 'checkEmptyProject']);
155+
return $value;
156+
}
150157
}

src/ConfigDefinition.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ protected function getParametersDefinition(): ArrayNodeDefinition
3636
->booleanNode('restoreTables')->defaultTrue()->end()
3737
->booleanNode('restoreProjectMetadata')->defaultTrue()->end()
3838
->booleanNode('dryRun')->defaultFalse()->end()
39+
->booleanNode('checkEmptyProject')->defaultTrue()->end()
3940
->arrayNode('abs')
4041
->children()
4142
->scalarNode('container')->isRequired()->end()

tests/phpunit/ConfigDefinitionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public static function provideValidConfigs(): array
5555
'restoreTables' => true,
5656
'restoreProjectMetadata' => true,
5757
'dryRun' => false,
58+
'checkEmptyProject' => true,
5859
],
5960
],
6061
],
@@ -83,6 +84,7 @@ public static function provideValidConfigs(): array
8384
'restoreTables' => true,
8485
'restoreProjectMetadata' => true,
8586
'dryRun' => false,
87+
'checkEmptyProject' => true,
8688
],
8789
],
8890
],
@@ -123,6 +125,7 @@ public static function provideValidConfigs(): array
123125
'restoreTables' => true,
124126
'restoreProjectMetadata' => true,
125127
'dryRun' => false,
128+
'checkEmptyProject' => true,
126129
],
127130
],
128131
],

0 commit comments

Comments
 (0)