mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-05-18 05:36:40 +02:00
Merge 6f3fd93d4c
into ef72936c52
This commit is contained in:
commit
66535b14ab
|
@ -42,6 +42,7 @@ class TaskFactory
|
|||
{
|
||||
$this->runtime = $runtime;
|
||||
$this->loadBuiltInTasks();
|
||||
$this->loadCustomTasks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,4 +115,34 @@ class TaskFactory
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the custom tasks
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected function loadCustomTasks()
|
||||
{
|
||||
$config = $this->runtime->getConfiguration();
|
||||
|
||||
if (!isset($config['custom_tasks'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_array($config['custom_tasks'])) {
|
||||
throw new \RuntimeException('The "custom_tasks" configuration must be an array');
|
||||
}
|
||||
|
||||
foreach ($config['custom_tasks'] as $class) {
|
||||
if (class_exists($class)) {
|
||||
$reflex = new ReflectionClass($class);
|
||||
if ($reflex->isInstantiable()) {
|
||||
$task = new $class();
|
||||
if ($task instanceof AbstractTask) {
|
||||
$this->add($task);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@ magephp:
|
|||
- composer/install
|
||||
- composer/dump-autoload
|
||||
on-deploy:
|
||||
- Mage\Tests\Task\CustomTask
|
||||
- custom
|
||||
on-release:
|
||||
post-release:
|
||||
post-deploy:
|
||||
post-deploy:
|
||||
custom_tasks:
|
||||
- Mage\Tests\Task\CustomTask
|
||||
|
|
Loading…
Reference in a new issue