1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00

Make all bin/* scripts locate their workflows dynamically

Summary:
Ref T2015. Not directly related to Drydock, but I bumped into this. All these scripts currently enumerate their workflows explicitly.

Instead, use `PhutilSymbolLoader` to automatically discover workflows. This reduces code duplication and errors (see all the bad `extends` this diff fixes) and lets third parties add new workflows (not clearly valuable?).

Test Plan: Ran `bin/x help` for each modified script.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D7840
This commit is contained in:
epriestley 2013-12-27 13:15:48 -08:00
parent e397103bf2
commit ce78bf1de4
24 changed files with 73 additions and 120 deletions

View file

@ -14,9 +14,8 @@ EOHELP
);
$args->parseStandardArguments();
$args->parseWorkflows(
array(
new DivinerGenerateWorkflow(),
new DivinerAtomizeWorkflow(),
new PhutilHelpArgumentWorkflow(),
));
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('DivinerWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,12 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new DrydockManagementLeaseWorkflow(),
new DrydockManagementCloseWorkflow(),
new DrydockManagementReleaseWorkflow(),
new DrydockManagementCreateResourceWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('DrydockManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -15,13 +15,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorFactManagementDestroyWorkflow(),
new PhabricatorFactManagementAnalyzeWorkflow(),
new PhabricatorFactManagementStatusWorkflow(),
new PhabricatorFactManagementListWorkflow(),
new PhabricatorFactManagementCursorsWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorFactManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,12 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorFilesManagementEnginesWorkflow(),
new PhabricatorFilesManagementMigrateWorkflow(),
new PhabricatorFilesManagementRebuildWorkflow(),
new PhabricatorFilesManagementPurgeWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorFilesManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorLipsumGenerateWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorLipsumManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,15 +14,9 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhutilHelpArgumentWorkflow(),
new PhabricatorMailManagementResendWorkflow(),
new PhabricatorMailManagementShowOutboundWorkflow(),
new PhabricatorMailManagementShowInboundWorkflow(),
new PhabricatorMailManagementSendTestWorkflow(),
new PhabricatorMailManagementReceiveTestWorkflow(),
new PhabricatorMailManagementListInboundWorkflow(),
new PhabricatorMailManagementListOutboundWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorMailManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -15,16 +15,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorRepositoryManagementPullWorkflow(),
new PhabricatorRepositoryManagementDiscoverWorkflow(),
new PhabricatorRepositoryManagementEditWorkflow(),
new PhabricatorRepositoryManagementListWorkflow(),
new PhabricatorRepositoryManagementDeleteWorkflow(),
new PhabricatorRepositoryManagementMarkImportedWorkflow(),
new PhabricatorRepositoryManagementLookupUsersWorkflow(),
new PhabricatorRepositoryManagementImportingWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorRepositoryManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorSearchManagementIndexWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorSearchManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorAuditManagementDeleteWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorAuditManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,11 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorAuthManagementRecoverWorkflow(),
new PhabricatorAuthManagementRefreshWorkflow(),
new PhabricatorAuthManagementLDAPWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorAuthManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,12 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorConfigManagementListWorkflow(),
new PhabricatorConfigManagementSetWorkflow(),
new PhabricatorConfigManagementGetWorkflow(),
new PhabricatorConfigManagementDeleteWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorConfigManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,9 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorFeedManagementRepublishWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorFeedManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -18,5 +18,4 @@ $workflows = id(new PhutilSymbolLoader())
->setAncestorClass('HarbormasterManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -14,10 +14,8 @@ EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = array(
new PhabricatorPolicyManagementShowWorkflow(),
new PhabricatorPolicyManagementUnlockWorkflow(),
new PhutilHelpArgumentWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorPolicyManagementWorkflow')
->loadObjects();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -99,14 +99,9 @@ try {
exit(1);
}
$workflows = array(
new PhabricatorStorageManagementDatabasesWorkflow(),
new PhabricatorStorageManagementDestroyWorkflow(),
new PhabricatorStorageManagementDumpWorkflow(),
new PhabricatorStorageManagementStatusWorkflow(),
new PhabricatorStorageManagementProbeWorkflow(),
new PhabricatorStorageManagementUpgradeWorkflow(),
);
$workflows = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorStorageManagementWorkflow')
->loadObjects();
$patches = PhabricatorSQLPatchList::buildAllPatches();

View file

@ -3740,7 +3740,7 @@ phutil_register_library_map(array(
'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList',
'PhabricatorBusyExample' => 'PhabricatorUIExample',
'PhabricatorCacheDAO' => 'PhabricatorLiskDAO',
'PhabricatorCacheManagementPurgeWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorCacheManagementPurgeWorkflow' => 'PhabricatorCacheManagementWorkflow',
'PhabricatorCacheManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController',
'PhabricatorCalendarController' => 'PhabricatorController',
@ -4113,13 +4113,13 @@ phutil_register_library_map(array(
'PhabricatorMailImplementationPHPMailerLiteAdapter' => 'PhabricatorMailImplementationAdapter',
'PhabricatorMailImplementationSendGridAdapter' => 'PhabricatorMailImplementationAdapter',
'PhabricatorMailImplementationTestAdapter' => 'PhabricatorMailImplementationAdapter',
'PhabricatorMailManagementListInboundWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorMailManagementListOutboundWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorMailManagementReceiveTestWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorMailManagementResendWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorMailManagementSendTestWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorMailManagementShowInboundWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorMailManagementShowOutboundWorkflow' => 'PhabricatorSearchManagementWorkflow',
'PhabricatorMailManagementListInboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementListOutboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementReceiveTestWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementResendWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementSendTestWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementShowInboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementShowOutboundWorkflow' => 'PhabricatorMailManagementWorkflow',
'PhabricatorMailManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase',
'PhabricatorMailingListPHIDTypeList' => 'PhabricatorPHIDType',

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorCacheManagementPurgeWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorCacheManagementWorkflow {
protected function didConstruct() {
$this

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorMailManagementListInboundWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorMailManagementWorkflow {
protected function didConstruct() {
$this

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorMailManagementListOutboundWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorMailManagementWorkflow {
protected function didConstruct() {
$this

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorMailManagementReceiveTestWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorMailManagementWorkflow {
protected function didConstruct() {
$this

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorMailManagementResendWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorMailManagementWorkflow {
protected function didConstruct() {
$this

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorMailManagementSendTestWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorMailManagementWorkflow {
protected function didConstruct() {
$this

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorMailManagementShowInboundWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorMailManagementWorkflow {
protected function didConstruct() {
$this

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorMailManagementShowOutboundWorkflow
extends PhabricatorSearchManagementWorkflow {
extends PhabricatorMailManagementWorkflow {
protected function didConstruct() {
$this