Skip to content
Snippets Groups Projects
Commit 2b072ef4 authored by jurgenhaas's avatar jurgenhaas
Browse files

Cleanup configuration by removing non-existent imports

Fix a syntax issue
parent 6bc0f610
No related branches found
No related tags found
No related merge requests found
......@@ -56,8 +56,28 @@ class Handler extends BaseHandler {
}
}
}
// Cleanup configuration: remove non-existant includes.
foreach ($ahoy['commands'] as $command => $commands) {
if (isset($commands['imports']) && is_array($commands['imports'])) {
$deleteKeys = [];
foreach ($commands['imports'] as $key => $import) {
if (!file_exists($import)) {
$deleteKeys[] = $key;
}
}
arsort($deleteKeys);
foreach ($deleteKeys as $deleteKey) {
unset($ahoy['commands'][$command]['imports'][$deleteKey]);
}
if (empty($ahoy['commands'][$command]['imports'])) {
unset($ahoy['commands'][$command]);
}
}
}
$file = $rootDir . '/.ahoy.yml';
file_put_contents($file, $rendered = Yaml::dump($ahoy, 9, 2));
file_put_contents($file, Yaml::dump($ahoy, 9, 2));
$this->gitIgnore('.ahoy.yml');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment