Changeset View
Changeset View
Standalone View
Standalone View
src/configuration/ArcanistConfiguration.php
Show All 29 Lines | if ($command == '--help') { | ||||
// Special-case "arc --version" to behave like "arc version". | // Special-case "arc --version" to behave like "arc version". | ||||
$command = 'version'; | $command = 'version'; | ||||
} | } | ||||
return idx($this->buildAllWorkflows(), $command); | return idx($this->buildAllWorkflows(), $command); | ||||
} | } | ||||
public function buildAllWorkflows() { | public function buildAllWorkflows() { | ||||
$workflows_by_name = array(); | return id(new PhutilClassMapQuery()) | ||||
$workflows_by_class_name = id(new PhutilSymbolLoader()) | |||||
->setAncestorClass('ArcanistWorkflow') | ->setAncestorClass('ArcanistWorkflow') | ||||
->loadObjects(); | ->setUniqueMethod('getWorkflowName') | ||||
foreach ($workflows_by_class_name as $class => $workflow) { | ->execute(); | ||||
$name = $workflow->getWorkflowName(); | |||||
if (isset($workflows_by_name[$name])) { | |||||
$other = get_class($workflows_by_name[$name]); | |||||
throw new Exception( | |||||
pht( | |||||
'Workflows %s and %s both implement workflows named %s.', | |||||
$class, | |||||
$other, | |||||
$name)); | |||||
} | |||||
$workflows_by_name[$name] = $workflow; | |||||
} | |||||
return $workflows_by_name; | |||||
} | } | ||||
final public function isValidWorkflow($workflow) { | final public function isValidWorkflow($workflow) { | ||||
return (bool)$this->buildWorkflow($workflow); | return (bool)$this->buildWorkflow($workflow); | ||||
} | } | ||||
public function willRunWorkflow($command, ArcanistWorkflow $workflow) { | public function willRunWorkflow($command, ArcanistWorkflow $workflow) { | ||||
// This is a hook. | // This is a hook. | ||||
▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines |