Abort purge when a file listed in "includes" is missing
This commit is contained in:
1 parent
a12177f2cb
commit
39783bf4f3
3 files changed
+60
-5
No files matched your search
@@ -77,7 +77,7 @@ class PurgeCommand extends BaseCommand
|
||||
}
|
||||
|
||||
$packageSelection = new PackageSelection($output, $outputDir, $config, false);
|
||||
$packages = $packageSelection->load();
|
||||
$packages = $packageSelection->load(true);
|
||||
|
||||
$satis_homepage = getenv('SATIS_HOMEPAGE');
|
||||
$prefix = sprintf(
|
||||
|
||||
@@ -293,7 +293,7 @@ class PackageSelection
|
||||
/**
|
||||
* @return PackageInterface[]
|
||||
*/
|
||||
public function load(): array
|
||||
public function load(bool $failOnMissingInclude = false): array
|
||||
{
|
||||
$packages = [];
|
||||
$rootJsonFile = new JsonFile($this->filename);
|
||||
@@ -330,11 +330,17 @@ class PackageSelection
|
||||
$includedJsonFile = new JsonFile($dirname . '/' . $file);
|
||||
|
||||
if (!$includedJsonFile->exists()) {
|
||||
$this->output->writeln(sprintf(
|
||||
'<error>File \'%s\' does not exist, defined in "includes" in \'%s\'</error>',
|
||||
$message = sprintf(
|
||||
'File \'%s\' does not exist, defined in "includes" in \'%s\'',
|
||||
$includedJsonFile->getPath(),
|
||||
$rootJsonFile->getPath()
|
||||
));
|
||||
);
|
||||
|
||||
if ($failOnMissingInclude) {
|
||||
throw new \RuntimeException($message);
|
||||
}
|
||||
|
||||
$this->output->writeln('<error>' . $message . '</error>');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user