mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-08 14:28:57 +02:00
refactored Autoloader; added support for json encoded format for environment "hosts" option
This commit is contained in:
+4
-11
@@ -48,22 +48,15 @@ class Factory
|
||||
$taskName = str_replace(' ', '', $taskName);
|
||||
|
||||
if (strpos($taskName, '/') === false) {
|
||||
Autoload::loadUserTask($taskName);
|
||||
$className = 'Task\\' . ucfirst($taskName);
|
||||
$className = $taskName;
|
||||
|
||||
} else {
|
||||
$taskName = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName)));
|
||||
$className = 'Mage\\Task\\BuiltIn\\' . $taskName . 'Task';
|
||||
$className = 'Mage\\Task\\BuiltIn\\' . str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName))) . 'Task';
|
||||
}
|
||||
|
||||
$instance = new $className($taskConfig, $inRollback, $stage, $taskParameters);
|
||||
|
||||
if (class_exists($className) || Autoload::isLoadable($className)) {
|
||||
$instance = new $className($taskConfig, $inRollback, $stage, $taskParameters);
|
||||
} else {
|
||||
throw new ErrorWithMessageException('The Task "' . $taskName . '" doesn\'t exists.');
|
||||
}
|
||||
|
||||
if (!($instance instanceOf AbstractTask)) {
|
||||
if (!is_a($instance,'Mage\Task\AbstractTask')) {
|
||||
throw new Exception('The Task ' . $taskName . ' must be an instance of Mage\Task\AbstractTask.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user